System::Sub::AutoLoad - Auto-wrap external commands as DWIM subs
Any unknown sub will become a
use System::Sub::AutoLoad; my $hostname = hostname();
Allows to avoid using parentheses.
System::Sub import stays lazy.
use System::Sub::AutoLoad qw(hostname); my $hostname = hostname;
Options definitions will be checked lazily at the first call to the AUTOLOAD for that sub.
use System::Sub::AutoLoad hostname => [ 0 => '/bin/hostname' ]; my $hostname = hostname;
To avoid using parentheses after the sub name, you usually have to predeclare the sub with either a forward declaration (a sub without body such as
sub foo;) or with the
subs module. With
Sytem::Sub::AutoLoad you can simply list the subs names on the
use line and that will be done for you.
Copyright © 2012 Olivier Mengué.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl 5 itself.