view release on metacpan or search on metacpan
inc/Module/AutoInstall.pm view on Meta::CPAN
else {
$DisabledTests{$_} = 1 for map { glob($_) } @tests;
}
}
if ( @Missing and not( $CheckOnly or $UnderCPAN ) ) {
require Config;
print
"*** Dependencies will be installed the next time you type '$Config::Config{make}'.\n";
# make an educated guess of whether we'll need root permission.
print " (You may need to do that as the 'root' user.)\n"
if eval '$>';
}
print "*** $class configuration finished.\n";
chdir $cwd;
# import to main::
no strict 'refs';
*{'main::WriteMakefile'} = \&Write if caller(0) eq 'main';
inc/Module/AutoInstall.pm view on Meta::CPAN
sub _has_cpanplus {
return (
$HasCPANPLUS = (
$INC{'CPANPLUS/Config.pm'}
or _load('CPANPLUS::Shell::Default')
)
);
}
# make guesses on whether we're under the CPAN installation directory
sub _under_cpan {
require Cwd;
require File::Spec;
my $cwd = File::Spec->canonpath( Cwd::cwd() );
my $cpan = File::Spec->canonpath( $CPAN::Config->{cpan_home} );
return ( index( $cwd, $cpan ) > -1 );
}
lib/App/I18N.pm view on Meta::CPAN
'Locale::Maketext::Extract::Plugin::PPI' => [ 'pm','pl' ],
'tt2' => [ ],
# 'perl' => ['pl','pm','js','json'],
'perl' => [ '*' ], # _( ) , gettext( ) , loc( ) ...
'mason' => [ ] ,
'generic' => [ '*' ],
},
verbose => 1, warnings => 1 );
}
sub guess_appname {
return lc(basename(getcwd()));
}
sub pot_name {
my $self = shift;
return guess_appname();
}
sub _check_mime_type {
my $self = shift;
my $local_path = shift;
my $mimeobj = $MIME->mimeTypeOf($local_path);
my $mime_type = ($mimeobj ? $mimeobj->type : "unknown");
return if ( $mime_type =~ /^image/ );
return if ( $mime_type =~ /compressed/ ); # ignore compressed archive files
lib/App/I18N.pm view on Meta::CPAN
if( $cmd->{mo} ) {
my $mofile = $translation;
$mofile =~ s{\.po$}{.mo};
$logger->info( "Generating MO file: $mofile" );
system(qq{msgfmt -v $translation -o $mofile});
}
}
sub guess_podir {
my ($class,$cmd) = @_;
my $podir;
$podir = 'po' if -e 'po';
$podir = 'locale' , $cmd->{locale} = 1 if -e 'locale';
$podir ||= 'locale' if $cmd->{locale};
$podir ||= 'po';
return $podir;
}
sub get_po_path {
lib/App/I18N/Command/Auto.pm view on Meta::CPAN
unless( $self->{from} ) {
return $logger->error( "--from [Language] is required. please specify your language to translate." );
}
# XXX: check this option
$self->{backend} ||= 'rest-google';
my $podir = $self->{podir};
$podir = App::I18N->guess_podir( $self ) unless $podir;
$self->{mo} = 1 if $self->{locale};
mkpath [ $podir ];
my $pot_name = App::I18N->pot_name;
my $potfile = File::Spec->catfile( $podir, $pot_name . ".pot") ;
if( ! -e $potfile ) {
$logger->info( "$potfile not found." );
return;
}
lib/App/I18N/Command/Gen.pm view on Meta::CPAN
LAST UPDATE: $now
END
}
sub run {
my ( $self, $type ) = @_;
my $output_dir = $self->{output_dir} || getcwd();
my $logger = App::I18N->logger();
my $podir = $self->{podir};
$podir = App::I18N->guess_podir( $self ) unless $podir;
$self->{mo} = 1 if $self->{locale};
use Encode;
File::Path::mkpath [ $output_dir ];
if( $self->{locale} ) {
}
else {
lib/App/I18N/Command/Lang.pm view on Meta::CPAN
$self->logger->info( "Generating MO file: $mofile" );
system(qq{msgfmt -v $pofile -o $mofile});
}
}
sub run {
my ( $self, @langs ) = @_;
my $logger = $self->logger();
my $podir = $self->{podir};
$podir = App::I18N->guess_podir( $self ) unless $podir;
$self->{mo} = 1 if $self->{locale};
mkpath [ $podir ];
my $pot_name = App::I18N->pot_name;
my $potfile = File::Spec->catfile( $podir, $pot_name . ".pot") ;
if( ! -e $potfile ) {
$logger->info( "$potfile not found." );
return;
lib/App/I18N/Command/Parse.pm view on Meta::CPAN
print _( "Hello %1" , \$world );
}
END
}
sub run {
my ( $self, @args ) = @_;
my $podir = $self->{podir};
$podir = App::I18N->guess_podir( $self ) unless $podir;
$self->{mo} = 1 if $self->{locale};
my @dirs = @args;
App::I18N->extract_messages( @dirs );
# update app.pot catalog
mkpath [ $podir ];
my $pot_name = App::I18N->pot_name;
App::I18N->update_catalog( File::Spec->catfile( $podir, $pot_name . ".pot") );
lib/App/I18N/Command/Server.pm view on Meta::CPAN
# }
#
sub run {
my ($self) = @_;
$self->{mo} = 1 if $self->{locale};
my $podir = $self->{podir};
$podir = App::I18N->guess_podir( $self ) unless $podir;
my @dirs = @{ $self->{directories} || [] };
my $logger = App::I18N->logger;
# pre-process messages
my $lme = App::I18N->lm_extract;
if( @dirs ) {
App::I18N->extract_messages( @dirs );
mkpath [ $podir ];
App::I18N->update_catalog(
lib/App/I18N/Command/Status.pm view on Meta::CPAN
print "=" x ($value_width);
print " " x ($rest_width);
print "]";
}
sub run {
my $self = shift;
my $logger = $self->logger();
my $podir = $self->{podir};
$podir = App::I18N->guess_podir( $self ) unless $podir;
$self->{mo} = 1 if $self->{locale};
print "Translation Status:\n";
my @pofiles = File::Find::Rule->file->name( "*.po" )->in( $podir );
for my $pofile ( @pofiles ) {
my $extract = Locale::Maketext::Extract->new;
my $lang;
if( $self->{locale} ) {
lib/App/I18N/Command/Update.pm view on Meta::CPAN
sub options { (
'podir=s' => 'podir',
'mo' => 'mo', # generate mo file
'locale' => 'locale',
) }
sub run {
my ( $self, $lang ) = @_;
my $logger = App::I18N->logger();
my $podir = $self->{podir};
$podir = App::I18N->guess_podir( $self ) unless $podir;
$self->{mo} = 1 if $self->{locale};
my @pofiles = File::Find::Rule->file->name( "*.po" )->in( $podir );
for my $pofile ( @pofiles ) {
$logger->info( "Updating $pofile" );
if( $self->{mo} ) {
my $mofile = $pofile;
$mofile =~ s{\.po$}{.mo};
$logger->info( "Updating $mofile" );
qx{msgfmt -v $pofile -o $mofile};
share/static/Stream.js view on Meta::CPAN
} else {
//No
//Grab from the start of the start flag to the end of the chunk
this.currentStream += packet.substr(startFlag);
//Leave this.currentStream set and wait for another packet
}
} else {
//WTF? No open stream and no start flag means someone fucked up the output
//...OR maybe they're sending garbage in front of their first payload. Weird.
//I guess just ignore it for now?
}
//Else we have an open stream
} else {
//Is there an end flag?
if(endFlag > -1) {
//Yes
//Use the end flag to grab the rest of the payload
var chunk = packet.substring(0, endFlag);
this.currentStream += chunk;