Here's a _very_ rough first cut at perl_reference.pod. I haven't even proof-read it yet so it's probably got spelling a and grammar errors but I just want to be sure I'm going in the right direction.
Thanks Brian. A few comments:
[...]
- #!/usr/bin/perl -w
+ #!/usr/bin/perl
use strict;
+ use warnings;
But that won't work with perl < 5.6.
[...]
+The simplest of the workarounds is to use package-scoped variables,
+declared using C<our> or, on older versions of Perl, the C<vars>
+pragma. Note that whereas using C<my> declaration also implicitly
+initializes variables to undefined the C<our> declaration does not,
+and so you may need to add explicit initialisation.
multirun1.pl
- -----------
- #!/usr/bin/perl -w
+ ------------
+ #!/usr/bin/perl
use strict;
- use vars qw($counter);
- + use warnings; +
for (1..3){
print "run: [time $_]\n";
run();
@@ -946,7 +953,7 @@
sub run {
- $counter = 0;
+ our $counter = 0;
I think it would be more clear if all are declared at the top of the file, just where the 'use vars' declaration was.
[...]
multirun2.pl
- -----------
+ ------------
#!/usr/bin/perl -w
use strict;
@@ -993,14 +1023,14 @@
sub run {
- $main::counter = 0;
+ $::counter = 0;
what's the gain in doing this? The two are identical and for unexperienced perl users $::counter will look totally alien.
The rest looks good, sans spelling ;)
__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
-- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html