subs::auto

Read barewords as subroutine names.
Download

subs::auto Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Vincent Pit
  • Publisher web site:
  • http://search.cpan.org/~vpit/

subs::auto Tags


subs::auto Description

Read barewords as subroutine names. subs::auto is a Perl module that can be used to read barewords as subroutine names.SYNOPSIS { use subs::auto; foo; # Compile to "foo()" instead of "'foo'" # or croaking on strict subs foo $x; # Compile to "foo($x)" instead of "$x->foo" foo 1; # Compile to "foo(1)" instead of croaking foo 1, 2; # Compile to "foo(1, 2)" instead of croaking foo(@a); # Still ok foo->meth; # "'foo'->meth" if you have use'd foo somewhere, # or "foo()->meth" otherwise print foo 'wut'; # print to the filehandle foo if it's actually one, # or "print(foo('wut'))" otherwise } # ... but function calls will fail at run-time if you don't # actually define foo somewhere foo; # BANGThis pragma lexically enables the parsing of any bareword as a subroutine name, except those which corresponds to an entry in %INC (expected to be class names) or whose symbol table entry has a IO slot (expected to be filehandles).You can pass options to import as key / value pairs : * in => $pkg Specifies on which package the pragma should act. Setting $pkg to Some::Package allows you to resolve all functions name of the type Some::Package::func ... in the current scope. You can use the pragma several times with different package names to allow resolution of all the corresponding barewords. Defaults to the current package.This module is not a source filter. Requirements: · Perl


subs::auto Related Software