develooper Front page | perl.perl5.porters | Postings from February 2009

Bug in 'require Some::Package'?

Thread Next
From:
Ovid
Date:
February 15, 2009 15:11
Subject:
Bug in 'require Some::Package'?
Message ID:
747976.29255.qm@web65707.mail.ac4.yahoo.com
I *think* this is a bug, but I'm unsure of what's going on here:

  #!/usr/bin/perl -l
 
  print $::{'Foo::'} || 'Not found';
  eval "use Foo";
  print $::{'Foo::'} || 'Not found';
  eval "require Foo";
  print $::{'Foo::'} || 'Not found';

 
That prints:

  Not found
  Not found
  *main::Foo::

In short, I'm getting a symbol table entry with a string eval of "require Foo" and not for "use Foo".

I would expect (hope?) for no symbol table entry at all.  I'm trying to auto-generate inheritance diagrams and this is causing false positives.  Is there some way of detecting that this package isn't really there?

  $ perl -v

  This is perl, v5.8.8 built for darwin-2level

Cheers,
Ovid
--
Buy the book         - http://www.oreilly.com/catalog/perlhks/
Tech blog            - http://use.perl.org/~Ovid/journal/
Twitter              - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6


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