[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: commit: ldap/servers/slapd/back-perl SampleLDAP.pm

<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";


  1 #!/usr/bin/perl
  2 use strict;
  3 use warnings;
  5 print <STDERR>, "Here in new\n";
  6 print {*STDERR} "Here in new\n";
  7 print STDERR "Here in new\n";


Filehandle STDERR opened only for output at ./test.pl line 5.
Here in new
Here in new
Here in new



> 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.



Also, see why it's used:


> 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.


> --
> Hallvard