On Tue, Oct 28, 2003 at 12:14:05PM -0600, Dan Muey wrote:
> Hmm ok, what would be nice is to do something like this:
> (I have a function that returns true if the perl version is the same or
> higher than the specified number)
>
> package Monkey;
>
> use strict;
>
> if(gotperlv(5.6)) {
> our $bar
> our $foo;
> } else {
> use vars qw($bar $foo);
> }
>
> Except the ours would only apply to that black and wouldn't do too
> much good if I'm understanding this right. And also would it not always
> do the use vars since it gets done in the BEGIN black ?
Yep -- you're right on both counts. If you want to support older
versions of perl ($] < 5.006) you just have to "use vars" and forget
about "our".
If you don't care about older perls (and 5.005_03 is getting kind
of mouldy) then do something like
use 5.006;
use base qw(Exporter);
our @EXPORT = qw(...);
--
Steve
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]