Skip to content

Commit

Permalink
This is my patch patch.1g for perl5.001.
Browse files Browse the repository at this point in the history
This patch only includes updates to the lib/ directory and
the removal of the pod/modpods.  The main things are the following:

	The modpods are now embedded in their corresponding .pm files.

	The Grand AutoLoader patch.

	Updates to lib/ExtUtils/xsubpp by Paul Marquess 
	<pmarquess@bfsec.bt.co.uk>.

	Minor changes to a very few modules and pods.


To apply, change to your perl directory, run the commands above, then
apply with 
    patch -p1 -N  < thispatch.

After you apply this patch, you should go on to apply patch.1h and
patch.1i before reConfiguring and building.

Patch and enjoy,

	Andy Dougherty			doughera@lafcol.lafayette.edu
	Dept. of Physics
	Lafayette College, Easton PA

Here's the file-by-file description:

lib/AnyDBM_File.pm
    Embedded pod.

lib/AutoLoader.pm
    Grand AutoLoader patch.

    Embedded pod.

lib/AutoSplit.pm
    Grand AutoLoader patch.

    Embedded pod.

    Skip pod sections when splitting .pm files.

lib/Benchmark.pm
lib/Carp.pm
lib/Cwd.pm
lib/English.pm
    Grand AutoLoader patch.

    Embedded pod.

lib/Exporter.pm
    Grand AutoLoader patch.

    Embedded pod.

    Update comments to match behavior.

lib/ExtUtils/MakeMaker.pm
    Include installation of .pod and .pm files.

    Space out documentation for better printing with pod2man.

lib/ExtUtils/xsubpp
    Patches from Paul Marquess <pmarquess@bfsec.bt.co.uk>, 22 May 1995.
    Now at version 1.4.

lib/File/Basename.pm
    Embedded pod.

lib/File/CheckTree.pm
    Embedded pod.

lib/File/Find.pm
    Embedded pod.

    Included finddepth pod too.

lib/FileHandle.pm
    Embedded pod.

lib/Getopt/Long.pm
    Embedded pod.

    Fixed PERMUTE order bug.

lib/Getopt/Std.pm
    Embedded pod.

    Caught accessing undefined element off end of @arg array.

lib/I18N/Collate.pm
lib/IPC/Open2.pm
lib/IPC/Open3.pm
lib/Net/Ping.pm
    Embedded pod.

lib/Term/Complete.pm
    Embedded pod.

    Changed name from complete to Complete to match documentation and
    exported name.

lib/Text/Abbrev.pm
    Embedded pod.

lib/Text/Tabs.pm
    Updated.

lib/integer.pm
lib/less.pm
lib/sigtrap.pm
lib/strict.pm
lib/subs.pm
    Embedded pod.
  • Loading branch information
Andy Dougherty committed May 30, 1995
1 parent d1b9189 commit f06db76
Show file tree
Hide file tree
Showing 61 changed files with 1,388 additions and 2,104 deletions.
83 changes: 83 additions & 0 deletions lib/AnyDBM_File.pm
Expand Up @@ -7,3 +7,86 @@ eval { require DB_File } ||
eval { require GDBM_File } ||
eval { require SDBM_File } ||
eval { require ODBM_File };

