How can I define global functions in Perl5?
Here is example code to use Path::Class' file() function everywhere.
use Path::Class; use Carp (); sub UNIVERSAL::AUTOLOAD { if ($UNIVERSAL::AUTOLOAD =~ /::file\z/) { return Path::Class::file(@_); } Carp::croak("Undefined subroutine &$UNIVERSAL::AUTOLOAD called"); } sub UNIVERSAL::DESTROY { }