]> git.vpit.fr Git - perl/modules/subs-auto.git/blob - README
Update VPIT::TestHelpers to 15e8aee3
[perl/modules/subs-auto.git] / README
1 NAME
2     subs::auto - Read barewords as subroutine names.
3
4 VERSION
5     Version 0.08
6
7 SYNOPSIS
8         {
9          use subs::auto;
10          foo;             # Compile to "foo()"     instead of "'foo'"
11                           #                        or croaking on strict subs
12          foo $x;          # Compile to "foo($x)"   instead of "$x->foo"
13          foo 1;           # Compile to "foo(1)"    instead of croaking
14          foo 1, 2;        # Compile to "foo(1, 2)" instead of croaking
15          foo(@a);         # Still ok
16          foo->meth;       # "'foo'->meth" if you have use'd foo somewhere,
17                           #  or "foo()->meth" otherwise
18          print foo 'wut'; # print to the filehandle foo if it's actually one,
19                           #  or "print(foo('wut'))" otherwise
20         } # ... but function calls will fail at run-time if you don't
21           # actually define foo somewhere
22
23         foo; # BANG
24
25 DESCRIPTION
26     This pragma lexically enables the parsing of any bareword as a
27     subroutine name, except those which corresponds to an entry in %INC
28     (expected to be class names) or whose symbol table entry has an IO slot
29     (expected to be filehandles).
30
31     You can pass options to "import" as key / value pairs :
32
33     *   "in => $pkg"
34
35         Specifies on which package the pragma should act. Setting $pkg to
36         "Some::Package" allows you to resolve all functions name of the type
37         "Some::Package::func ..." in the current scope. You can use the
38         pragma several times with different package names to allow
39         resolution of all the corresponding barewords.
40
41         Defaults to the current package.
42
43     This module is not a source filter.
44
45 EXPORT
46     None.
47
48 CAVEATS
49     "*{'::foo'}{CODE}" will appear as defined in a scope where the pragma is
50     enabled, "foo" is used as a bareword, but is never actually defined
51     afterwards. This may or may not be considered as Doing The Right Thing.
52     However, "*{'::foo'}{CODE}" will always return the right value if you
53     fetch it outside the pragma's scope. Actually, you can make it return
54     the right value even in the pragma's scope by reading "*{'::foo'}{CODE}"
55     outside (or by actually defining "foo", which is ultimately why you use
56     this pragma, right ?).
57
58     You have to open global filehandles outside of the scope of this pragma
59     if you want them not to be treated as function calls. Or just use
60     lexical filehandles and default ones as you should be.
61
62     This pragma doesn't propagate into "eval STRING".
63
64 DEPENDENCIES
65     perl 5.10.0.
66
67     A C compiler. This module may happen to build with a C++ compiler as
68     well, but don't rely on it, as no guarantee is made in this regard.
69
70     Variable::Magic with "uvar" magic enabled (this should be assured by the
71     required perl version).
72
73     B::Keywords.
74
75     Carp (standard since perl 5), XSLoader (since 5.6.0).
76
77 AUTHOR
78     Vincent Pit, "<perl at profvince.com>", <http://www.profvince.com>.
79
80     You can contact me by mail or on "irc.perl.org" (vincent).
81
82 BUGS
83     Please report any bugs or feature requests to "bug-subs-auto at
84     rt.cpan.org", or through the web interface at
85     <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=subs-auto>. I will be
86     notified, and then you'll automatically be notified of progress on your
87     bug as I make changes.
88
89 SUPPORT
90     You can find documentation for this module with the perldoc command.
91
92         perldoc subs::auto
93
94     Tests code coverage report is available at
95     <http://www.profvince.com/perl/cover/subs-auto>.
96
97 ACKNOWLEDGEMENTS
98     Thanks to Sebastien Aperghis-Tramoni for helping to name this pragma.
99
100 COPYRIGHT & LICENSE
101     Copyright 2008,2009,2010,2011,2013 Vincent Pit, all rights reserved.
102
103     This program is free software; you can redistribute it and/or modify it
104     under the same terms as Perl itself.
105