Alt-Acme-Math-XS-CPP
view release on metacpan or search on metacpan
inc/Inline/Module.pm view on Meta::CPAN
...
# XXX - think about this later:
# our \$VERSION = '0.0.5';
# bootstrap $module \$VERSION;
}
sub read_file {
my ($class, $filepath) = @_;
open IN, '<', $filepath
or die "Can't open '$filepath' for input:\n$!";
my $code = do {local $/; <IN>};
close IN;
return $code;
}
sub write_module {
my ($class, $dest, $module, $code, $onchange) = @_;
$onchange ||= 0;
$code =~ s/\n+__END__\n.*//s;
my $filepath = $module;
$filepath =~ s!::!/!g;
$filepath = "$dest/$filepath.pm";
my $dirpath = $filepath;
$dirpath =~ s!(.*)/.*!$1!;
File::Path::mkpath($dirpath);
return if $onchange and
-e $filepath and
$class->read_file($filepath) eq $code;
unlink $filepath;
open OUT, '>', $filepath
or die "Can't open '$filepath' for output:\n$!";
print OUT $code;
close OUT;
return $filepath;
}
sub add_to_manifest {
my ($class, $distdir, @files) = @_;
my $manifest = "$distdir/MANIFEST";
if (-w $manifest) {
open my $out, '>>', $manifest
or die "Can't open '$manifest' for append:\n$!";
for my $file (@files) {
print $out "$file\n";
}
close $out;
}
}
sub smoke_system_info_dump {
my ($class, @msg) = @_;
my $msg = sprintf(@msg);
chomp $msg;
require Data::Dumper;
local $Data::Dumper::Sortkeys = 1;
local $Data::Dumper::Terse = 1;
local $Data::Dumper::Indent = 1;
my @path_files;
File::Find::find({
wanted => sub {
push @path_files, $File::Find::name if -f;
},
}, File::Spec->path());
my $dump = Data::Dumper::Dumper(
{
'ENV' => \%ENV,
'Config' => \%Config::Config,
'Path Files' => \@path_files,
},
);
Carp::confess <<"..."
Error: $msg
System Data:
$dump
Error: $msg
...
}
1;
( run in 0.794 second using v1.01-cache-2.11-cpan-39bf76dae61 )