=head1 NAME
AnyDBM_File - provide framework for multiple DBMs
NDBM_File, ODBM_File, SDBM_File, GDBM_File - various DBM implementations
=head1 SYNOPSIS
use AnyDBM_File;
=head1 DESCRIPTION
This module is a "pure virtual base class"--it has nothing of its own.
It's just there to inherit from one of the various DBM packages. It
prefers ndbm for compatibility reasons with Perl 4, then Berkeley DB (See
L<DB_File>), GDBM, SDBM (which is always there--it comes with Perl), and
finally ODBM. This way old programs that used to use NDBM via dbmopen()
can still do so, but new ones can reorder @ISA:
@AnyDBM_File::ISA = qw(DB_File GDBM_File NDBM_File);
Note, however, that an explicit use overrides the specified order:
use GDBM_File;
@AnyDBM_File::ISA = qw(DB_File GDBM_File NDBM_File);
will only find GDBM_File.
Having multiple DBM implementations makes it trivial to copy database formats:
use POSIX; use NDBM_File; use DB_File;
tie %newhash, DB_File, $new_filename, O_CREAT|O_RDWR;
tie %oldhash, NDBM_File, $old_filename, 1, 0;
%newhash = %oldhash;
=head2 DBM Comparisons
Here's a partial table of features the different packages offer:
odbm ndbm sdbm gdbm bsd-db
---- ---- ---- ---- ------
Linkage comes w/ perl yes yes yes yes yes
Src comes w/ perl no no yes no no
Comes w/ many unix os yes yes[0] no no no
Builds ok on !unix ? ? yes yes ?
Code Size ? ? small big big
Database Size ? ? small big? ok[1]
Speed ? ? slow ok fast
FTPable no no yes yes yes
Easy to build N/A N/A yes yes ok[2]
Size limits 1k 4k 1k[3] none none
Byte-order independent no no no no yes
Licensing restrictions ? ? no yes no
=over 4
=item [0]
on mixed universe machines, may be in the bsd compat library,
which is often shunned.
=item [1]
Can be trimmed if you compile for one access method.
=item [2]
See L<DB_File>.
Requires symbolic links.
=item [3]
By default, but can be redefined.
=back
=head1 SEE ALSO
dbm(3), ndbm(3), DB_File(3)
=cut
36 changes: 36 additions & 0 deletions lib/AutoLoader.pm
@@ -1,6 +1,24 @@
package AutoLoader;
use Carp;

=head1 NAME
AutoLoader - load functions only on demand
=head1 SYNOPSIS
package FOOBAR;
use Exporter;
use AutoLoader;
@ISA = (Exporter, AutoLoader);
=head1 DESCRIPTION
This module tells its users that functions in the FOOBAR package are to be
autoloaded from F<auto/$AUTOLOAD.al>. See L<perlsub/"Autoloading">.
=cut

AUTOLOAD {
my $name = "auto/$AUTOLOAD.al";
$name =~ s#::#/#g;
Expand All @@ -24,5 +42,23 @@ AUTOLOAD {
}
goto &$AUTOLOAD;
}

