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":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.