Auto-autosplit

Peter Scott peter at PSDT.com
Thu Dec 12 15:10:21 CST 2002


This code has been rather useful.  I'm wondering whether I've 
reinvented a wheel, and if so, which one.  Otherwise, this could be 
improved a bit with
use of File::Spec, and maybe I can find a way to modularise it.



# Autosplitting because we expect to have a number of large methods
# which we won't use many of at a time.

# Because it's a nuisance to remember to do the split, we do it
# if necessary and if we can.  If it's needed but we can't do it,
# we croak.
use Carp;
use AutoLoader 'AUTOLOAD';
BEGIN {
   my $pack = __PACKAGE__;
   my $dir = __FILE__;
   $dir =~ s#[^/]+$##;
   $dir ||= '.';
   $pack =~ s#::#/#g;
   if (-M __FILE__ < -M "$dir/auto/$pack/autosplit.ix")
   {
     open TEST, ">>$dir/auto/$pack/autosplit.ix"
       or croak "Module has not been autosplit since last change\n";
     close TEST;
     require AutoSplit;
     AutoSplit->import;
     autosplit(__FILE__, "$dir/auto", 0, 1, 0);
   }
}
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com/




More information about the Victoria-pm mailing list