SPUG: How to deal with same name packages?

Andrew Sweger andrew at sweger.net
Mon Jan 14 17:46:08 CST 2002

Well, if there is, it's not obvious. There doesn't appear to be a package
name-space called 'Link' involved when using the LWP modules (nor any
other modules in my base systems). Can you show us your sequence of use
statements (all of them) that trigger problems and tell us what symptoms
caused you to believe the modules are clashing?

To answer the question on a way to deal with clashing names? Yes, there
is. It's the same answer my doctor gives me when I complain about the pain
of certain knee motions: don't do it.

Tools to help track problems down:


perl -MLWP -MData::Dumper -e 'print Dumper \%INC'

will give a quick list of what modules are loaded. More information can be
found in perldoc Data::Dumper. Not very deep, but handy. Even more useful
when combined with the following,

The Perl Debugger

The 'V' command can be used to see what package variables are available in
any particular name space.

perl -d somescript
  DB<1> V packagename

You can read (and read, and read) about the Perl debugger in perldoc
perldebug. Taking the time to learn and use the Perl debugger will pay
dividends. There are a few front-ends for the Perl debugger that can make
it a little sweeter to use, but please consider learning the real thing.
Sprinkling print statements throughout a script will only take you so far
when tracking down a problem, *especially* when dealing with "3rd party"
modules. Being able to step into things like LWP and DBI has helped nail
some of the more freaky problems in my life. Well, that and a good length
of sucker rod for when you find the offending party. :)

To all of you _still_ using debugging print statements, I urge you to give
the Perl debugger a try. I will never go back to print statements. If you
tried the Perl debugger and went back to print statements, speak up. I'd
be curious to know what problems folks ran into (reasons other than not
actually learning how to use the debugger). I already realize that
learning the Perl debugger is hard work. It is worth it!

I shouldn't say any more for fear I'll be recruited for a SPUG session on
the Perl debugger.

On Mon, 14 Jan 2002, c k wrote:

> Is there a way to deal with same name packages/modules/classes/objects
> in perl?

Andrew B. Sweger -- The great thing about multitasking is that several
                                things can go wrong at once.

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/

More information about the spug-list mailing list