<quote who="Hallvard B Furuseth">
I wrote:
Gavin Henry writes:
I've run Perl::Critic over this and fixed/updated to latest "Perl Best Practices". We might as well have an up to date sample.
Do you mind if I commit my changes?
My impression is that back-perl hovers on the verge of code rot, and any change is likely for the better.
Er... not this one, though:-( Our Perl version (5.8.8) interprets print <STDERR>, "Here in new\n"; as "read data from STDERR, then print that and the argument string to STDOUT". Is this some bleeding edge change to Perl?
Nope, you are right. My mistake. It does work, but should be:
print {*STDERR} "Here in new\n";
Example:
1 #!/usr/bin/perl 2 use strict; 3 use warnings; 4 5 print <STDERR>, "Here in new\n"; 6 print {*STDERR} "Here in new\n"; 7 print STDERR "Here in new\n";
Output:
Filehandle STDERR opened only for output at ./test.pl line 5. Here in new Here in new Here in new
See:
http://search.cpan.org/~thaljef/Perl-Critic-1.06/lib/Perl/Critic/Policy/Inpu...
Also I think the initial 'package' and 'use' statements should go below the comment at the top,
Sure, done.
and I'm not sure how new the "our" keyword is.
http://perldoc.perl.org/perl56delta.html#%22our%22-declarations
5.6
Also, see why it's used:
http://search.cpan.org/~thaljef/Perl-Critic-1.06/lib/Perl/Critic/Policy/Modu...
I suspect there are some pretty old Perl versions out there, in particular on Windows.
We should change it to:
$SampleLDAP::VERSION = '1.00';
That will work on any 5+ version of Perl.
I've made the changes ready for commit.
Gavin.
-- Hallvard