Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Writing for backwards compatibility

by etcshadow (Priest)
on Nov 09, 2005 at 03:20 UTC ( #506973=note: print w/ replies, xml ) Need Help??


in reply to Writing for backwards compatibility

Speaking as someone who is (at least currently) tethered to 5.005_03, I've got to speak up for how utterly annoying it is to find modules out there that needlessly use fairly pointless new features (specifically our, but also, to a certain extent use/no warnings).

Don't get me wrong, lexical filehandles and 3-arg open are hugely nice, and I can't really argue with that. But how many modules out there just use our for no reason whatsoever, other than to force perl 5.5ers to have to edit the module before using it?

------------ :Wq Not an editor command: Wq


Comment on Re: Writing for backwards compatibility
Select or Download Code
Re^2: Writing for backwards compatibility
by mirod (Canon) on Nov 09, 2005 at 09:33 UTC

    When that happens, do you report test failures (using cpantest, provided by Test::Reporter)? If you do, I am pretty sure most authors will gladdly fix the code. Especially if you also include the patch. I am sure most authors do not willingly break compatibility, it just happens, sometimes for good reasons (unicode), sometimes just by habit or oversight.

Re^2: Writing for backwards compatibility
by xdg (Monsignor) on Nov 09, 2005 at 11:51 UTC

    I think 'our' is often used to avoid having to type 'use vars', but I recently saw a module on CPAN with a surprisingly obvious way of avoiding it. (strict police may want to avoid reading further.)

    package My::Module; $VERSION = 1.23; @ISA = 'Exporter'; @EXPORT = qw( wibble wobble ); use strict; use warnings; use Exporter; # rest of module ...

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

      Also, the third edition of Programming Perl describes the vars pragma as "somewhat deprecated". Current Perl docs don't label it that way...

      --
      Marvin Humphrey
      Rectangular Research ― http://www.rectangular.com
Re^2: Writing for backwards compatibility
by adrianh (Chancellor) on Nov 09, 2005 at 12:25 UTC
    But how many modules out there just use our for no reason whatsoever, other than to force perl 5.5ers to have to edit the module before using it?

    I don't use our for no reason. I use it because I find it clearer and I have to type less.

    Unfortunately my priorities (typing less) do not match your priorities (working code on 5.005_3) :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://506973]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2014-09-20 01:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (151 votes), past polls