Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • It does seem odd to me... this looks like a good learning opportunity, so I'll bite. Under which circumstances is this useful? Things that come to mind are:

    1) Differentiation of namespaces within a program?

    2) Private class/object definition/functions w/ no chance of re-use by other code?

    3) Other motives?

    • In this case, SOAP::Lite requires a class name to dispatch to. So rather than writing a whole module that will only be used by this one call -- or worse, providing SOAP access to everything in the program -- I just add a package in the middle of my program, with only the symbols for SOAP in it.

      There are many other reasons, too. I don't have time now, perhaps others can mention some.
      • As much of a style Nazi as I am about Perl, having multiple packages in a file is perfectly legimate if the packages are related. Many DBD modules do this. SOAP::Lite does this. When dealing with XML::Parser, you often need to define your own package for callbacks. It's convenient and often sensible. Packages are simply namespaces. They cost nothing to use. Would you rather have one big bookcase or several smaller ones? Depends on your dwelling.