Acme-MITHALDU-XSGrabBag
view release on metacpan or search on metacpan
inc/Inline.pm view on Meta::CPAN
sub clean_build {
use strict;
my ($prefix, $dir);
my $o = shift;
$prefix = $o->{INLINE}{DIRECTORY};
opendir(BUILD, $prefix)
or croak "Can't open build directory: $prefix for cleanup $!\n";
while ($dir = readdir(BUILD)) {
my $maybedir = File::Spec->catdir($prefix,$dir);
if (($maybedir and -d $maybedir) and ($dir =~ /\w{36,}/)) {
$o->rmpath($prefix,$dir);
}
}
close BUILD;
}
#==============================================================================
# Apply a list of filters to the source code
#==============================================================================
sub filter {
my $o = shift;
my $new_code = $o->{API}{code};
for (@_) {
croak M52_invalid_filter($_) unless ref;
if (ref eq 'CODE') {
$new_code = $_->($new_code);
}
else {
$new_code = $_->filter($o, $new_code);
}
}
return $new_code;
}
#==============================================================================
# User wants to report a bug
#==============================================================================
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}
and send "Inline.REPORTBUG.tar.gz" as an email attachment to the author
of the offending Inline::* module with the subject line:
REPORTBUG: Inline.pm
Include in the email, a description of the problem and anything else that
you think might be helpful. Patches are welcome! :-\)
<-----------------------End of REPORTBUG Section------------------------------>
END
my %versions;
{
no strict 'refs';
%versions = map {eval "use $_();"; ($_, $ {$_ . '::VERSION'})}
qw (Digest::MD5 Parse::RecDescent
ExtUtils::MakeMaker File::Path FindBin
Inline
);
}
$o->mkpath($o->{API}{build_dir});
open REPORTBUG, "> ".File::Spec->catfile($o->{API}{build_dir},"REPORTBUG")
or croak M24_open_for_output_failed
(File::Spec->catfile($o->{API}{build_dir},"REPORTBUG"));
%Inline::REPORTBUG_Inline_Object = ();
%Inline::REPORTBUG_Perl_Config = ();
%Inline::REPORTBUG_Module_Versions = ();
print REPORTBUG Inline::denter->new()
->indent(*REPORTBUG_Inline_Object, $o,
*REPORTBUG_Perl_Config, \%Config::Config,
*REPORTBUG_Module_Versions, \%versions,
);
close REPORTBUG;
}
#==============================================================================
# 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});
But the FORCE_BUILD option is set, so your code will be recompiled.
I\'ll use this build directory:
$o->{API}{build_dir}
and I\'ll install the executable as:
( run in 2.103 seconds using v1.01-cache-2.11-cpan-e1769b4cff6 )