need help with use pragma

S

soup_or_power

Can someone please explain what the use :all pragma does? A simple URL
will also do.

Thank you
 
A

Anno Siegel

Sherm Pendley said:
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
 
S

soup_or_power

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.
 
P

phaylon

soup_or_power said:
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.
 
S

Sherm Pendley

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--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top