Brutha has asked for the wisdom of the Perl Monks concerning the following question:
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?
File Baseclass.pm
File Subclass1.pmpackage Baseclass; use strict; use subclass1; print "load Baseclass\n"; sub new { my $class = shift; return bless {},$class; } 1;
File Bla.plpackage Subclass1; use strict; use warnings; use base( "Baseclass" ); sub new { my $class = shift; return $self = $class->SUPER::new(@_); } print "load Subclass1\n"; 1;
Now run perl bla.pl and you get the following output:use strict; use warnings; use Subclass1; my $obj = Subclass1->new; 1;
Now, here comes the solution.Load Subclass1 load Baseclass Subroutine new redefined at Subclass1.pm line 11. Load Subclass1
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)