develooper Front page | perl.perl5.porters | Postings from November 2011

Re: [perl #104506] BUG or RFE: use manpage is misleading; enhance 'use' to fix preferable

Thread Previous | Thread Next
From:
Linda Walsh
Date:
November 27, 2011 07:49
Subject:
Re: [perl #104506] BUG or RFE: use manpage is misleading; enhance 'use' to fix preferable
Message ID:
4ED25BDB.2040602@tlinx.org
Father Chrysostomos via RT wrote::

>>
>>       "use" checks object's 'define' already being in memory.
> 
> But what does that mean exactly? That the package exists? Checking
> whether a package exists is not reliable, as simply mentioning it in
> compiled code will cause it to pop into existence:

----
	In the case I refer to, I'm referring to whether or not
the "package CLASSNAME"; has occurred, minimally, and ideally, if
it has anything in it's namespace that might be a callable.

	Does it have any defined methods (subs/code) already
loaded?  That would likely be the most thorough. But you could
simply check if CLASSNAME::Version was defined (had a value).  Then
you'd know some 'Version' of the CLASSNAME had been loaded into memory.
That might be the easiest check.

	The important part here, is that "use" with a var have the
semantics of checking for existence (by some method TBD (above?)),
and not have it call "require BAREWORD" where BAREWORD is the CLASSNAME
if the TBD test is true.

	Having Version defined w/o code might be a sufficiently 'corner'
case as to not warrant concern; I would lean toward believing that
at this point, but maybe both Version and method existence would be
more thorough.   What do you think, Father?  ;-)


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About