Alt-Math-Prime-FastSieve-Inline
view release on metacpan or search on metacpan
inc/Inline.pm view on Meta::CPAN
}
return if $o->{CONFIG}{_INSTALL_};
return unless $o->{CONFIG}{VERSION};
croak M26_error_version_without_name()
unless $o->{CONFIG}{NAME};
my @pkgparts = split(/::/, $o->{API}{pkg});
my $realname = File::Spec->catfile(@pkgparts) . '.pm';
my $realname_unix = File::Spec::Unix->catfile(@pkgparts) . '.pm';
my $realpath = $INC{$realname_unix}
or croak M27_module_not_indexed($realname_unix);
my ($volume,$dir,$file) = File::Spec->splitpath($realpath);
my @dirparts = File::Spec->splitdir($dir);
pop @dirparts unless $dirparts[-1];
push @dirparts, $file;
my @endparts = splice(@dirparts, 0 - @pkgparts);
$dirparts[-1] = 'arch'
if $dirparts[-2] eq 'blib' && $dirparts[-1] eq 'lib';
File::Spec->catfile(@endparts) eq $realname
inc/Inline.pm view on Meta::CPAN
$o->{API}{code} = join '', @$code;
}
elsif ($code =~ m|[/\\:]| and
$code =~ m|^[/\\:\w.\-\ \$\[\]<>]+$|) {
if (-f $code) {
local ($/, *CODE);
open CODE, "< $code" or croak M06_code_file_failed_open($code);
$o->{API}{code} = <CODE>;
}
else {
croak M07_code_file_does_not_exist($code);
}
}
else {
$o->{API}{code} = $code;
}
}
#==============================================================================
# Get the source code from an Inline::Files filehandle
#==============================================================================
sub read_inline_file {
my $o = shift;
my ($lang, $pkg) = @{$o->{API}}{qw(language_id pkg)};
my $langfile = uc($lang);
croak M59_bad_inline_file($lang) unless $langfile =~ /^[A-Z]\w*$/;
croak M60_no_inline_files()
unless (defined $INC{File::Spec::Unix->catfile("Inline","Files.pm")} and
$Inline::Files::VERSION =~ /^\d\.\d\d$/ and
$Inline::Files::VERSION ge '0.51');
croak M61_not_parsed() unless $lang = Inline::Files::get_filename($pkg);
{
no strict 'refs';
local $/;
$Inline::FILE = \*{"${pkg}::$langfile"};
# open $Inline::FILE;
$o->{API}{code} = <$Inline::FILE>;
# close $Inline::FILE;
}
}
inc/Inline.pm view on Meta::CPAN
}
#==============================================================================
# Set things up so that the extension gets installed into the blib/arch.
# Then 'make install' will do the right thing.
#==============================================================================
sub install {
my ($module, $DIRECTORY);
my $o = shift;
croak M64_install_not_c($o->{API}{language_id})
unless uc($o->{API}{language_id}) =~ /^(C|CPP|Java|Python|Ruby|Lisp|Pdlpp)$/ ;
croak M36_usage_install_main()
if ($o->{API}{pkg} eq 'main');
croak M37_usage_install_auto()
if $o->{CONFIG}{AUTONAME};
croak M38_usage_install_name()
unless $o->{CONFIG}{NAME};
croak M39_usage_install_version()
unless $o->{CONFIG}{VERSION};
croak M40_usage_install_badname($o->{CONFIG}{NAME}, $o->{API}{pkg})
inc/Inline.pm view on Meta::CPAN
#==============================================================================
# Get config hints
#==============================================================================
sub with_configs {
my $o = shift;
my @configs;
for my $mod (@{$o->{CONFIG}{WITH}}) {
my $ref = eval { $mod->Inline($o->{API}{language}); };
croak M25_no_WITH_support($mod, $@) if $@;
croak M65_WITH_not_lang($mod, $o->{API}{language}) unless $ref;
push @configs, %$ref;
}
return @configs;
}
#==============================================================================
# Blindly untaint tainted fields in %ENV.
#==============================================================================
sub env_untaint {
my $o = shift;
inc/Inline.pm view on Meta::CPAN
sub M06_code_file_failed_open {
my ($file) = @_;
return <<END;
Couldn't open Inline code file '$file':
$!
END
#'
}
sub M07_code_file_does_not_exist {
my ($file) = @_;
return <<END;
Inline assumes '$file' is a filename,
and that file does not exist.
END
}
sub M08_no_DATA_source_code {
my ($lang) = @_;
inc/Inline.pm view on Meta::CPAN
END
}
sub M26_error_version_without_name {
return <<END;
Specifying VERSION option without NAME option is not permitted.
END
}
sub M27_module_not_indexed {
my ($mod) = @_;
return <<END;
You are attempting to load an extension for '$mod',
but there is no entry for that module in %INC.
END
}
sub M28_error_grokking_path {
my ($path) = @_;
inc/Inline.pm view on Meta::CPAN
}
sub M60_no_inline_files {
return <<END;
It appears that you have requested to use Inline with Inline::Files.
You need to explicitly 'use Inline::Files;' before your 'use Inline'.
END
}
sub M61_not_parsed {
return <<END;
It does not appear that your program has been properly parsed by Inline::Files.
END
}
sub M62_invalid_config_file {
my ($config) = @_;
return <<END;
You are using a config file that was created by an older version of Inline:
inc/Inline.pm view on Meta::CPAN
sub M63_no_source {
my ($pkg) = @_;
return <<END;
This module $pkg can not be loaded and has no source code.
You may need to reinstall this module.
END
}
sub M64_install_not_c {
my ($lang) = @_;
return <<END;
Invalid attempt to install an Inline module using the '$lang' language.
Only C and CPP (C++) based modules are currently supported.
END
}
sub M65_WITH_not_lang {
my ($mod, $lang) = @_;
return <<END;
$mod gave no 'with' hints for $lang.
END
}
1;
inc/Parse/RecDescent.pm view on Meta::CPAN
}
$self = Parse::RecDescent->new($grammar, # $grammar
1, # $compiling
$class # $namespace
)
|| croak("Can't compile bad grammar")
if $grammar;
# Do not allow &DESTROY to remove the precompiled namespace
delete $self->{_not_precompiled};
foreach ( keys %{$self->{rules}} ) {
$self->{rules}{$_}{changed} = 1;
}
print OUT "package $class;\n";
if (not $opt{-standalone}) {
print OUT "use Parse::RecDescent;\n";
}
inc/Parse/RecDescent.pm view on Meta::CPAN
"rules" => {},
"namespace" => $name_space_name,
"startcode" => '',
"localvars" => '',
"_AUTOACTION" => undef,
"_AUTOTREE" => undef,
# Precompiled parsers used to set _precompiled, but that
# wasn't present in some versions of Parse::RecDescent used to
# build precompiled parsers. Instead, set a new
# _not_precompiled flag, which is remove from future
# Precompiled parsers at build time.
"_not_precompiled" => 1,
};
if ($::RD_AUTOACTION) {
my $sourcecode = $::RD_AUTOACTION;
$sourcecode = "{ $sourcecode }"
unless $sourcecode =~ /\A\s*\{.*\}\s*\Z/;
$self->{_check}{itempos} =
$sourcecode =~ /\@itempos\b|\$itempos\s*\[/;
$self->{_AUTOACTION}
inc/Parse/RecDescent.pm view on Meta::CPAN
}
sub Compile($$$$) {
die "Compilation of Parse::RecDescent grammars not yet implemented\n";
}
sub DESTROY {
my ($self) = @_;
my $namespace = $self->{namespace};
$namespace =~ s/Parse::RecDescent:://;
if ($self->{_not_precompiled}) {
# BEGIN WORKAROUND
# Perl has a bug that creates a circular reference between
# @ISA and that variable's stash:
# https://rt.perl.org/rt3/Ticket/Display.html?id=92708
# Emptying the array before deleting the stash seems to
# prevent the leak. Once the ticket above has been resolved,
# these two lines can be removed.
no strict 'refs';
@{$self->{namespace} . '::ISA'} = ();
# END WORKAROUND
( run in 0.498 second using v1.01-cache-2.11-cpan-cc502c75498 )