in reply to Re:(2501- further clarification) Implementing strict on shoddy code
in thread Implementing strict on shoddy code

In attempts in learning to use strict, I came across an odd phenominon that may help in this situation. I have a controlling file using many different requires as the situation demands. Adding use strict to one of the requires returned the usual strict errors for the file required, but not for the controller or any other files required. This occured using ActivePerl Build 618 (Perl 5.6) running on a Win2K box. Using this, so long as one's software is broken down into manageable subroutines, as needed each one can be moved into a file with use strict and required. The subroutine can then be made strict, leaving the rest still in it's original state. To test this, I used the following code :
Controller -- #!perl $x = 5; print "Before Require $x\n"; require('e:/perltest/require.cgi'); &MoreTest; sub MoreTest { $y = 6; print "After Require $x, $y\n"; &TestPrint(); print "After TestPrint $x, $y, $z"; } REQUIRE -- #!perl use strict; print "In Require\n"; sub TestPrint { my $z = 10; # print "$x $y "; print "$z\n"; } 1;
If you uncomment the print statement in TestPrint in the require, you will get the strict errors, while the in the controller, you see the vars $w and $z are not defined yet still recieve no errors. I hope this information helps Dave
  • Comment on Re: Re:(2501- further clarification) Implementing strict on shoddy code
  • Download Code