Update code sample to account for 'use strict', avoiding:
Global symbol "$AUTOLOAD" requires explicit package name
Committer: Improve example so as to:
Use our now-standard 4-space indents in code samples; correct call to
'who' so that it produces same output on Linux and FreeBSD.
C<system> with those arguments. All you'd do is:
sub AUTOLOAD {
- my $program = $AUTOLOAD;
- $program =~ s/.*:://;
- system($program, @_);
+ our $AUTOLOAD; # keep 'use strict' happy
+ my $program = $AUTOLOAD;
+ $program =~ s/.*:://;
+ system($program, @_);
}
date();
- who('am', 'i');
+ who();
ls('-l');
In fact, if you predeclare functions you want to call that way, you don't
use subs qw(date who ls);
date;
- who "am", "i";
+ who;
ls '-l';
A more complete example of this is the Shell module on CPAN, which