From: Robert Hicks on
This is just a "like to know" question.

Does:

use feature "switch";

incur anything more or less than:

use feature ":5.10"; # which gives you switch and everything
else

Is it good practice just to pull in what you want with the first one?

Bob












From: Ben Morrow on

Quoth Robert Hicks <sigzero(a)gmail.com>:
> This is just a "like to know" question.
>
> Does:
>
> use feature "switch";
>
> incur anything more or less than:
>
> use feature ":5.10"; # which gives you switch and everything
> else

Well, yes.

use feature ":5.10";

is equivalent to

use feature qw/switch say state/;

so you get 'say' and 'state' keywords as well as 'given' and 'when'.

> Is it good practice just to pull in what you want with the first one?

IMHO best practice would be

use 5.010;

at the top of any file using these features, but note the 'would be'
rather than 'is' since 'feature' as a whole is fairly new and it's not
necessarily clear yet if there are any significant gotchas.

Ben

From: Robert Hicks on
On Apr 13, 3:56 pm, Ben Morrow <b...(a)morrow.me.uk> wrote:
> Quoth Robert Hicks <sigz...(a)gmail.com>:
>
> > This is just a "like to know" question.
>
> > Does:
>
> >     use feature "switch";
>
> > incur anything more or less than:
>
> >     use feature ":5.10";   # which gives you switch and everything
> > else
>
> Well, yes.
>
>     use feature ":5.10";
>
> is equivalent to
>
>     use feature qw/switch say state/;
>
> so you get 'say' and 'state' keywords as well as 'given' and 'when'.
>
> > Is it good practice just to pull in what you want with the first one?
>
> IMHO best practice would be
>
>     use 5.010;
>
> at the top of any file using these features, but note the 'would be'
> rather than 'is' since 'feature' as a whole is fairly new and it's not
> necessarily clear yet if there are any significant gotchas.
>
> Ben

Thanks for your answer Ben.

Bob
From: Ted Zlatanov on
On Tue, 13 Apr 2010 20:56:15 +0100 Ben Morrow <ben(a)morrow.me.uk> wrote:

BM> IMHO best practice would be

BM> use 5.010;

BM> at the top of any file using these features, but note the 'would be'
BM> rather than 'is' since 'feature' as a whole is fairly new and it's not
BM> necessarily clear yet if there are any significant gotchas.

I like to use Modern::Perl. It does that plus a few other nice
features:

For now, this only enables the strict and warnings pragmas, as well as
all of the features available in Perl 5.10. It also enables C3 method
resolution order; see "perldoc mro" for an explanation. In the future,
it will include additional CPAN modules which have proven useful and
stable.

Ted