Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
yes, this is a nasty one indeed. as we all know, Perl is case sensitive, but the Windows filesystem not. what happens here is that Perl stores information about the modules it has loaded in its %INC hash, and it ends up having two entries for Subclass1. if you add these lines at the end of the bla.pl script:
use Data::Dumper; print Dumper(\%INC);
you'll see something like:
$VAR1 = { [...] 'subclass1.pm' => 'subclass1.pm', [...] 'Subclass1.pm' => 'Subclass1.pm', [...] };
so, the file is one but Perl sees (and loads) two modules. this could also pose serious problems with imported symbols, because when the case of the package name doesn't match, Perl loads the .pm file but doesn't export anything, as in:
use fIlE::SpEc qw(catfile); # note the wrong case $x = File::Spec->catfile('a', 'b', 'c'); # this works $x = catfile('a', 'b', 'c'); # this croaks
this is even more unobvious, because the error goes unnoticed until you try to use something that's exported from the module.

unfortunately, Perl can't possibly catch this sort of errors, so you have to watch your case. one possible solution (for the typo-prone individuals :-) could be to always cut & paste the use line from the SYNOPSIS found in the module documentation.

cheers,
Aldo

King of Laziness, Wizard of Impatience, Lord of Hubris


In reply to Re: Windows pitfall: Subroutine redefined with use Modul by dada
in thread Windows pitfall: Subroutine redefined with use Modul by Brutha

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (2)
As of 2022-05-18 18:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (71 votes). Check out past polls.

    Notices?