OK, now I know the answer is almost always "No!", but I'm at the end of my tether, and short of diving down into C code, I can't take it any further.
I'm using perl, v5.8.0 built for i386-linux-thread-multi.
Essentially it seems that UNIVERSAL::isa, my favourite swiss army knife function, is behaving weirdly. Here is the most simple example I can boil it down to.
Loading DB routines from perl5db.pl version 1.19
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
main::(-e:1): 1
DB<1> $Foo::VERSION = 1;
DB<2> sub Foo::new { bless {}, shift }
DB<3> x UNIVERSAL::isa( 'Foo', 'UNIVERSAL' );
0 1
DB<4> x UNIVERSAL::isa( 'Foo', 'UNIVERSAL' );
0 1
DB<5> x UNIVERSAL::isa( 'Foo', 'UNIVERSAL' );
0 1
DB<6> @Foo::ISA = ();
DB<7> x UNIVERSAL::isa( 'Foo', 'UNIVERSAL' );
0 1
DB<8> x UNIVERSAL::isa( 'Foo', 'UNIVERSAL' );
0 ''
DB<9> x UNIVERSAL::isa( 'Foo', 'UNIVERSAL' );
0 ''
DB<10>
The particular problem
I have with this situation is that, if your class doesn't have an @ISA, lots of things ( overload and Carp::croak for example), accidentally set @SomeClass::ISA to (), when doing things like this
Example from overload::mycan
foreach $p (@{$package . "::ISA"}) {
This breaks my usual "is this an object of some sort" test of
UNIVERSAL::isa( ref $Object, 'UNIVERSAL' ).
What do you all think?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.