Being new to Eclipse (not perl) I'm seeing 730 warnings from my .pm files. EPIC seems to test them like so:
perl -w -c Foo.pm
But isn't this more appropriate for modules?
perl -w -c -MFoo -e ''
For example, I created this in a new project in a new workspace as Redefined.pm:
packageRedefined;# Here is a real warning:my$var=1;my$var=2;subfoo{print"This is Redefined::foo\n";}useconstantFOO=>1;packageRedefined::Sub;usebaseqw(Redefined);subfoo{print"This is Redefined::Sub::foo\n";}1;
With
perl -w -c -MRedefined -e ''
, I get:
"my" variable $var masks earlier declaration in same scope at Redefined.pm line 5.
which expect. However with
perl -w -c Redefined.pm
, I get:
"my" variable $var masks earlier declaration in same scope at Redefined.pm line 5.
"my" variable $var masks earlier declaration in same scope at Redefined.pm line 5.
Subroutine foo redefined at Redefined.pm line 7.
Constant subroutine Redefined::FOO redefined at /usr/share/perl/5.10/constant.pm line 115.
Subroutine foo redefined at Redefined.pm line 16.
Redefined.pm syntax OK
Are these warnings valid in your opinion? I'd like not to be forced to have many tiny .pm files - one for each class. Many of them are *tiny*. Is there any way for me to avoid these warnings so I can see other warnings?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think the warnings are valid. "use base" seems to assume that the base class is in a different file - it is equivalent to BEGIN { require Redefined; @ISA = qw(Redefined); }, which will produce the same double warning at "require". A workaround would be to simply assign @ISA = qw(Redefined).
Your proposed way of syntax checking sounds unreliable because it is not clear which package name should appear after -M if the target .pm file contained n different packages. I'm also not sure whether it would catch all warnings, though I don't have a counterexample.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
ok, sorry.. jploski was faster, and I'll agree to what he wrote. Use "use base" only if you put your modules in seperate files. otherwise use @ISA = qw(…)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Being new to Eclipse (not perl) I'm seeing 730 warnings from my .pm files. EPIC seems to test them like so:
But isn't this more appropriate for modules?
For example, I created this in a new project in a new workspace as Redefined.pm:
With
, I get:
which expect. However with
, I get:
Are these warnings valid in your opinion? I'd like not to be forced to have many tiny .pm files - one for each class. Many of them are *tiny*. Is there any way for me to avoid these warnings so I can see other warnings?
I think the warnings are valid. "use base" seems to assume that the base class is in a different file - it is equivalent to BEGIN { require Redefined; @ISA = qw(Redefined); }, which will produce the same double warning at "require". A workaround would be to simply assign @ISA = qw(Redefined).
Your proposed way of syntax checking sounds unreliable because it is not clear which package name should appear after -M if the target .pm file contained n different packages. I'm also not sure whether it would catch all warnings, though I don't have a counterexample.
You don't get this error if you code it like that. is this a perl bug?
package Redefined::Base;
… your base code
package Redefined::Sub;
.. your subclass code
1:
ok, sorry.. jploski was faster, and I'll agree to what he wrote. Use "use base" only if you put your modules in seperate files. otherwise use @ISA = qw(…)