in reply to Re: Writing for backwards compatibility
in thread Writing for backwards compatibility

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.

Replies are listed 'Best First'.
Re^3: Writing for backwards compatibility
by creamygoodness (Curate) on Nov 09, 2005 at 18:21 UTC

    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