Gantry
view release on metacpan or search on metacpan
for my $dst ("blib/lib/Gantry/Init.pm", $initf) {
my $orig_mode = (stat $dst)[2];
my $rw_mode = 0666;
chmod $rw_mode, $dst or die "Can't chmod $rw_mode $dst: $!";
open( INIT_FILE, "> $dst" ) or die "$!";
print INIT_FILE $init_pkg;
close INIT_FILE;
# restore the perms
chmod $orig_mode, $dst or die "Can't chmod $orig_mode $dst: $!";
}
eval {
# this should have been done during perl Build.PL
if ( not -d $tmpl_dir ) {
File::Path::mkpath( $tmpl_dir );
}
};
if ( $@ ) {
print "Error: unable to create directory $tmpl_dir\n";
$@ =~ s/ at .+?$//;
die( "$@\n" );
}
my $blib_tmpl_dir = File::Spec->catdir(
$self->blib, 'web', $p->{build_web_directory}
);
eval {
require File::Copy::Recursive;
import File::Copy::Recursive 'dircopy';
$num = dircopy($blib_tmpl_dir, $tmpl_dir) || 0;
};
if ( $@ ) {
print "\nError coping templates:\n";
print $@ . "\n";
}
else {
print "\n$num Gantry templates copied to $tmpl_dir\n";
}
}
else {
print "SKIPPING WEB CONTENT INSTALL\n";
}
print "\n";
} # end ACTION_install
sub process_web_files {
my $self = shift;
my $files = $self->find_web_files;
return unless @$files;
my $tmpl_dir = File::Spec->catdir($self->blib, 'web');
File::Path::mkpath( $tmpl_dir );
foreach my $file (@$files) {
my $result = $self->copy_if_modified($file, $tmpl_dir)
or next;
#$self->fix_shebang_line($result);
}
}
sub find_web_files {
my $self = shift;
my $p = $self->{properties};
my $b_tmpl_dir = $p->{build_web_directory};
$b_tmpl_dir =~ s/\/$//g;
if (my $files = $p->{web_files}) {
if ( UNIVERSAL::isa($files, 'HASH') ) {
my @files = [keys %$files];
return( \@files );
}
my @files;
foreach my $glob ( @$files ) {
$glob = "$b_tmpl_dir/$glob";
push( @files, glob( $glob ) );
}
return( \@files );
return( [ map $self->localize_file_path($_), @files ] );
return( \@localized );
}
}
sub web_files {
my $self = shift;
for ($self->{properties}{web_files}) {
$_ = shift if @_;
return unless $_;
# Always coerce into a hash
return $_ if UNIVERSAL::isa($_, 'HASH');
return $_ = {$_ => 1} unless ref();
return { map {$_,1} @$_ };
}
}
} ); # end return
} # end _custom_code
( run in 1.237 second using v1.01-cache-2.11-cpan-39bf76dae61 )