xref: /openbsd-src/gnu/usr.bin/perl/cpan/AutoLoader/lib/AutoLoader.pm (revision 6fb12b7054efc6b436584db6cef9c2f85c0d7e27)
1b39c5158Smillertpackage AutoLoader;
2b39c5158Smillert
3b39c5158Smillertuse strict;
4b39c5158Smillertuse 5.006_001;
5b39c5158Smillert
6b39c5158Smillertour($VERSION, $AUTOLOAD);
7b39c5158Smillert
8b39c5158Smillertmy $is_dosish;
9b39c5158Smillertmy $is_epoc;
10b39c5158Smillertmy $is_vms;
11b39c5158Smillertmy $is_macos;
12b39c5158Smillert
13b39c5158SmillertBEGIN {
14b39c5158Smillert    $is_dosish = $^O eq 'dos' || $^O eq 'os2' || $^O eq 'MSWin32' || $^O eq 'NetWare';
15b39c5158Smillert    $is_epoc = $^O eq 'epoc';
16b39c5158Smillert    $is_vms = $^O eq 'VMS';
17b39c5158Smillert    $is_macos = $^O eq 'MacOS';
18*6fb12b70Safresh1    $VERSION = '5.74';
19b39c5158Smillert}
20b39c5158Smillert
21b39c5158SmillertAUTOLOAD {
22b39c5158Smillert    my $sub = $AUTOLOAD;
2391f110e0Safresh1    autoload_sub($sub);
2491f110e0Safresh1    goto &$sub;
2591f110e0Safresh1}
2691f110e0Safresh1
2791f110e0Safresh1sub autoload_sub {
2891f110e0Safresh1    my $sub = shift;
2991f110e0Safresh1
30b39c5158Smillert    my $filename = AutoLoader::find_filename( $sub );
31b39c5158Smillert
32b39c5158Smillert    my $save = $@;
33b39c5158Smillert    local $!; # Do not munge the value.
34b39c5158Smillert    eval { local $SIG{__DIE__}; require $filename };
35b39c5158Smillert    if ($@) {
36b39c5158Smillert	if (substr($sub,-9) eq '::DESTROY') {
37b39c5158Smillert	    no strict 'refs';
38b39c5158Smillert	    *$sub = sub {};
39b39c5158Smillert	    $@ = undef;
40b39c5158Smillert	} elsif ($@ =~ /^Can't locate/) {
41b39c5158Smillert	    # The load might just have failed because the filename was too
42b39c5158Smillert	    # long for some old SVR3 systems which treat long names as errors.
43b39c5158Smillert	    # If we can successfully truncate a long name then it's worth a go.
44b39c5158Smillert	    # There is a slight risk that we could pick up the wrong file here
45b39c5158Smillert	    # but autosplit should have warned about that when splitting.
46b39c5158Smillert	    if ($filename =~ s/(\w{12,})\.al$/substr($1,0,11).".al"/e){
47b39c5158Smillert		eval { local $SIG{__DIE__}; require $filename };
48b39c5158Smillert	    }
49b39c5158Smillert	}
50b39c5158Smillert	if ($@){
51b39c5158Smillert	    $@ =~ s/ at .*\n//;
52b39c5158Smillert	    my $error = $@;
53b39c5158Smillert	    require Carp;
54b39c5158Smillert	    Carp::croak($error);
55b39c5158Smillert	}
56b39c5158Smillert    }
57b39c5158Smillert    $@ = $save;
5891f110e0Safresh1
5991f110e0Safresh1    return 1;
60b39c5158Smillert}
61b39c5158Smillert
62b39c5158Smillertsub find_filename {
63b39c5158Smillert    my $sub = shift;
64b39c5158Smillert    my $filename;
65b39c5158Smillert    # Braces used to preserve $1 et al.
66b39c5158Smillert    {
67b39c5158Smillert	# Try to find the autoloaded file from the package-qualified
68b39c5158Smillert	# name of the sub. e.g., if the sub needed is
69b39c5158Smillert	# Getopt::Long::GetOptions(), then $INC{Getopt/Long.pm} is
70b39c5158Smillert	# something like '/usr/lib/perl5/Getopt/Long.pm', and the
71b39c5158Smillert	# autoload file is '/usr/lib/perl5/auto/Getopt/Long/GetOptions.al'.
72b39c5158Smillert	#
73b39c5158Smillert	# However, if @INC is a relative path, this might not work.  If,
74b39c5158Smillert	# for example, @INC = ('lib'), then $INC{Getopt/Long.pm} is
75b39c5158Smillert	# 'lib/Getopt/Long.pm', and we want to require
76b39c5158Smillert	# 'auto/Getopt/Long/GetOptions.al' (without the leading 'lib').
77b39c5158Smillert	# In this case, we simple prepend the 'auto/' and let the
78b39c5158Smillert	# C<require> take care of the searching for us.
79b39c5158Smillert
80b39c5158Smillert	my ($pkg,$func) = ($sub =~ /(.*)::([^:]+)$/);
81b39c5158Smillert	$pkg =~ s#::#/#g;
82b39c5158Smillert	if (defined($filename = $INC{"$pkg.pm"})) {
83b39c5158Smillert	    if ($is_macos) {
84b39c5158Smillert		$pkg =~ tr#/#:#;
85b39c5158Smillert		$filename = undef
86b39c5158Smillert		  unless $filename =~ s#^(.*)$pkg\.pm\z#$1auto:$pkg:$func.al#s;
87b39c5158Smillert	    } else {
88b39c5158Smillert		$filename = undef
89b39c5158Smillert		  unless $filename =~ s#^(.*)$pkg\.pm\z#$1auto/$pkg/$func.al#s;
90b39c5158Smillert	    }
91b39c5158Smillert
92b39c5158Smillert	    # if the file exists, then make sure that it is a
93b39c5158Smillert	    # a fully anchored path (i.e either '/usr/lib/auto/foo/bar.al',
94b39c5158Smillert	    # or './lib/auto/foo/bar.al'.  This avoids C<require> searching
95b39c5158Smillert	    # (and failing) to find the 'lib/auto/foo/bar.al' because it
96b39c5158Smillert	    # looked for 'lib/lib/auto/foo/bar.al', given @INC = ('lib').
97b39c5158Smillert
98b39c5158Smillert	    if (defined $filename and -r $filename) {
99b39c5158Smillert		unless ($filename =~ m|^/|s) {
100b39c5158Smillert		    if ($is_dosish) {
101b39c5158Smillert			unless ($filename =~ m{^([a-z]:)?[\\/]}is) {
102b39c5158Smillert			    if ($^O ne 'NetWare') {
103b39c5158Smillert				$filename = "./$filename";
104b39c5158Smillert			    } else {
105b39c5158Smillert				$filename = "$filename";
106b39c5158Smillert			    }
107b39c5158Smillert			}
108b39c5158Smillert		    }
109b39c5158Smillert		    elsif ($is_epoc) {
110b39c5158Smillert			unless ($filename =~ m{^([a-z?]:)?[\\/]}is) {
111b39c5158Smillert			     $filename = "./$filename";
112b39c5158Smillert			}
113b39c5158Smillert		    }
114b39c5158Smillert		    elsif ($is_vms) {
115b39c5158Smillert			# XXX todo by VMSmiths
116b39c5158Smillert			$filename = "./$filename";
117b39c5158Smillert		    }
118b39c5158Smillert		    elsif (!$is_macos) {
119b39c5158Smillert			$filename = "./$filename";
120b39c5158Smillert		    }
121b39c5158Smillert		}
122b39c5158Smillert	    }
123b39c5158Smillert	    else {
124b39c5158Smillert		$filename = undef;
125b39c5158Smillert	    }
126b39c5158Smillert	}
127b39c5158Smillert	unless (defined $filename) {
128b39c5158Smillert	    # let C<require> do the searching
129b39c5158Smillert	    $filename = "auto/$sub.al";
130b39c5158Smillert	    $filename =~ s#::#/#g;
131b39c5158Smillert	}
132b39c5158Smillert    }
133b39c5158Smillert    return $filename;
134b39c5158Smillert}
135b39c5158Smillert
136b39c5158Smillertsub import {
137b39c5158Smillert    my $pkg = shift;
138b39c5158Smillert    my $callpkg = caller;
139b39c5158Smillert
140b39c5158Smillert    #
141b39c5158Smillert    # Export symbols, but not by accident of inheritance.
142b39c5158Smillert    #
143b39c5158Smillert
144b39c5158Smillert    if ($pkg eq 'AutoLoader') {
145b39c5158Smillert	if ( @_ and $_[0] =~ /^&?AUTOLOAD$/ ) {
146b39c5158Smillert	    no strict 'refs';
147b39c5158Smillert	    *{ $callpkg . '::AUTOLOAD' } = \&AUTOLOAD;
148b39c5158Smillert	}
149b39c5158Smillert    }
150b39c5158Smillert
151b39c5158Smillert    #
152b39c5158Smillert    # Try to find the autosplit index file.  Eg., if the call package
153b39c5158Smillert    # is POSIX, then $INC{POSIX.pm} is something like
154b39c5158Smillert    # '/usr/local/lib/perl5/POSIX.pm', and the autosplit index file is in
155b39c5158Smillert    # '/usr/local/lib/perl5/auto/POSIX/autosplit.ix', so we require that.
156b39c5158Smillert    #
157b39c5158Smillert    # However, if @INC is a relative path, this might not work.  If,
158b39c5158Smillert    # for example, @INC = ('lib'), then
159b39c5158Smillert    # $INC{POSIX.pm} is 'lib/POSIX.pm', and we want to require
160b39c5158Smillert    # 'auto/POSIX/autosplit.ix' (without the leading 'lib').
161b39c5158Smillert    #
162b39c5158Smillert
163b39c5158Smillert    (my $calldir = $callpkg) =~ s#::#/#g;
164b39c5158Smillert    my $path = $INC{$calldir . '.pm'};
165b39c5158Smillert    if (defined($path)) {
166b39c5158Smillert	# Try absolute path name, but only eval it if the
167b39c5158Smillert        # transformation from module path to autosplit.ix path
168b39c5158Smillert        # succeeded!
169b39c5158Smillert	my $replaced_okay;
170b39c5158Smillert	if ($is_macos) {
171b39c5158Smillert	    (my $malldir = $calldir) =~ tr#/#:#;
172b39c5158Smillert	    $replaced_okay = ($path =~ s#^(.*)$malldir\.pm\z#$1auto:$malldir:autosplit.ix#s);
173b39c5158Smillert	} else {
174b39c5158Smillert	    $replaced_okay = ($path =~ s#^(.*)$calldir\.pm\z#$1auto/$calldir/autosplit.ix#);
175b39c5158Smillert	}
176b39c5158Smillert
177b39c5158Smillert	eval { require $path; } if $replaced_okay;
178b39c5158Smillert	# If that failed, try relative path with normal @INC searching.
179b39c5158Smillert	if (!$replaced_okay or $@) {
180b39c5158Smillert	    $path ="auto/$calldir/autosplit.ix";
181b39c5158Smillert	    eval { require $path; };
182b39c5158Smillert	}
183b39c5158Smillert	if ($@) {
184b39c5158Smillert	    my $error = $@;
185b39c5158Smillert	    require Carp;
186b39c5158Smillert	    Carp::carp($error);
187b39c5158Smillert	}
188b39c5158Smillert    }
189b39c5158Smillert}
190b39c5158Smillert
191b39c5158Smillertsub unimport {
192b39c5158Smillert    my $callpkg = caller;
193b39c5158Smillert
194b39c5158Smillert    no strict 'refs';
195b39c5158Smillert
196b39c5158Smillert    for my $exported (qw( AUTOLOAD )) {
197b39c5158Smillert	my $symname = $callpkg . '::' . $exported;
198b39c5158Smillert	undef *{ $symname } if \&{ $symname } == \&{ $exported };
199b39c5158Smillert	*{ $symname } = \&{ $symname };
200b39c5158Smillert    }
201b39c5158Smillert}
202b39c5158Smillert
203b39c5158Smillert1;
204b39c5158Smillert
205b39c5158Smillert__END__
206b39c5158Smillert
207b39c5158Smillert=head1 NAME
208b39c5158Smillert
209b39c5158SmillertAutoLoader - load subroutines only on demand
210b39c5158Smillert
211b39c5158Smillert=head1 SYNOPSIS
212b39c5158Smillert
213b39c5158Smillert    package Foo;
214b39c5158Smillert    use AutoLoader 'AUTOLOAD';   # import the default AUTOLOAD subroutine
215b39c5158Smillert
216b39c5158Smillert    package Bar;
217b39c5158Smillert    use AutoLoader;              # don't import AUTOLOAD, define our own
218b39c5158Smillert    sub AUTOLOAD {
219b39c5158Smillert        ...
220b39c5158Smillert        $AutoLoader::AUTOLOAD = "...";
221b39c5158Smillert        goto &AutoLoader::AUTOLOAD;
222b39c5158Smillert    }
223b39c5158Smillert
224b39c5158Smillert=head1 DESCRIPTION
225b39c5158Smillert
226b39c5158SmillertThe B<AutoLoader> module works with the B<AutoSplit> module and the
227b39c5158SmillertC<__END__> token to defer the loading of some subroutines until they are
228b39c5158Smillertused rather than loading them all at once.
229b39c5158Smillert
230b39c5158SmillertTo use B<AutoLoader>, the author of a module has to place the
231b39c5158Smillertdefinitions of subroutines to be autoloaded after an C<__END__> token.
232b39c5158Smillert(See L<perldata>.)  The B<AutoSplit> module can then be run manually to
233b39c5158Smillertextract the definitions into individual files F<auto/funcname.al>.
234b39c5158Smillert
235b39c5158SmillertB<AutoLoader> implements an AUTOLOAD subroutine.  When an undefined
236b39c5158Smillertsubroutine in is called in a client module of B<AutoLoader>,
237b39c5158SmillertB<AutoLoader>'s AUTOLOAD subroutine attempts to locate the subroutine in a
238b39c5158Smillertfile with a name related to the location of the file from which the
239b39c5158Smillertclient module was read.  As an example, if F<POSIX.pm> is located in
240b39c5158SmillertF</usr/local/lib/perl5/POSIX.pm>, B<AutoLoader> will look for perl
241b39c5158Smillertsubroutines B<POSIX> in F</usr/local/lib/perl5/auto/POSIX/*.al>, where
242b39c5158Smillertthe C<.al> file has the same name as the subroutine, sans package.  If
243b39c5158Smillertsuch a file exists, AUTOLOAD will read and evaluate it,
244b39c5158Smillertthus (presumably) defining the needed subroutine.  AUTOLOAD will then
245b39c5158SmillertC<goto> the newly defined subroutine.
246b39c5158Smillert
247b39c5158SmillertOnce this process completes for a given function, it is defined, so
248b39c5158Smillertfuture calls to the subroutine will bypass the AUTOLOAD mechanism.
249b39c5158Smillert
250b39c5158Smillert=head2 Subroutine Stubs
251b39c5158Smillert
252b39c5158SmillertIn order for object method lookup and/or prototype checking to operate
253b39c5158Smillertcorrectly even when methods have not yet been defined it is necessary to
254b39c5158Smillert"forward declare" each subroutine (as in C<sub NAME;>).  See
255b39c5158SmillertL<perlsub/"SYNOPSIS">.  Such forward declaration creates "subroutine
256b39c5158Smillertstubs", which are place holders with no code.
257b39c5158Smillert
258b39c5158SmillertThe AutoSplit and B<AutoLoader> modules automate the creation of forward
259b39c5158Smillertdeclarations.  The AutoSplit module creates an 'index' file containing
260b39c5158Smillertforward declarations of all the AutoSplit subroutines.  When the
261b39c5158SmillertAutoLoader module is 'use'd it loads these declarations into its callers
262b39c5158Smillertpackage.
263b39c5158Smillert
264b39c5158SmillertBecause of this mechanism it is important that B<AutoLoader> is always
265b39c5158SmillertC<use>d and not C<require>d.
266b39c5158Smillert
267b39c5158Smillert=head2 Using B<AutoLoader>'s AUTOLOAD Subroutine
268b39c5158Smillert
269b39c5158SmillertIn order to use B<AutoLoader>'s AUTOLOAD subroutine you I<must>
270b39c5158Smillertexplicitly import it:
271b39c5158Smillert
272b39c5158Smillert    use AutoLoader 'AUTOLOAD';
273b39c5158Smillert
274b39c5158Smillert=head2 Overriding B<AutoLoader>'s AUTOLOAD Subroutine
275b39c5158Smillert
276b39c5158SmillertSome modules, mainly extensions, provide their own AUTOLOAD subroutines.
277b39c5158SmillertThey typically need to check for some special cases (such as constants)
278b39c5158Smillertand then fallback to B<AutoLoader>'s AUTOLOAD for the rest.
279b39c5158Smillert
280b39c5158SmillertSuch modules should I<not> import B<AutoLoader>'s AUTOLOAD subroutine.
281b39c5158SmillertInstead, they should define their own AUTOLOAD subroutines along these
282b39c5158Smillertlines:
283b39c5158Smillert
284b39c5158Smillert    use AutoLoader;
285b39c5158Smillert    use Carp;
286b39c5158Smillert
287b39c5158Smillert    sub AUTOLOAD {
288b39c5158Smillert        my $sub = $AUTOLOAD;
289b39c5158Smillert        (my $constname = $sub) =~ s/.*:://;
290b39c5158Smillert        my $val = constant($constname, @_ ? $_[0] : 0);
291b39c5158Smillert        if ($! != 0) {
292b39c5158Smillert            if ($! =~ /Invalid/ || $!{EINVAL}) {
293b39c5158Smillert                $AutoLoader::AUTOLOAD = $sub;
294b39c5158Smillert                goto &AutoLoader::AUTOLOAD;
295b39c5158Smillert            }
296b39c5158Smillert            else {
297b39c5158Smillert                croak "Your vendor has not defined constant $constname";
298b39c5158Smillert            }
299b39c5158Smillert        }
300b39c5158Smillert        *$sub = sub { $val }; # same as: eval "sub $sub { $val }";
301b39c5158Smillert        goto &$sub;
302b39c5158Smillert    }
303b39c5158Smillert
304b39c5158SmillertIf any module's own AUTOLOAD subroutine has no need to fallback to the
305b39c5158SmillertAutoLoader's AUTOLOAD subroutine (because it doesn't have any AutoSplit
306b39c5158Smillertsubroutines), then that module should not use B<AutoLoader> at all.
307b39c5158Smillert
308b39c5158Smillert=head2 Package Lexicals
309b39c5158Smillert
310b39c5158SmillertPackage lexicals declared with C<my> in the main block of a package
311b39c5158Smillertusing B<AutoLoader> will not be visible to auto-loaded subroutines, due to
312b39c5158Smillertthe fact that the given scope ends at the C<__END__> marker.  A module
313b39c5158Smillertusing such variables as package globals will not work properly under the
314b39c5158SmillertB<AutoLoader>.
315b39c5158Smillert
316b39c5158SmillertThe C<vars> pragma (see L<perlmod/"vars">) may be used in such
317b39c5158Smillertsituations as an alternative to explicitly qualifying all globals with
318b39c5158Smillertthe package namespace.  Variables pre-declared with this pragma will be
319b39c5158Smillertvisible to any autoloaded routines (but will not be invisible outside
320b39c5158Smillertthe package, unfortunately).
321b39c5158Smillert
322b39c5158Smillert=head2 Not Using AutoLoader
323b39c5158Smillert
324b39c5158SmillertYou can stop using AutoLoader by simply
325b39c5158Smillert
326b39c5158Smillert	no AutoLoader;
327b39c5158Smillert
328b39c5158Smillert=head2 B<AutoLoader> vs. B<SelfLoader>
329b39c5158Smillert
330b39c5158SmillertThe B<AutoLoader> is similar in purpose to B<SelfLoader>: both delay the
331b39c5158Smillertloading of subroutines.
332b39c5158Smillert
333b39c5158SmillertB<SelfLoader> uses the C<__DATA__> marker rather than C<__END__>.
334b39c5158SmillertWhile this avoids the use of a hierarchy of disk files and the
335b39c5158Smillertassociated open/close for each routine loaded, B<SelfLoader> suffers a
336b39c5158Smillertstartup speed disadvantage in the one-time parsing of the lines after
337b39c5158SmillertC<__DATA__>, after which routines are cached.  B<SelfLoader> can also
338b39c5158Smillerthandle multiple packages in a file.
339b39c5158Smillert
340b39c5158SmillertB<AutoLoader> only reads code as it is requested, and in many cases
341b39c5158Smillertshould be faster, but requires a mechanism like B<AutoSplit> be used to
342b39c5158Smillertcreate the individual files.  L<ExtUtils::MakeMaker> will invoke
343b39c5158SmillertB<AutoSplit> automatically if B<AutoLoader> is used in a module source
344b39c5158Smillertfile.
345b39c5158Smillert
34691f110e0Safresh1=head2 Forcing AutoLoader to Load a Function
34791f110e0Safresh1
34891f110e0Safresh1Sometimes, it can be necessary or useful to make sure that a certain
34991f110e0Safresh1function is fully loaded by AutoLoader. This is the case, for example,
35091f110e0Safresh1when you need to wrap a function to inject debugging code. It is also
35191f110e0Safresh1helpful to force early loading of code before forking to make use of
35291f110e0Safresh1copy-on-write as much as possible.
35391f110e0Safresh1
35491f110e0Safresh1Starting with AutoLoader 5.73, you can call the
35591f110e0Safresh1C<AutoLoader::autoload_sub> function with the fully-qualified name of
35691f110e0Safresh1the function to load from its F<.al> file. The behaviour is exactly
35791f110e0Safresh1the same as if you called the function, triggering the regular
35891f110e0Safresh1C<AUTOLOAD> mechanism, but it does not actually execute the
35991f110e0Safresh1autoloaded function.
36091f110e0Safresh1
361b39c5158Smillert=head1 CAVEATS
362b39c5158Smillert
363b39c5158SmillertAutoLoaders prior to Perl 5.002 had a slightly different interface.  Any
364b39c5158Smillertold modules which use B<AutoLoader> should be changed to the new calling
365b39c5158Smillertstyle.  Typically this just means changing a require to a use, adding
366b39c5158Smillertthe explicit C<'AUTOLOAD'> import if needed, and removing B<AutoLoader>
367b39c5158Smillertfrom C<@ISA>.
368b39c5158Smillert
369b39c5158SmillertOn systems with restrictions on file name length, the file corresponding
370b39c5158Smillertto a subroutine may have a shorter name that the routine itself.  This
371b39c5158Smillertcan lead to conflicting file names.  The I<AutoSplit> package warns of
372b39c5158Smillertthese potential conflicts when used to split a module.
373b39c5158Smillert
374b39c5158SmillertAutoLoader may fail to find the autosplit files (or even find the wrong
375b39c5158Smillertones) in cases where C<@INC> contains relative paths, B<and> the program
376b39c5158Smillertdoes C<chdir>.
377b39c5158Smillert
378b39c5158Smillert=head1 SEE ALSO
379b39c5158Smillert
380b39c5158SmillertL<SelfLoader> - an autoloader that doesn't use external files.
381b39c5158Smillert
382b39c5158Smillert=head1 AUTHOR
383b39c5158Smillert
384b39c5158SmillertC<AutoLoader> is maintained by the perl5-porters. Please direct
385b39c5158Smillertany questions to the canonical mailing list. Anything that
386b39c5158Smillertis applicable to the CPAN release can be sent to its maintainer,
387b39c5158Smillertthough.
388b39c5158Smillert
389b39c5158SmillertAuthor and Maintainer: The Perl5-Porters <perl5-porters@perl.org>
390b39c5158Smillert
391b39c5158SmillertMaintainer of the CPAN release: Steffen Mueller <smueller@cpan.org>
392b39c5158Smillert
393b39c5158Smillert=head1 COPYRIGHT AND LICENSE
394b39c5158Smillert
395b39c5158SmillertThis package has been part of the perl core since the first release
396b39c5158Smillertof perl5. It has been released separately to CPAN so older installations
397b39c5158Smillertcan benefit from bug fixes.
398b39c5158Smillert
399b39c5158SmillertThis package has the same copyright and license as the perl core:
400b39c5158Smillert
401b39c5158Smillert             Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999,
40291f110e0Safresh1        2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
403*6fb12b70Safresh1	2011, 2012, 2013
404b39c5158Smillert        by Larry Wall and others
405b39c5158Smillert
406b39c5158Smillert			    All rights reserved.
407b39c5158Smillert
408b39c5158Smillert    This program is free software; you can redistribute it and/or modify
409b39c5158Smillert    it under the terms of either:
410b39c5158Smillert
411b39c5158Smillert	a) the GNU General Public License as published by the Free
412b39c5158Smillert	Software Foundation; either version 1, or (at your option) any
413b39c5158Smillert	later version, or
414b39c5158Smillert
415b39c5158Smillert	b) the "Artistic License" which comes with this Kit.
416b39c5158Smillert
417b39c5158Smillert    This program is distributed in the hope that it will be useful,
418b39c5158Smillert    but WITHOUT ANY WARRANTY; without even the implied warranty of
419b39c5158Smillert    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See either
420b39c5158Smillert    the GNU General Public License or the Artistic License for more details.
421b39c5158Smillert
422b39c5158Smillert    You should have received a copy of the Artistic License with this
423b39c5158Smillert    Kit, in the file named "Artistic".  If not, I'll be glad to provide one.
424b39c5158Smillert
425b39c5158Smillert    You should also have received a copy of the GNU General Public License
426b39c5158Smillert    along with this program in the file named "Copying". If not, write to the
427898184e3Ssthen    Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
428898184e3Ssthen    MA 02110-1301, USA or visit their web page on the internet at
429b39c5158Smillert    http://www.gnu.org/copyleft/gpl.html.
430b39c5158Smillert
431b39c5158Smillert    For those of you that choose to use the GNU General Public License,
432b39c5158Smillert    my interpretation of the GNU General Public License is that no Perl
433b39c5158Smillert    script falls under the terms of the GPL unless you explicitly put
434b39c5158Smillert    said script under the terms of the GPL yourself.  Furthermore, any
435b39c5158Smillert    object code linked with perl does not automatically fall under the
436b39c5158Smillert    terms of the GPL, provided such object code only adds definitions
437b39c5158Smillert    of subroutines and variables, and does not otherwise impair the
438b39c5158Smillert    resulting interpreter from executing any standard Perl script.  I
439b39c5158Smillert    consider linking in C subroutines in this manner to be the moral
440b39c5158Smillert    equivalent of defining subroutines in the Perl language itself.  You
441b39c5158Smillert    may sell such an object file as proprietary provided that you provide
442b39c5158Smillert    or offer to provide the Perl source, as specified by the GNU General
443b39c5158Smillert    Public License.  (This is merely an alternate way of specifying input
444b39c5158Smillert    to the program.)  You may also sell a binary produced by the dumping of
445b39c5158Smillert    a running Perl script that belongs to you, provided that you provide or
446b39c5158Smillert    offer to provide the Perl source as specified by the GPL.  (The
447b39c5158Smillert    fact that a Perl interpreter and your code are in the same binary file
448b39c5158Smillert    is, in this case, a form of mere aggregation.)  This is my interpretation
449b39c5158Smillert    of the GPL.  If you still have concerns or difficulties understanding
450b39c5158Smillert    my intent, feel free to contact me.  Of course, the Artistic License
451b39c5158Smillert    spells all this out for your protection, so you may prefer to use that.
452b39c5158Smillert
453b39c5158Smillert=cut
454