]> git.vpit.fr Git - perl/modules/subs-auto.git/blob - README
Document opening of global filehandles in pragma scope
[perl/modules/subs-auto.git] / README
1 NAME
2     subs::auto - Read barewords as subroutine names.
3
4 VERSION
5     Version 0.01
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 "foo()->print('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 a IO slot
29     (expected to be filehandles).
30
31 EXPORT
32     None.
33
34 CAVEATS
35     "*{'::foo'}{CODE}" will appear as defined in a scope where the pragma is
36     enabled, "foo" is used as a bareword, but is never actually defined
37     afterwards. This may or may not be considered as Doing The Right Thing.
38     However, "*{'::foo'}{CODE}" will always return the right value if you
39     fetch it outside the pragma's scope. Actually, you can make it return
40     the right value even in the pragma's scope by reading "*{'::foo'}{CODE}"
41     outside (or by actually defining "foo", which is ultimately why you use
42     this pragma, right ?).
43
44 DEPENDENCIES
45     perl 5.10.0.
46
47     Carp (standard since perl 5), Symbol (since 5.002).
48
49     Variable::Magic with "uvar" magic enabled (this should be assured by the
50     required perl version).
51
52 AUTHOR
53     Vincent Pit, "<perl at profvince.com>", <http://www.profvince.com>.
54
55     You can contact me by mail or on #perl @ FreeNode (vincent or
56     Prof_Vince).
57
58 BUGS
59     Please report any bugs or feature requests to "bug-subs-auto at
60     rt.cpan.org", or through the web interface at
61     <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=subs-auto>. I will be
62     notified, and then you'll automatically be notified of progress on your
63     bug as I make changes.
64
65 SUPPORT
66     You can find documentation for this module with the perldoc command.
67
68         perldoc subs::auto
69
70     Tests code coverage report is available at
71     <http://www.profvince.com/perl/cover/subs-auto>.
72
73 ACKNOWLEDGEMENTS
74     Thanks to Sebastien Aperghis-Tramoni for helping to name this pragma.
75
76 COPYRIGHT & LICENSE
77     Copyright 2008 Vincent Pit, all rights reserved.
78
79     This program is free software; you can redistribute it and/or modify it
80     under the same terms as Perl itself.
81