Acme-MITHALDU-XSGrabBag
view release on metacpan or search on metacpan
inc/Inline.pm view on Meta::CPAN
:
join ':', grep {/^\// and -d $_ and $< == $> ? 1 : not (-W $_ or -O $_)
} split /:/, $ENV{PATH};
map {($_) = /(.*)/} @INC;
# list cherry-picked from `perldoc perlrun`
delete @ENV{qw(PERL5OPT PERL5SHELL PERL_ROOT IFS CDPATH ENV BASH_ENV)};
$ENV{SHELL} = '/bin/sh' if -x '/bin/sh';
$< = $> if $< != $>; # so child processes retain euid - ignore failure
}
#==============================================================================
# Blindly untaint tainted fields in Inline object.
#==============================================================================
sub obj_untaint {
my $o = shift;
warn "In Inline::obj_untaint() : Blindly untainting tainted fields in Inline object.\n" unless $o->{CONFIG}{NO_UNTAINT_WARN};
($o->{INLINE}{ILSM_module}) = $o->{INLINE}{ILSM_module} =~ /(.*)/;
($o->{API}{directory}) = $o->{API}{directory} =~ /(.*)/;
($o->{API}{build_dir}) = $o->{API}{build_dir} =~ /(.*)/;
inc/Inline.pm view on Meta::CPAN
#==============================================================================
sub reportbug {
use strict;
my $o = shift;
return if $o->{INLINE}{reportbug_handled}++;
print STDERR <<END;
<-----------------------REPORTBUG Section------------------------------------->
REPORTBUG mode in effect.
Your Inline $o->{API}{language_id} code will be processed in the build directory:
$o->{API}{build_dir}
A perl-readable bug report including your perl configuration and run-time
diagnostics will also be generated in the build directory.
When the program finishes please bundle up the above build directory with:
tar czf Inline.REPORTBUG.tar.gz $o->{API}{build_dir}
inc/Inline.pm view on Meta::CPAN
#==============================================================================
# Print a small report if PRINT_INFO option is set.
#==============================================================================
sub print_info {
use strict;
my $o = shift;
print STDERR <<END;
<-----------------------Information Section----------------------------------->
Information about the processing of your Inline $o->{API}{language_id} code:
END
print STDERR <<END if ($o->{INLINE}{object_ready});
Your module is already compiled. It is located at:
$o->{API}{location}
END
print STDERR <<END if ($o->{INLINE}{object_ready} and $o->{CONFIG}{FORCE_BUILD});
inc/Inline.pm view on Meta::CPAN
END
($terminate ? <<END : "");
Since you are running as a privileged user, Inline.pm is terminating.
END
}
sub M51_unused_DATA {
return <<END;
One or more DATA sections were not processed by Inline.
END
}
sub M52_invalid_filter {
my ($filter) = @_;
return <<END;
Invalid filter '$filter' is not a reference.
END
inc/Inline/C.pm view on Meta::CPAN
next if $value eq 'DISABLE';
die "PROTOTYPES can be only either 'ENABLE' or 'DISABLE' - not $value";
}
if ($key eq 'PROTOTYPE') {
die "PROTOTYPE configure arg must specify a hash reference"
unless ref($value) eq 'HASH';
$o->{CONFIG}{PROTOTYPE} = $value;
next;
}
if ($key eq 'CPPFLAGS') {
# C preprocessor flags, used by Inline::Filters::Preprocess()
next;
}
my $class = ref $o; # handles subclasses correctly.
croak "'$key' is not a valid config option for $class\n";
}
}
sub add_list {
my $o = shift;
inc/Inline/C.pm view on Meta::CPAN
#==============================================================================
# Return a small report about the C code..
#==============================================================================
sub info {
my $o = shift;
return <<END if $o->{ILSM}{XSMODE};
No information is currently generated when using XSMODE.
END
my $text = '';
$o->preprocess;
$o->parse;
if (defined $o->{ILSM}{parser}{data}{functions}) {
$text .= "The following Inline $o->{API}{language} function(s) have been successfully bound to Perl:\n";
my $parser = $o->{ILSM}{parser};
my $data = $parser->{data};
for my $function (sort @{$data->{functions}}) {
my $return_type = $data->{function}{$function}{return_type};
my @arg_names = @{$data->{function}{$function}{arg_names}};
my @arg_types = @{$data->{function}{$function}{arg_types}};
my @args = map {$_ . ' ' . shift @arg_names} @arg_types;
inc/Inline/C.pm view on Meta::CPAN
$lockfh = Win32::Mutex->new(0, $file) or die "lockmutex $file: $^E";
$lockfh->wait(); #acquire, can't use 1 to new(), since if new() opens
#existing instead of create new Muxtex, it is not acquired
}
else {
$file = File::Spec->catfile($o->{API}{directory}, '.lock');
open $lockfh, '>', $file or die "lockfile $file: $!";
flock($lockfh, LOCK_EX) or die "flock: $!\n" if $^O !~ /^VMS|riscos|VOS$/;
}
$o->mkpath($o->{API}{build_dir});
$o->call('preprocess', 'Build Preprocess');
$o->call('parse', 'Build Parse');
$o->call('write_XS', 'Build Glue 1');
$o->call('write_Inline_headers', 'Build Glue 2');
$o->call('write_Makefile_PL', 'Build Glue 3');
$o->call('compile', 'Build Compile');
if (IS_WIN32) {
$lockfh->release or die "releasemutex $file: $^E";
}
else {
flock($lockfh, LOCK_UN) if $^O !~ /^VMS|riscos|VOS$/;
inc/Inline/C.pm view on Meta::CPAN
if $o->{CONFIG}{BUILD_TIMERS};
print STDERR "${i}Finished $header Stage\n" if $o->{CONFIG}{BUILD_NOISY};
printf STDERR "${i}Time for $header Stage: %5.4f secs\n", $time
if $o->{CONFIG}{BUILD_TIMERS};
print STDERR "\n" if $o->{CONFIG}{BUILD_NOISY};
}
#==============================================================================
# Apply any
#==============================================================================
sub preprocess {
my $o = shift;
return if $o->{ILSM}{parser};
$o->get_maps;
$o->get_types;
$o->{ILSM}{code} = $o->filter(@{$o->{ILSM}{FILTERS}});
}
#==============================================================================
# Parse the function definition information out of the C code
#==============================================================================
inc/Inline/C.pm view on Meta::CPAN
\};
WriteMakefile(\%options);
# Remove the Makefile dependency. Causes problems on a few systems.
sub MY::makefile { '' }
END
close MF;
}
#==============================================================================
# Run the build process.
#==============================================================================
sub compile {
my $o = shift;
my $build_dir = $o->{API}{build_dir};
my $cwd = &cwd;
($cwd) = $cwd =~ /(.*)/ if $o->UNTAINT;
chdir $build_dir;
# Run these in an eval block, so that we get to chdir back to
( run in 0.251 second using v1.01-cache-2.11-cpan-8d75d55dd25 )