Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hello fellows,

this is not a question, but a warning about an issue, which cost me a day. This is a Windows specific problem. Is that hint enough to solve the following?

After boiling down the needle-in-haystack problem and dropping all but the necessary lines, I have the following three files:

File Baseclass.pm

package Baseclass; use strict; use subclass1; print "load Baseclass\n"; sub new { my $class = shift; return bless {},$class; } 1;
File Subclass1.pm

package Subclass1; use strict; use warnings; use base( "Baseclass" ); sub new { my $class = shift; return $self = $class->SUPER::new(@_); } print "load Subclass1\n"; 1;
File Bla.pl

use strict; use warnings; use Subclass1; my $obj = Subclass1->new; 1;
Now run perl bla.pl and you get the following output:
Load Subclass1 load Baseclass Subroutine new redefined at Subclass1.pm line 11. Load Subclass1
Now, here comes the solution.

It is simple but not really obvious in the sense of visible. It is the letter 's' or should I say 'S'?
In file Baseclass.pm line 3 uses 'subclass1' instead of 'Subclass1' with capital letter. Perl sees two modules use Subclass1; and use subclass1;. Windows does not care about case and gives Perl the file Subclass1.pm both times.

Hope this helps somebody, save your day for better things.

And it came to pass that in time the Great God Om spake unto Brutha, the Chosen One: "Psst!"
(Terry Pratchett, Small Gods)


In reply to 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 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?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-19 20:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found