Alt-Math-Prime-FastSieve-Inline

 view release on metacpan or  search on metacpan

inc/Inline.pm  view on Meta::CPAN

466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
}
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

658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
        $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

956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
}
 
#==============================================================================
# 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

1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
#==============================================================================
# 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

1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
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

1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
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

1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
}
 
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

2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
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

113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
}
 
$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

1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
    "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

1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
}
 
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:
        # 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.505 second using v1.01-cache-2.11-cpan-87723dcf8b7 )