NAME
Classic::Perl - Selectively reinstate deleted Perl features
VERSION
Version 0.02
SYNOPSIS
use Classic::Perl;
# or
use Classic::Perl 'split';
split //, "smat";
print join " ", @_; # prints "s m a t"
no Classic::Perl;
@_ = ();
split //, "smat";
print join " ", @_;
# prints "s m a t" in perl 5.10.x; nothing in 5.12
use Classic::Perl '$*';
$* = 1;
print "yes\n" if "foo\nbar" =~ /^bar/; # prints yes
DESCRIPTION
Classic::Perl restores some Perl features that have been deleted in the latest versions. By 'classic' we mean as of perl 5.8.x.
The whole idea is that you can put use Classic::Perl
at the top of an old script or module (or a new one, if you like the features that are out of vogue) and have it continue to work.
In versions of perl prior to 5.10, this module simply does nothing.
ENABLING FEATURES
To enable all features, simply use use Classic::Perl;
. To disable whatever Classic::Perl enabled, write no Classic::Perl;
. These are lexically-scoped, so:
{
use Classic::Perl;
# ... features on here ...
}
# ... features off here ...
To enable or disable a specific set of features, pass them as arguments to use
or no
:
use Classic::Perl qw< split $* >;
To enable features that still existed in a given version of perl, put four colons in your use
statement, followed by the perl version. Only plain numbers (5.008
) are currently supported. Don't use v-strings (v5.8.0
).
use Classic::::Perl 5.012; # does nothing (yet)
use Classic::::Perl 5.010; # enables split, but not $*
use Classic::::Perl 5.008; # enables everything
This is not guaranteed to do anything reasonable if used with no
.
THE FEATURES THEMSELVES
- split
-
This features provides
split
to@_
in void and scalar context.This was removed from perl in 5.11.
- $*
-
This feature provides the
$*
variable, which, when set to an integer other than zero, puts an implicit/m
on every regular expression.Unlike the
$*
variable in perl 5.8 and earlier, this only works at compile-time and is lexically scoped (like$[
in 5.10-5.14). It only works with constant values.$* = $val
does not work.<$*> was removed in perl 5.9.
BUGS
Please report any bugs you find via http://rt.cpan.org or bug-Classic-Perl@rt.cpan.org.
ACKNOWLEDGEMENTS
About half the code in the XS file was stolen from Vincent Pit's autovivification
module and tweaked. The ptable.h file was taken straight from his module without modifications. (I have been subsequently informed that he stole it from B::Hooks::OP::Check, which pilfered it from autobox, which filched it from perl. :-)
SINE QUIBUS NON
perl 5 or higher
COPYRIGHT
Copyright (C) 2010 Father Chrysostomos
use Classic'Perl;
split / /, 'org . cpan @ sprout';
print reverse "\n", @_;
This program is free software; you may redistribute it, modify it or both under the same terms as perl.
SEE ALSO
perl, split
in perlfunc, UNIVERSAL
, $*
in perlvar|perlvar/$*
any::feature is an experimental module that backports new Perl features to older versions.
The Modern::Perl module enables various pragmata which are currently popular.