sub import
{
my ($callclass, $callfile, $callline,$path,$callpack) = caller(0);
($callpack = $callclass) =~ s#::#/#;
if (defined($path = $INC{$callpack . '.pm'}))
{
if ($path =~ s#^(.*)$callpack\.pm$#$1auto/$callpack/autosplit.ix# && -e $path)
{
eval {require $path};
carp $@ if ($@);
}
else
{
croak "Have not loaded $callpack.pm";
}
}
}

1;
25 changes: 24 additions & 1 deletion lib/AutoSplit.pm
Expand Up @@ -10,6 +10,19 @@ use Carp;
@EXPORT = qw(&autosplit &autosplit_lib_modules);
@EXPORT_OK = qw($Verbose $Keep $Maxlen $CheckForAutoloader $CheckModTime);

=head1 NAME
AutoSplit - split a package for autoloading
=head1 DESCRIPTION
This function will split up your program into files that the AutoLoader
module can handle. Normally only used to build autoloading Perl library
modules, especially extensions (like POSIX). You should look at how
they're built out for details.
=cut

# for portability warn about names longer than $maxlen
$Maxlen = 8; # 8 for dos, 11 (14-".al") for SYSVR3
$Verbose = 1; # 0=none, 1=minimal, 2=list .al files
Expand Down Expand Up @@ -83,7 +96,13 @@ sub autosplit_file{
open(IN, "<$filename") || die "AutoSplit: Can't open $filename: $!\n";
my($pm_mod_time) = (stat($filename))[9];
my($autoloader_seen) = 0;
my($in_pod) = 0;
while (<IN>) {
# Skip pod text.
$in_pod = 1 if /^=/;
$in_pod = 0 if /^=cut/;
next if ($in_pod || /^=cut/);

# record last package name seen
$package = $1 if (m/^\s*package\s+([\w:]+)\s*;/);
++$autoloader_seen if m/^\s*(use|require)\s+AutoLoader\b/;
Expand Down Expand Up @@ -199,15 +218,19 @@ sub autosplit_file{
next if $names{substr($subname,0,$maxflen-3)};
my($file) = "$autodir/$modpname/$_";
print " deleting $file\n" if ($Verbose>=2);
unlink $file or carp "Unable to delete $file: $!";
my($deleted,$thistime); # catch all versions on VMS
do { $deleted += ($thistime = unlink $file) } while ($thistime);
carp "Unable to delete $file: $!" unless $deleted;
}
closedir(OUTDIR);
}

open(TS,">$al_idx_file") or
carp "AutoSplit: unable to create timestamp file ($al_idx_file): $!";
print TS "# Index created by AutoSplit for $filename (file acts as timestamp)\n";
print TS "package $package;\n";
print TS map("sub $_ ;\n", @subnames);
print TS "1;\n";
close(TS);

check_unique($package, $Maxlen, 1, @names);
Expand Down
161 changes: 161 additions & 0 deletions lib/Benchmark.pm
@@ -1,5 +1,166 @@
package Benchmark;

=head1 NAME
Benchmark - benchmark running times of code
timethis - run a chunk of code several times
timethese - run several chunks of code several times
timeit - run a chunk of code and see how long it goes
=head1 SYNOPSIS
timethis ($count, "code");
timethese($count, {
'Name1' => '...code1...',
'Name2' => '...code2...',
});
$t = timeit($count, '...other code...')
print "$count loops of other code took:",timestr($t),"\n";
=head1 DESCRIPTION
The Benchmark module encapsulates a number of routines to help you
figure out how long it takes to execute some code.
=head2 Methods
=over 10
=item new
Returns the current time. Example:
use Benchmark;
$t0 = new Benchmark;
# ... your code here ...
$t1 = new Benchmark;
$td = timediff($t1, $t0);
print "the code took:",timestr($dt),"\n";
=item debug
Enables or disable debugging by setting the C<$Benchmark::Debug> flag:
debug Benchmark 1;
$t = timeit(10, ' 5 ** $Global ');
debug Benchmark 0;
=back
=head2 Standard Exports
The following routines will be exported into your namespace
if you use the Benchmark module:
=over 10
=item timeit(COUNT, CODE)
Arguments: COUNT is the number of time to run the loop, and
the second is the code to run. CODE may be a string containing the code,
a reference to the function to run, or a reference to a hash containing
keys which are names and values which are more CODE specs.
Side-effects: prints out noise to standard out.
Returns: a Benchmark object.
=item timethis
=item timethese
=item timediff
=item timestr
=back
=head2 Optional Exports
The following routines will be exported into your namespace
if you specifically ask that they be imported:
=over 10
clearcache
clearallcache
disablecache
enablecache
=back
=head1 NOTES
The data is stored as a list of values from the time and times
functions:
($real, $user, $system, $children_user, $children_system)
in seconds for the whole loop (not divided by the number of rounds).
The timing is done using time(3) and times(3).
Code is executed in the caller's package.
Enable debugging by:
$Benchmark::debug = 1;
The time of the null loop (a loop with the same
number of rounds but empty loop body) is subtracted
from the time of the real loop.
The null loop times are cached, the key being the
number of rounds. The caching can be controlled using
calls like these:
clearcache($key);
clearallcache();
disablecache();
enablecache();
=head1 INHERITANCE
Benchmark inherits from no other class, except of course
for Exporter.
=head1 CAVEATS
The real time timing is done using time(2) and
the granularity is therefore only one second.
Short tests may produce negative figures because perl
can appear to take longer to execute the empty loop
than a short test; try:
timethis(100,'1');
The system time of the null loop might be slightly
more than the system time of the loop with the actual
code and therefore the difference might end up being < 0.
More documentation is needed :-( especially for styles and formats.
=head1 AUTHORS
Jarkko Hietaniemi <Jarkko.Hietaniemi@hut.fi>,
Tim Bunce <Tim.Bunce@ig.co.uk>
=head1 MODIFICATION HISTORY
September 8th, 1994; by Tim Bunce.
=cut

# Purpose: benchmark running times of code.
#
#
Expand Down
24 changes: 24 additions & 0 deletions lib/Carp.pm
@@ -1,5 +1,29 @@
package Carp;

=head1 NAME
carp - warn of errors (from perspective of caller)
croak - die of errors (from perspective of caller)
confess - die of errors with stack backtrace
=head1 SYNOPSIS
use Carp;
croak "We're outta here!";
=head1 DESCRIPTION
The Carp routines are useful in your own modules because
they act like die() or warn(), but report where the error
was in the code they were called from. Thus if you have a
routine Foo() that has a carp() in it, then the carp()
will report the error as occurring where Foo() was called,
not where carp() was called.
=cut

# This package implements handy routines for modules that wish to throw
# exceptions outside of the current package.

Expand Down

0 comments on commit f06db76

Please sign in to comment.