Alt-Math-Prime-FastSieve-Inline
view release on metacpan or search on metacpan
inc/Inline.pm view on Meta::CPAN
466467468469470471472473474475476477478479480481482483484485486}
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
658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697
$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
956957958959960961962963964965966967968969970971972973974975976}
#==============================================================================
# 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
104010411042104310441045104610471048104910501051105210531054105510561057105810591060#==============================================================================
# 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
147714781479148014811482148314841485148614871488148914901491149214931494149514961497sub
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
167716781679168016811682168316841685168616871688168916901691169216931694169516961697END
}
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
199819992000200120022003200420052006200720082009201020112012201320142015201620172018}
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
2029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056sub
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
113114115116117118119120121122123124125126127128129130131132133}
$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;
}
OUT
"package $class;\n"
;
if
(not
$opt
{-standalone}) {
OUT
"use Parse::RecDescent;\n"
;
}
inc/Parse/RecDescent.pm view on Meta::CPAN
19221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944
"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
195019511952195319541955195619571958195919601961196219631964196519661967196819691970}
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 )