BBS-Universal
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
if ($speed == 0) {
print $text;
} else {
my $l = length($text) - 1;
foreach my $c (0 .. $l) {
print substr($text, $c, 1);
sleep $speed;
}
} ## end else [ if ($speed eq '57600') ]
} ## end sub baud_print
sub merge { # Perl sometimes is a pain in the ...
my @dir;
opendir(my $DIR, 'lib/BBS/Universal/');
chomp(@dir = readdir($DIR));
closedir($DIR);
my $master = slurp_file('src/Universal.pm');
foreach my $file (sort(@dir)) {
next if ($file !~ /\.pm$/ || $file =~ /^\./);
my $shortfile = "$file";
$shortfile =~ s/\.pm//;
$shortfile = uc($shortfile) . '_VERSION';
open(my $FILE, '<', "lib/BBS/Universal/$file");
chomp(my @lines = <$FILE>);
close($FILE);
my $text = '';
foreach my $line (@lines) {
$line =~ s/^1\;//;
$line =~ s/^package/\# package/;
if ($line =~ /^BEGIN/) {
$line =~ s/BEGIN \{ //;
$line =~ s/ \}//;
$line =~ s/\$VERSION/\$$shortfile/;
$master =~ s/(\# VERSIONS \#)/ $line\n$1/s;
} else {
$text .= "$line\n";
}
} ## end foreach my $line (@lines)
$master =~ s/\# MANUAL IMPORT HERE #/$text \n\n\# MANUAL IMPORT HERE \#/;
} ## end foreach my $file (sort(@dir...))
$master =~ s/\# (VERSIONS|MANUAL IMPORT HERE) \#\n//s;
while ($master =~ /\n\n\n+/s) {
$master =~ s/\n\n\n+/\n\n/gs;
}
open(my $OUT, '>', 'lib/BBS/Universal.pm');
print $OUT $master;
close($OUT);
} ## end sub merge
sub delay {
my $d = shift;
sleep $d if ($speed > 0);
}
sub slurp_file {
my $file = shift;
return (
do { local (@ARGV, $/) = $file; <> }
);
} ## end sub slurp_file
__END__
( run in 1.028 second using v1.01-cache-2.11-cpan-d7f47b0818f )