Using new features of Perl

R

Robert Hicks

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
 
R

Robert Hicks

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


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
 
T

Ted Zlatanov

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top