Changeset 24525
- Timestamp:
- 11/21/08 01:20:38 (7 weeks ago)
- Location:
- lang/perl/DateTime-Lite/trunk/tools
- Files:
-
- 3 modified
-
benchmark/simple_create.pl (modified) (1 diff)
-
lib/DateTime/Lite/Tool/Locale/Generator.pm (modified) (2 diffs)
-
lib/DateTime/Lite/Tool/Locale/LDML.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/DateTime-Lite/trunk/tools/benchmark/simple_create.pl
r24502 r24525 9 9 cmpthese(10000, { 10 10 dt => sub { 11 DateTime->new(year => 2000, month => 1, day => 1 ); #, time_zone => 'Asia/Tokyo')11 DateTime->new(year => 2000, month => 1, day => 1, time_zone => 'Asia/Tokyo') 12 12 }, 13 13 dt_lite => sub { 14 DateTime::Lite->new(year => 2000, month => 1, day => 1 ); #, time_zone => 'Asia/Tokyo')14 DateTime::Lite->new(year => 2000, month => 1, day => 1, time_zone => 'Asia/Tokyo') 15 15 } 16 16 }); -
lang/perl/DateTime-Lite/trunk/tools/lib/DateTime/Lite/Tool/Locale/Generator.pm
r24516 r24525 9 9 use File::Temp (); 10 10 use LWP::UserAgent; 11 use Carp::Always; 11 12 12 use LWP::UserAgent;13 our $VERSION = '0.00001'; 13 14 14 15 with 'MooseX::Getopt'; … … 107 108 108 109 sub generate_dat_file { 109 my $ldml = shift;110 my ($self, $ldml) = @_; 110 111 111 my $dat_file = file( qw( misc locale ), $ldml->id() . q{.dat} );112 my $dat_file = Path::Class::File->new( qw( misc locale ), $ldml->id() . q{.dat} ); 112 113 # write_to_manifest($dat_file); 114 115 my $parent = $dat_file->parent; 116 if (! -d $parent) { 117 $parent->mkpath() or die; 118 } 113 119 114 120 open my $fh, '>:utf8', $dat_file 115 121 or die "Cannot write to $dat_file: $!"; 116 122 117 write_pm_header( $fh, $ldml ); 118 write_pm_inheritance( $fh, $ldml ); 119 write_pm_cldr_version( $fh ); 120 write_pm_subs( $fh, $ldml ); 121 write_pm_footer( $fh, $ldml ); 123 # write_pm_header( $fh, $ldml ); 124 # write_pm_inheritance( $fh, $ldml ); 125 # write_pm_cldr_version( $fh ); 126 # write_pm_subs( $fh, $ldml ); 127 # write_pm_footer( $fh, $ldml ); 128 #} 129 130 print $fh <<EOF; 131 ########################################################################### 132 # 133 # This file is auto-generated by the Perl DateTime Suite time locale 134 # generator ($VERSION). This code generator comes with the 135 # DateTime::Locale distribution in the tools/ directory, and is called 136 # $0. 137 # 138 # This file as generated from the CLDR XML locale data. See the 139 # LICENSE.cldr file included in this distribution for license details. 140 # 141 # Do not edit this file directly. 142 # 143 ########################################################################### 144 EOF 145 my %data = ( 146 cldr_version => $self->version 147 ); 148 149 foreach my $attr ( sort { $a->name() cmp $b->name() } 150 DateTime::Lite::Tool::Locale::LDML->meta()->compute_all_applicable_attributes() ) 151 { 152 next unless $attr->name() =~ 153 /^(?:day_|month_|quarter_|am_pm|era_|date_|time_|datetime_|first_day_)/; 154 155 next if make_alias( $fh, $ldml, $attr->name() ); 156 157 my $type = $attr->type_constraint(); 158 159 if ( $type->is_a_type_of('ArrayRef') ) 160 { 161 write_arrayref_sub( $fh, $ldml, $attr->name() ); 162 } 163 elsif ( $type->is_a_type_of('HashRef') ) 164 { 165 write_hashref_sub( $fh, $ldml, $attr->name() ); 166 } 167 elsif ( $type->is_a_type_of('Str') ) 168 { 169 write_string_sub( $fh, $ldml, $attr->name() ); 170 } 171 elsif ( $type->is_a_type_of('Int') ) 172 { 173 write_int_sub( $fh, $ldml, $attr->name() ); 174 } 175 else 176 { 177 die "Cannot handle type: " . $type->name(); 178 } 179 } 180 122 181 } 123 182 -
lang/perl/DateTime-Lite/trunk/tools/lib/DateTime/Lite/Tool/Locale/LDML.pm
r24516 r24525 507 507 # alias for the entire file, so they can be investigated as 508 508 # needed. 509 509 510 my $path = $node->getAttribute('path') || $node->parentNode()->nodePath(); 511 512 if (! $path) { 513 printf STDERR "TODO: alias node has source (%s), but we don't know to do with it\n", $node->getAttribute('source'); 514 return; 515 } 510 516 511 517 $class->_replace_alias_with_path( $node, $path, $doc, $target_file );
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)