| Author |
need help with use pragma
|
|
| soup_or_power@yahoo.com 2005-05-24, 8:56 pm |
| Can someone please explain what the use :all pragma does? A simple URL
will also do.
Thank you
| |
| Sherm Pendley 2005-05-24, 8:56 pm |
| soup_or_power@yahoo.com wrote:
> Can someone please explain what the use :all pragma does? A simple URL
> will also do.
Have a look at "perldoc Exporter".
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
| |
| Anno Siegel 2005-05-25, 8:56 am |
| Sherm Pendley <spamtrap@dot-app.org> wrote in comp.lang.perl.misc:
> soup_or_power@yahoo.com wrote:
>
>
> Have a look at "perldoc Exporter".
Oh... good guess. The question had me seriously puzzled.
However, as you know but the OP seems not to, ":all" isn't a pragma in
this case, but an argument for the exporting module's ->import method.
Not everything in lower case that can follow "use" is a pragma, only
if it's the first thing.
Anno
| |
| soup_or_power@yahoo.com 2005-05-25, 3:56 pm |
| I checked the perldoc Exporter. It doesn't say anything about "use
:all". Does it mean all of the symbols in a module or symbols beginning
with all?
Thanks for your help.
| |
| phaylon 2005-05-25, 3:56 pm |
| soup_or_power wrote:
> I checked the perldoc Exporter. It doesn't say anything about "use
> :all". Does it mean all of the symbols in a module or symbols beginning
> with all?
Do you have some more code? "perldoc use" says that "use" can take a
Modulename or a Version-String as argument, but not a plain :all. That
would be new to me. :all is often used by modules to tell their
import-method that we want to have "all" stuff they've got to export. But
that's a design decision for the author.
So, have you anywhere a "use :all" in use? If so, are strict and warnings
turned on? As said, examples would help to make things clear.
--
http://www.dunkelheit.at/
codito, ergo sum.
| |
| Sherm Pendley 2005-05-25, 3:56 pm |
| soup_or_power@yahoo.com wrote:
> I checked the perldoc Exporter. It doesn't say anything about "use
> :all". Does it mean all of the symbols in a module or symbols beginning
> with all?
That's because "use :all" isn't Perl. ":all" is not a pragma or module -
it can't be use()d by itself.
What you're probably thinking of is "use CGI qw(:all);" - which *is*
explained in Exporter - check the "Specialised Import Lists" section.
The use of ":all" in this context simply means to import the list named
"all". Module authors define their own import lists; one module might
define a list named "all" as exactly that, every symbol. Another might
define it as every symbol except for a few the module author thought
were advanced, dangerous, or otherwise exceptional for some reason.
The import lists that are defined by a particular module should be shown
in that module's documentation.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
|
|
|
|