For a release on a stable branch, follows this formula:
- This document describes differences between the 5.10.3 release and
- the 5.10.4 release.
+ This document describes differences between the 5.10.3 release
+ and the 5.10.4 release.
For the start of a new stable branch, follows this formula:
- This document describes differences between the 5.12.0 release and
- the 5.10.0 release.
+ This document describes differences between the 5.12.0 release
+ and the 5.10.0 release.
Clearly this sets the scope of which changes are to be summarised in the rest
of the document.
For a release on a stable branch, this section aspires to be
- There are no changes intentionally incompatible with 5.10.3. If any exist,
- they are bugs and reports are welcome.
+ There are no changes intentionally incompatible with 5.10.3.
+ If any exist, they are bugs and reports are welcome.
=item Core Enhancements
Use the following commands to test perl with Purify:
- sh Configure -des -Doptimize=-g -Uusemymalloc -Dusemultiplicity \
- -Accflags=-DPURIFY
+ sh Configure -des -Doptimize=-g -Uusemymalloc \
+ -Dusemultiplicity -Accflags=-DPURIFY
setenv PURIFYOPTIONS "-chain-length=25"
make all pureperl
cd t
unobtrusively go to a log file instead of to the interactive window,
use the following options instead:
- setenv PURIFYOPTIONS "-chain-length=25 -windows=no -log-file=perl.log \
- -append-logfile=yes"
+ setenv PURIFYOPTIONS "-chain-length=25 -windows=no \
+ -log-file=perl.log -append-logfile=yes"
The only currently known leaks happen when there are compile-time errors
within eval or require. (Fixing these is non-trivial, unfortunately, but
implemented in 5.003_05 isn't optimal, but here's what was done:
#ifdef HAS_CHSIZE
- # ifdef my_chsize /* Probably #defined to Perl_my_chsize in embed.h */
- # undef my_chsize
+ # ifdef my_chsize /* Probably #defined to Perl_my_chsize */
+ # undef my_chsize /* in embed.h */
# endif
# define my_chsize chsize
#endif
My explanatory comment in patch 5.003_05 said:
- Undef and then re-define my_chsize from Perl_my_chsize to
- just plain chsize if this system HAS_CHSIZE. This probably only
- applies to SCO. This shows the perils of having internal
- functions with the same name as external library functions :-).
+ Undef and then re-define my_chsize from Perl_my_chsize to
+ just plain chsize if this system HAS_CHSIZE. This probably only
+ applies to SCO. This shows the perils of having internal
+ functions with the same name as external library functions :-).
Now, we can safely put C<my_chsize> in C<embed.fnc>, export it, and
hide it with F<embed.h>.
a mail message from Larry:
The main intent of APPLLIB_EXP is for folks who want to send out a
- version of Perl embedded in their product. They would set the symbol
- to be the name of the library containing the files needed to run or to
- support their particular application. This works at the "override"
- level to make sure they get their own versions of any library code that
- they absolutely must have configuration control over.
+ version of Perl embedded in their product. They would set the
+ symbol to be the name of the library containing the files needed
+ to run or to support their particular application. This works at
+ the "override" level to make sure they get their own versions of
+ any library code that they absolutely must have configuration
+ control over.
As such, I don't see any conflict with a sysadmin using it for a
- override-ish sort of thing, when installing a generic Perl. It should
- probably have been named something to do with overriding though. Since
- it's undocumented we could still change it... :-)
+ override-ish sort of thing, when installing a generic Perl. It
+ should probably have been named something to do with overriding
+ though. Since it's undocumented we could still change it... :-)
Given that it's already there, you can use it to override distribution modules.
One way to do that is to add
=item splitpath (override)
- ($volume,$directories,$file) = File::Spec->splitpath( $path );
- ($volume,$directories,$file) = File::Spec->splitpath( $path,
- $no_file );
+ ($volume,$directories,$file) = File::Spec->splitpath( $path );
+ ($volume,$directories,$file) = File::Spec->splitpath( $path,
+ $no_file );
Passing a true value for C<$no_file> indicates that the path being
split only contains directory components, even on systems where you
=item splitpath
- ($volume,$directories,$file) = File::Spec->splitpath( $path );
- ($volume,$directories,$file) = File::Spec->splitpath( $path,
- $no_file );
+ ($volume,$directories,$file) = File::Spec->splitpath( $path );
+ ($volume,$directories,$file) = File::Spec->splitpath( $path,
+ $no_file );
Splits a path into volume, directory, and filename portions. Assumes that
the last file is a path unless the path ends in '\\', '\\.', '\\..'
will look like this:
- color *THIS = ...; // Initialized as in typemap
+ color *THIS = ...; // Initialized as in typemap
delete THIS;
example.
TYPEMAP
- color * O_OBJECT
+ color * O_OBJECT
OUTPUT
# The Perl object is blessed into 'CLASS', which should be a
# char* having the name of the package for the blessing.
O_OBJECT
- sv_setref_pv( $arg, CLASS, (void*)$var );
+ sv_setref_pv( $arg, CLASS, (void*)$var );
INPUT
O_OBJECT
- if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) )
- $var = ($type)SvIV((SV*)SvRV( $arg ));
- else{
- warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" );
- XSRETURN_UNDEF;
- }
+ if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) )
+ $var = ($type)SvIV((SV*)SvRV( $arg ));
+ else{
+ warn("${Package}::$func_name() -- " .
+ "$var is not a blessed SV reference");
+ XSRETURN_UNDEF;
+ }
=head2 Interface Strategy
=head1 SYNOPSIS
- corelist -v
- corelist [-a|-d] <ModuleName> | /<ModuleRegex>/ [<ModuleVersion>] ...
- corelist [-v <PerlVersion>] [ <ModuleName> | /<ModuleRegex>/ ] ...
- corelist [-r <PerlVersion>] ...
- corelist --feature <FeatureName> [<FeatureName>] ...
- corelist --diff PerlVersion PerlVersion
- corelist --upstream <ModuleName>
+ corelist -v
+ corelist [-a|-d] <ModuleName> | /<ModuleRegex>/ [<ModuleVersion>] ...
+ corelist [-v <PerlVersion>] [ <ModuleName> | /<ModuleRegex>/ ] ...
+ corelist [-r <PerlVersion>] ...
+ corelist --feature <FeatureName> [<FeatureName>] ...
+ corelist --diff PerlVersion PerlVersion
+ corelist --upstream <ModuleName>
=head1 OPTIONS
$cpt = new Safe;
sub wrapper {
- # vet arguments and perform potentially unsafe operations
+ # vet arguments and perform potentially unsafe operations
}
$cpt->share('&wrapper');
another open filehandle, or into a string passed as a ref (unless
you've built perl with -Uuseperlio).
- my $walker = B::Concise::compile('-terse','aFuncName', \&aSubRef); # 1
- walk_output(\my $buf);
- $walker->(); # 1 renders -terse
- set_style_standard('concise'); # 2
- $walker->(); # 2 renders -concise
- $walker->(@new); # 3 renders whatever
- print "3 different renderings: terse, concise, and @new: $buf\n";
+ my $walker = B::Concise::compile('-terse','aFuncName', \&aSubRef); # 1
+ walk_output(\my $buf);
+ $walker->(); # 1 renders -terse
+ set_style_standard('concise'); # 2
+ $walker->(); # 2 renders -concise
+ $walker->(@new); # 3 renders whatever
+ print "3 different renderings: terse, concise, and @new: $buf\n";
When $walker is called, it traverses the subroutines supplied when it
was created, and renders them using the current style. You can change
First, use C<mstats_fillhash(%hash)> to get the information contained
in the output of mstat() into %hash. The field of this hash are
- minbucket nbuckets sbrk_good sbrk_slack sbrked_remains sbrks start_slack
- topbucket topbucket_ev topbucket_odd total total_chain total_sbrk totfree
+ minbucket nbuckets sbrk_good sbrk_slack sbrked_remains sbrks
+ start_slack topbucket topbucket_ev topbucket_odd total total_chain
+ total_sbrk totfree
Two additional fields C<free>, C<used> contain array references which
provide per-bucket count of free and used chunks. Two other fields
use strict; use warnings;
{
- package Name_hash; # standard implementation: the object is a hash
-
+ package Name_hash; # standard implementation: the
+ # object is a hash
sub init {
my $obj = shift;
my ($first, $last) = @_;
{
package Name;
- use base 'Name_id'; # define here which implementation to run
+ use base 'Name_id'; # define here which implementation to run
}
use I18N::Langinfo qw(langinfo ABDAY_1 YESSTR NOSTR);
- my ($abday_1, $yesstr, $nostr) = map { langinfo($_) } (ABDAY_1, YESSTR, NOSTR);
+ my ($abday_1, $yesstr, $nostr) =
+ map { langinfo($_) } (ABDAY_1, YESSTR, NOSTR);
print "$abday_1? [$yesstr/$nostr] ";
$handle = new VMS::DCLsym;
$value = $handle->getsym($name);
- $handle->setsym($name,$value,'GLOBAL') or die "Can't create symbol: $!\n";
- $handle->delsym($name,'LOCAL') or die "Can't delete symbol: $!\n";
+ $handle->setsym($name, $value, 'GLOBAL')
+ or die "Can't create symbol: $!\n";
+ $handle->delsym($name, 'LOCAL') or die "Can't delete symbol: $!\n";
$handle->clearcache();
=head1 DESCRIPTION
=head1 SYNOPSIS
- use VMS::Stdio qw( &flush &getname &remove &rewind &setdef &sync &tmpnam
- &vmsopen &vmssysopen &waitfh &writeof );
+ use VMS::Stdio qw( &flush &getname &remove &rewind &setdef &sync
+ &tmpnam &vmsopen &vmssysopen &waitfh &writeof );
setdef("new:[default.dir]");
$uniquename = tmpnam;
$fh = vmsopen("my.file","rfm=var","alq=100",...) or die $!;
the C function itself pushed onto the stack, plus the return value from
the function; for example
- call_sv( sub { @_, 'c' }, G_ARRAY, 'a', 'b'); # returns 'a', 'b', 'c', 3
- call_sv( sub { @_ }, G_SCALAR, 'a', 'b'); # returns 'b', 1
+ call_sv( sub { @_, 'c' }, G_ARRAY, 'a', 'b');
+ # returns 'a', 'b', 'c', 3
+ call_sv( sub { @_ }, G_SCALAR, 'a', 'b');
+ # returns 'b', 1
=item B<eval_sv>
=head1 SYNOPSIS
- installhtml [--help] [--podpath=<name>:...:<name>] [--podroot=<name>]
- [--htmldir=<name>] [--htmlroot=<name>] [--norecurse] [--recurse]
- [--splithead=<name>,...,<name>] [--splititem=<name>,...,<name>]
- [--ignore=<name>,...,<name>] [--verbose]
+ installhtml [--help] [--podpath=<name>:...:<name>] [--podroot=<name>]
+ [--htmldir=<name>] [--htmlroot=<name>] [--norecurse] [--recurse]
+ [--splithead=<name>,...,<name>] [--splititem=<name>,...,<name>]
+ [--ignore=<name>,...,<name>] [--verbose]
=head1 DESCRIPTION
C<cmpthese> can also be passed the data structure that timethese() returns:
- $results = timethese( -1, { a => "++\$i", b => "\$i *= 2" } ) ;
+ $results = timethese( -1,
+ { a => "++\$i", b => "\$i *= 2" } ) ;
cmpthese( $results );
in case you want to see both sets of results.
Returns a reference to an ARRAY of rows, each row is an ARRAY of cells from the
above chart, including labels. This:
- my $rows = cmpthese( -1, { a => '++$i', b => '$i *= 2' }, "none" );
+ my $rows = cmpthese( -1,
+ { a => '++$i', b => '$i *= 2' }, "none" );
returns a data structure like:
struct( ELEMENT_NAME => ELEMENT_TYPE, ... );
# Declare struct at compile time
- use Class::Struct CLASS_NAME => [ ELEMENT_NAME => ELEMENT_TYPE, ... ];
- use Class::Struct CLASS_NAME => { ELEMENT_NAME => ELEMENT_TYPE, ... };
+ use Class::Struct CLASS_NAME => [ELEMENT_NAME => ELEMENT_TYPE, ...];
+ use Class::Struct CLASS_NAME => {ELEMENT_NAME => ELEMENT_TYPE, ...};
- # declare struct at compile time, based on array, implicit class name:
+ # declare struct at compile time, based on array, implicit
+ # class name:
package CLASS_NAME;
use Class::Struct ELEMENT_NAME => ELEMENT_TYPE, ... ;
tv_usecs => '$', # microseconds
]);
- # create an object:
- my $t = Rusage->new(ru_utime=>Timeval->new(), ru_stime=>Timeval->new());
+ # create an object:
+ my $t = Rusage->new(ru_utime=>Timeval->new(),
+ ru_stime=>Timeval->new());
- # $t->ru_utime and $t->ru_stime are objects of type Timeval.
- # set $t->ru_utime to 100.0 sec and $t->ru_stime to 5.0 sec.
+ # $t->ru_utime and $t->ru_stime are objects of type Timeval.
+ # set $t->ru_utime to 100.0 sec and $t->ru_stime to 5.0 sec.
$t->ru_utime->tv_secs(100);
$t->ru_utime->tv_usecs(0);
$t->ru_stime->tv_secs(5);
];
- my $cat = Cat->new( name => 'Socks',
- kittens => ['Monica', 'Kenneth'],
- markings => { socks=>1, blaze=>"white" },
- breed => Breed->new(name=>'short-hair', cross=>1),
- or: breed => {name=>'short-hair', cross=>1},
+ my $cat = Cat->new( name => 'Socks',
+ kittens => ['Monica', 'Kenneth'],
+ markings => { socks=>1, blaze=>"white" },
+ breed => Breed->new(name=>'short-hair', cross=>1),
+ or: breed => {name=>'short-hair', cross=>1},
);
print "Once a cat called ", $cat->name, "\n";
print "(which was a ", $cat->breed->name, ")\n";
- print "had two kittens: ", join(' and ', @{$cat->kittens}), "\n";
+ print "had 2 kittens: ", join(' and ', @{$cat->kittens}), "\n";
=back
# - Now using my() rather than local().
#
# Uses perl5 classes to create nested data types.
- # This is offered as one implementation of Tom Christiansen's "structs.pl"
- # idea.
+ # This is offered as one implementation of Tom Christiansen's
+ # "structs.pl" idea.
=cut
CLIENT->register() # register a client package name
CLIENT->done() # de-register from the debugging API
CLIENT->skippkg('hide::hide') # ask DB not to stop in this package
- CLIENT->cont([WHERE]) # run some more (until BREAK or another breakpt)
+ CLIENT->cont([WHERE]) # run some more (until BREAK or
+ # another breakpointt)
CLIENT->step() # single step
CLIENT->next() # step over
CLIENT->ret() # return from current subroutine
CLIENT->stop(FILE,LINE) # when execution stops
CLIENT->idle() # while stopped (can be a client event loop)
CLIENT->cleanup() # just before exit
- CLIENT->output(LIST) # called to print any output that API must show
+ CLIENT->output(LIST) # called to print any output that
+ # the API must show
=head1 DESCRIPTION
=head1 SYNOPSIS
use DBM_Filter ;
- use SDBM_File; # or DB_File, or GDBM_File, or NDBM_File, or ODBM_File
+ use SDBM_File; # or DB_File, GDBM_File, NDBM_File, or ODBM_File
$db = tie %hash, ...
=head1 SYNOPSIS
- use SDBM_File; # or DB_File, or GDBM_File, or NDBM_File, or ODBM_File
+ use SDBM_File; # or DB_File, GDBM_File, NDBM_File, ODBM_File
use DBM_Filter ;
$db = tie %hash, ...
=head1 SYNOPSIS
- use SDBM_File; # or DB_File, or GDBM_File, or NDBM_File, or ODBM_File
+ use SDBM_File; # or DB_File, GDBM_File, NDBM_File, ODBM_File
use DBM_Filter ;
$db = tie %hash, ...
=head1 SYNOPSIS
- use SDBM_File; # or DB_File, or GDBM_File, or NDBM_File, or ODBM_File
+ use SDBM_File; # or DB_File, GDBM_File, NDBM_File, or ODBM_File
use DBM_Filter ;
$db = tie %hash, ...
=head1 SYNOPSIS
- use SDBM_File; # or DB_File, or GDBM_File, or NDBM_File, or ODBM_File
+ use SDBM_File; # or DB_File, GDBM_File, NDBM_File, or ODBM_File
use DBM_Filter ;
$db = tie %hash, ...
=head1 SYNOPSIS
- use SDBM_File; # or DB_File, or GDBM_File, or NDBM_File, or ODBM_File
- use DBM_Filter ;
+ use SDBM_File; # or DB_File, GDBM_File, NDBM_File, or ODBM_File
+ use DBM_Filter;
$db = tie %hash, ...
$db->Filter_Push('utf8');
=head1 SYNOPSIS
use English;
- use English qw( -no_match_vars ) ; # Avoids regex performance penalty
- # in perl 5.16 and earlier
+ use English qw( -no_match_vars ) ; # Avoids regex performance
+ # penalty in perl 5.16 and
+ # earlier
...
if ($ERRNO =~ /denied/) { ... }
$set = new ExtUtils::XSSymSet;
while ($sym = make_symbol()) { $set->addsym($sym); }
foreach $safesym ($set->all_trimmed) {
- print "Processing $safesym (derived from ",$self->get_orig($safesym),")\n";
+ print "Processing $safesym (derived from ",
+ $self->get_orig($safesym), ")\n";
do_stuff($safesym);
}
=item C<fileparse>
X<fileparse>
- my($filename, $directories, $suffix) = fileparse($path);
- my($filename, $directories, $suffix) = fileparse($path, @suffixes);
- my $filename = fileparse($path, @suffixes);
+ my($filename, $dirs, $suffix) = fileparse($path);
+ my($filename, $dirs, $suffix) = fileparse($path, @suffixes);
+ my $filename = fileparse($path, @suffixes);
-The C<fileparse()> routine divides a file path into its $directories, $filename
+The C<fileparse()> routine divides a file path into its $dirs, $filename
and (optionally) the filename $suffix.
-$directories contains everything up to and including the last
+$dirs contains everything up to and including the last
directory separator in the $path including the volume (if applicable).
The remainder of the $path is the $filename.
matching for suffix removal is performed case-insensitively, since
those systems are not case-sensitive when opening existing files.
-You are guaranteed that C<$directories . $filename . $suffix> will
+You are guaranteed that C<$dirs . $filename . $suffix> will
denote the same location as the original $path.
=cut
Only on VMS (where there is no ambiguity between the file and directory
portions of a path) and AmigaOS (possibly due to an implementation quirk in
this module) does C<dirname()> work like C<fileparse($path)>, returning just the
-$directories.
+$dirs.
# On VMS and AmigaOS
- my $directories = dirname($path);
+ my $dirs = dirname($path);
When using Unix or MSDOS syntax this emulates the C<dirname(1)> shell function
which is subtly different from how C<fileparse()> works. It returns all but
getopts('oif:'); # -o & -i are boolean flags, -f takes an argument
# Sets $opt_* as a side effect.
getopts('oif:', \%opts); # options as above. Values in %opts
- getopt('oDI'); # -o, -D & -I take arg. Sets $opt_* as a side effect.
+ getopt('oDI'); # -o, -D & -I take arg.
+ # Sets $opt_* as a side effect.
getopt('oDI', \%opts); # -o, -D & -I take arg. Values in %opts
=head1 DESCRIPTION
=head1 SYNOPSIS
- open($fh,"<:crlf", "my.txt"); # support platform-native and CRLF text files
+ open($fh, "<:crlf", "my.txt"); # support platform-native and
+ # CRLF text files
- open($fh,"<","his.jpg"); # portably open a binary file for reading
+ open($fh, "<", "his.jpg"); # portably open a binary file for reading
binmode($fh);
Shell:
sub FETCH { ... }
sub FETCHSIZE { ... }
- sub STORE { ... } # mandatory if elements writeable
- sub STORESIZE { ... } # mandatory if elements can be added/deleted
- sub EXISTS { ... } # mandatory if exists() expected to work
- sub DELETE { ... } # mandatory if delete() expected to work
+ sub STORE { ... } # mandatory if elements writeable
+ sub STORESIZE { ... } # mandatory if elements can be added/deleted
+ sub EXISTS { ... } # mandatory if exists() expected to work
+ sub DELETE { ... } # mandatory if delete() expected to work
# optional methods - for efficiency
sub CLEAR { ... }
@ISA = qw(Tie::StdHash);
- # All methods provided by default, define only those needing overrides
+ # All methods provided by default, define
+ # only those needing overrides
# Accessors access the storage in %{$_[0]};
# TIEHASH should return a reference to the actual storage
sub DELETE { ... }
@ISA = qw(Tie::ExtraHash);
- # All methods provided by default, define only those needing overrides
+ # All methods provided by default, define
+ # only those needing overrides
# Accessors access the storage in %{$_[0][0]};
- # TIEHASH should return an array reference with the first element being
- # the reference to the actual storage
+ # TIEHASH should return an array reference with the first element
+ # being the reference to the actual storage
sub DELETE {
$_[0][1]->('del', $_[0][0], $_[1]); # Call the report writer
delete $_[0][0]->{$_[1]}; # $_[0]->SUPER::DELETE($_[1])
@ISA = qw(Tie::StdScalar);
- # All methods provided by default, so define only what needs be overridden
+ # All methods provided by default, so define
+ # only what needs be overridden
sub FETCH { ... }
=head1 SYNOPSIS
- use deprecate; # always deprecate the module in which this occurs
+ use deprecate; # always deprecate the module in which this occurs
- use if $] > 5.010, 'deprecate'; # conditionally deprecate the module
+ use if $] > 5.010, 'deprecate'; # conditionally deprecate the module
=head1 DESCRIPTION
$z = 2.7;
$a = 2**31 - 1; # Largest positive integer on 32-bit machines
$, = ", ";
- print $x, -$x, $x + $y, $x - $y, $x / $y, $x * $y, $y == $z, $a, $a + 1;
+ print $x, -$x, $x+$y, $x-$y, $x/$y, $x*$y, $y==$z, $a, $a+1;
will print: 5.8, -5, 7, 3, 2, 10, 1, 2147483647, -2147483648
PERLDB_RESTART - flag only, contains no restart data itself.
PERLDB_HIST - command history, if it's available
PERLDB_ON_LOAD - breakpoints set by the rc file
- PERLDB_POSTPONE - subs that have been loaded/not executed, and have actions
+ PERLDB_POSTPONE - subs that have been loaded/not executed,
+ and have actions
PERLDB_VISITED - files that had breakpoints
PERLDB_FILE_... - breakpoints for a file
PERLDB_OPT - active options
on the left hand side of the C<< => >> symbol.
use strict 'subs';
- $SIG{PIPE} = Plumber; # blows up
- $SIG{PIPE} = "Plumber"; # just fine: quoted string is always ok
- $SIG{PIPE} = \&Plumber; # preferred form
+ $SIG{PIPE} = Plumber; # blows up
+ $SIG{PIPE} = "Plumber"; # fine: quoted string is always ok
+ $SIG{PIPE} = \&Plumber; # preferred form
=back
# Declaring an old-style decimal $VERSION (use quotes!)
- our $VERSION = "1.0203"; # recommended
+ our $VERSION = "1.0203"; # recommended
use version; our $VERSION = version->parse("1.0203"); # formal
use version; our $VERSION = version->parse("1.02_03"); # alpha
True only if the version object is a dotted-decimal version, e.g.
- version->parse('v1.2.0')->is_qv; # TRUE
+ version->parse('v1.2.0')->is_qv; # TRUE
version->declare('v1.2')->is_qv; # TRUE
qv('1.2')->is_qv; # TRUE
version->parse('1.2')->is_qv; # FALSE
print $ver->stringify; # ditto
print $ver; # ditto
print $nver->normal; # prints as v1.2.0
- print $nver->stringify; # prints as 1.002, see "Stringification"
+ print $nver->stringify; # prints as 1.002,
+ # see "Stringification"
In order to preserve the meaning of the processed version, the
normalized representation will always contain at least three sub terms.
high-order bit set:
EXAMPLE:
- $ perl -e"exit 44;" Non-hushed error exit
- %SYSTEM-F-ABORT, abort DCL message
+ $ perl -e"exit 44;" Non-hushed error exit
+ %SYSTEM-F-ABORT, abort DCL message
$ show sym $STATUS
$STATUS == "%X0000002C"
- $ perl -e"use vmsish qw(hushed); exit 44;" Hushed error exit
+ $ perl -e"use vmsish qw(hushed); exit 44;" Hushed error exit
$ show sym $STATUS
$STATUS == "%X1000002C"
unlink $filename;
- my $db = tie %hash, 'DB_File', $filename, O_CREAT|O_RDWR, 0666, $DB_HASH
- or die "Cannot open $filename: $!\n";
+ my $db = tie %hash, 'DB_File', $filename, O_CREAT|O_RDWR, 0666,
+ $DB_HASH or die "Cannot open $filename: $!\n";
$db->filter_fetch_key ( sub { $_ = unpack("i", $_) } );
$db->filter_store_key ( sub { $_ = pack ("i", $_) } );
--------+---------------+-----------------------------------------
0 | NO | Disables key traversal randomization
1 | RANDOM | Enables full key traversal randomization
- 2 | DETERMINISTIC | Enables repeatable key traversal randomization
+ 2 | DETERMINISTIC | Enables repeatable key traversal
+ | | randomization
Both numeric and string values are accepted, but note that string values are
case sensitive. The default for this setting is "RANDOM" or 1.
if (fileno(THIS) != -1 && fileno(THIS) == fileno(THAT)) {
print "THIS and THAT are dups\n";
} elsif (fileno(THIS) != -1 && fileno(THAT) != -1) {
- print "THIS and THAT have different underlying file descriptors\n";
+ print "THIS and THAT have different " .
+ "underlying file descriptors\n";
} else {
- print "At least one of THIS and THAT does not have a real file descriptor\n";
+ print "At least one of THIS and THAT does " .
+ "not have a real file descriptor\n";
}
=item flock FILEHANDLE,OPERATION
writes the file as a MIME attachment, and sends it with a meaningful
subject:
- % git format-patch -1 --attach
- % perlbug -s "[PATCH] $(git log -1 --oneline HEAD)" -f 0001-*.patch
+ % git format-patch -1 --attach
+ % perlbug -s "[PATCH] $(git log -1 --oneline HEAD)" -f 0001-*.patch
The perlbug program will ask you a few questions about your email
address and the patch you're submitting. Once you've answered them it
Perl history in brief, by Larry Wall:
- Perl 0 introduced Perl to my officemates.
- Perl 1 introduced Perl to the world, and changed /\(...\|...\)/ to
- /(...|...)/. \(Dan Faigin still hasn't forgiven me. :-\)
- Perl 2 introduced Henry Spencer's regular expression package.
- Perl 3 introduced the ability to handle binary data (embedded nulls).
- Perl 4 introduced the first Camel book. Really. We mostly just
- switched version numbers so the book could refer to 4.000.
- Perl 5 introduced everything else, including the ability to
- introduce everything else.
+ Perl 0 introduced Perl to my officemates.
+ Perl 1 introduced Perl to the world, and changed /\(...\|...\)/ to
+ /(...|...)/. \(Dan Faigin still hasn't forgiven me. :-\)
+ Perl 2 introduced Henry Spencer's regular expression package.
+ Perl 3 introduced the ability to handle binary data (embedded nulls).
+ Perl 4 introduced the first Camel book. Really. We mostly just
+ switched version numbers so the book could refer to 4.000.
+ Perl 5 introduced everything else, including the ability to
+ introduce everything else.
=head1 THE KEEPERS OF THE PUMPKIN
sub identify_typeglob {
my $glob = shift;
- print 'You gave me ', *{$glob}{PACKAGE}, '::', *{$glob}{NAME}, "\n";
+ print 'You gave me ', *{$glob}{PACKAGE},
+ '::', *{$glob}{NAME}, "\n";
}
identify_typeglob *foo;
identify_typeglob *bar::baz;
}
INIT { print " 9. You'll see the difference right away.\n" }
- print "13. It merely _looks_ like it should be confusing.\n";
+ print "13. It only _looks_ like it should be confusing.\n";
__END__
unintuitive. Also, if many elements may be undefined you may see the
following unattractive method calls:
- $obj->do_something(undef, undef, undef, undef, undef, undef, 1024);
+ $obj->do_something(undef, undef, undef, undef, undef, 1024);
Provide sensible defaults for parameters which have them. Don't make
your users specify parameters which will almost always be the same.
Hence, putting it all together:
- my($date,$description,$income,$expend) = unpack("A10xA27xA7xA*", $_);
+ my ($date, $description, $income, $expend) =
+ unpack("A10xA27xA7xA*", $_);
Now, that's our data parsed. I suppose what we might want to do now is
total up our income and expenditure, and add another line to the end of
how much we've spent:
while (<>) {
- my($date, $desc, $income, $expend) = unpack("A10xA27xA7xA*", $_);
+ my ($date, $desc, $income, $expend) =
+ unpack("A10xA27xA7xA*", $_);
$tot_income += $income;
$tot_expend += $expend;
}
# OK, let's go:
- print pack("A10xA27xA7xA*", $date, "Totals", $tot_income, $tot_expend);
+ print pack("A10xA27xA7xA*", $date, "Totals",
+ $tot_income, $tot_expend);
Oh, hmm. That didn't quite work. Let's see what happened:
format pads any non-existent characters with spaces, so we can use the
additional spaces to line up our fields, like this:
- print pack("A11 A28 A8 A*", $date, "Totals", $tot_income, $tot_expend);
+ print pack("A11 A28 A8 A*", $date, "Totals",
+ $tot_income, $tot_expend);
(Note that you can put spaces in the template to make it more readable,
but they don't translate to spaces in the output.) Here's what we got
$tot_income = sprintf("%.2f", $tot_income);
$tot_expend = sprintf("%12.2f", $tot_expend);
$date = POSIX::strftime("%m/%d/%Y", localtime);
- print pack("A11 A28 A8 A*", $date, "Totals", $tot_income, $tot_expend);
+ print pack("A11 A28 A8 A*", $date, "Totals",
+ $tot_income, $tot_expend);
This time we get the right answer:
work on older Perls you'll need to C<unpack( 'Z* Z* C')> to get the length,
then use it to make a new unpack string. For example
- # pack a message: ASCIIZ, ASCIIZ, length, string, byte (5.005 compatible)
+ # pack a message: ASCIIZ, ASCIIZ, length, string, byte
+ # (5.005 compatible)
my $msg = pack( 'Z* Z* C A* C', $src, $dst, length $sm, $sm, $prio );
# unpack
version numbers of any modules it might be using to process the Pod.
Minimal examples:
- %% POD::Pod2PS v3.14159, using POD::Parser v1.92
+ %% POD::Pod2PS v3.14159, using POD::Parser v1.92
- <!-- Pod::HTML v3.14159, using POD::Parser v1.92 -->
+ <!-- Pod::HTML v3.14159, using POD::Parser v1.92 -->
- {\doccomm generated by Pod::Tree::RTF 3.14159 using Pod::Tree 1.08}
+ {\doccomm generated by Pod::Tree::RTF 3.14159 using Pod::Tree 1.08}
- .\" Pod::Man version 3.14159, using POD::Parser version 1.92
+ .\" Pod::Man version 3.14159, using POD::Parser version 1.92
Formatters may also insert additional comments, including: the
release date of the Pod formatter program, the contact address for
For example:
L<Foo::Bar>
- => undef, # link text
- "Foo::Bar", # possibly inferred link text
- "Foo::Bar", # name
- undef, # section
- 'pod', # what sort of link
- "Foo::Bar" # original content
+ => undef, # link text
+ "Foo::Bar", # possibly inferred link text
+ "Foo::Bar", # name
+ undef, # section
+ 'pod', # what sort of link
+ "Foo::Bar" # original content
L<Perlport's section on NL's|perlport/Newlines>
- => "Perlport's section on NL's", # link text
- "Perlport's section on NL's", # possibly inferred link text
- "perlport", # name
- "Newlines", # section
- 'pod', # what sort of link
- "Perlport's section on NL's|perlport/Newlines" # orig. content
+ => "Perlport's section on NL's", # link text
+ "Perlport's section on NL's", # possibly inferred link text
+ "perlport", # name
+ "Newlines", # section
+ 'pod', # what sort of link
+ "Perlport's section on NL's|perlport/Newlines"
+ # original content
L<perlport/Newlines>
- => undef, # link text
- '"Newlines" in perlport', # possibly inferred link text
- "perlport", # name
- "Newlines", # section
- 'pod', # what sort of link
- "perlport/Newlines" # original content
+ => undef, # link text
+ '"Newlines" in perlport', # possibly inferred link text
+ "perlport", # name
+ "Newlines", # section
+ 'pod', # what sort of link
+ "perlport/Newlines" # original content
L<crontab(5)/"DESCRIPTION">
- => undef, # link text
- '"DESCRIPTION" in crontab(5)', # possibly inferred link text
- "crontab(5)", # name
- "DESCRIPTION", # section
- 'man', # what sort of link
- 'crontab(5)/"DESCRIPTION"' # original content
+ => undef, # link text
+ '"DESCRIPTION" in crontab(5)', # possibly inferred link text
+ "crontab(5)", # name
+ "DESCRIPTION", # section
+ 'man', # what sort of link
+ 'crontab(5)/"DESCRIPTION"' # original content
L</Object Attributes>
- => undef, # link text
- '"Object Attributes"', # possibly inferred link text
- undef, # name
- "Object Attributes", # section
- 'pod', # what sort of link
- "/Object Attributes" # original content
+ => undef, # link text
+ '"Object Attributes"', # possibly inferred link text
+ undef, # name
+ "Object Attributes", # section
+ 'pod', # what sort of link
+ "/Object Attributes" # original content
L<http://www.perl.org/>
- => undef, # link text
- "http://www.perl.org/", # possibly inferred link text
- "http://www.perl.org/", # name
- undef, # section
- 'url', # what sort of link
- "http://www.perl.org/" # original content
+ => undef, # link text
+ "http://www.perl.org/", # possibly inferred link text
+ "http://www.perl.org/", # name
+ undef, # section
+ 'url', # what sort of link
+ "http://www.perl.org/" # original content
L<Perl.org|http://www.perl.org/>
- => "Perl.org", # link text
- "http://www.perl.org/", # possibly inferred link text
- "http://www.perl.org/", # name
- undef, # section
- 'url', # what sort of link
+ => "Perl.org", # link text
+ "http://www.perl.org/", # possibly inferred link text
+ "http://www.perl.org/", # name
+ undef, # section
+ 'url', # what sort of link
"Perl.org|http://www.perl.org/" # original content
Note that you can distinguish URL-links from anything else by the
For licensing the easiest way is to use the same licensing as Perl itself:
- This library is free software; you may redistribute it and/or modify
- it under the same terms as Perl itself.
+ This library is free software; you may redistribute it and/or
+ modify it under the same terms as Perl itself.
This makes it easy for people to use your module with Perl. Note that
this licensing example is neither an endorsement or a requirement, you are
On the other hand, if you want the other meaning, you can do this:
- sub showem { { @_ } } # ambiguous (currently ok, but may change)
+ sub showem { { @_ } } # ambiguous (currently ok,
+ # but may change)
sub showem { {; @_ } } # ok
sub showem { { return @_ } } # ok
escape sequences, e.g., C<\033>, or hexadecimal escape sequences,
e.g., C<\x1B>:
- "1000\t2000" =~ m(0\t2) # matches
- "cat" =~ /\143\x61\x74/ # matches in ASCII, but a weird way to spell cat
+ "1000\t2000" =~ m(0\t2) # matches
+ "cat" =~ /\143\x61\x74/ # matches in ASCII, but
+ # a weird way to spell cat
Regexes are treated mostly as double-quoted strings, so variable
substitution works:
/(\w+)\s+\g1/; # match doubled words of arbitrary length
$year =~ /^\d{2,4}$/; # make sure year is at least 2 but not more
# than 4 digits
- $year =~ /^\d{4}$|^\d{2}$/; # better match; throw out 3 digit dates
+ $year =~ /^\d{4}$|^\d{2}$/; # better match; throw out 3 digit dates
These quantifiers will try to match as much of the string as possible,
while still allowing the regex to match. So we have
print "$x $y\n"; # prints "I like dogs. I like cats."
$x = "Cats are great.";
- print $x =~ s/Cats/Dogs/r =~ s/Dogs/Frogs/r =~ s/Frogs/Hedgehogs/r, "\n";
+ print $x =~ s/Cats/Dogs/r =~ s/Dogs/Frogs/r =~
+ s/Frogs/Hedgehogs/r, "\n";
# prints "Hedgehogs are great."
@foo = map { s/[a-z]/X/r } qw(a b c 1 2 3);
set around an alternative achieves. Here is an extended version of the
previous pattern:
- if ( $time =~ /(?|(\d\d|\d):(\d\d)|(\d\d)(\d\d))\s+([A-Z][A-Z][A-Z])/ ){
- print "hour=$1 minute=$2 zone=$3\n";
- }
+ if($time =~ /(?|(\d\d|\d):(\d\d)|(\d\d)(\d\d))\s+([A-Z][A-Z][A-Z])/){
+ print "hour=$1 minute=$2 zone=$3\n";
+ }
Within the alternative numbering group, group numbers start at the same
position for each alternative. After the group, numbering continues
$x = "Mmm...donut, thought Homer";
$x =~ /^(Mmm|Yech)\.\.\.(donut|peas)/; # matches
- foreach $expr (1..$#-) {
- print "Match $expr: '${$expr}' at position ($-[$expr],$+[$expr])\n";
+ foreach $exp (1..$#-) {
+ print "Match $exp: '${$exp}' at position ($-[$exp],$+[$exp])\n";
}
prints
/y(es)?/i; # matches 'y', 'Y', or a case-insensitive 'yes'
$year =~ /^\d{2,4}$/; # make sure year is at least 2 but not more
# than 4 digits
- $year =~ /^\d{4}$|^\d{2}$/; # better match; throw out 3-digit dates
- $year =~ /^\d{2}(\d{2})?$/; # same thing written differently. However,
- # this captures the last two digits in $1
- # and the other does not.
+ $year =~ /^\d{4}$|^\d{2}$/; # better match; throw out 3-digit dates
+ $year =~ /^\d{2}(\d{2})?$/; # same thing written differently.
+ # However, this captures the last two
+ # digits in $1 and the other does not.
% simple_grep '^(\w+)\g1$' /usr/dict/words # isn't this easier?
beriberi
substitutions:
$x = "Cats are great.";
- print $x =~ s/Cats/Dogs/r =~ s/Dogs/Frogs/r =~ s/Frogs/Hedgehogs/r, "\n";
+ print $x =~ s/Cats/Dogs/r =~ s/Dogs/Frogs/r =~
+ s/Frogs/Hedgehogs/r, "\n";
# prints "Hedgehogs are great."
A modifier available specifically to search and replace is the
character frequencies in a line:
$x = "Bill the cat";
- $x =~ s/(.)/$chars{$1}++;$1/eg; # final $1 replaces char with itself
+ $x =~ s/(.)/$chars{$1}++;$1/eg; # final $1 replaces char with itself
print "frequency of '$_' is $chars{$_}\n"
foreach (sort {$chars{$b} <=> $chars{$a}} keys %chars);
Here is the association between some Perl named classes and the
traditional Unicode classes:
- Perl class name Unicode class name or regular expression
-
- IsAlpha /^[LM]/
- IsAlnum /^[LMN]/
- IsASCII $code <= 127
- IsCntrl /^C/
- IsBlank $code =~ /^(0020|0009)$/ || /^Z[^lp]/
- IsDigit Nd
- IsGraph /^([LMNPS]|Co)/
- IsLower Ll
- IsPrint /^([LMNPS]|Co|Zs)/
- IsPunct /^P/
- IsSpace /^Z/ || ($code =~ /^(0009|000A|000B|000C|000D)$/
- IsSpacePerl /^Z/ || ($code =~ /^(0009|000A|000C|000D|0085|2028|2029)$/
- IsUpper /^L[ut]/
- IsWord /^[LMN]/ || $code eq "005F"
- IsXDigit $code =~ /^00(3[0-9]|[46][1-6])$/
+ Perl class Unicode class name or regular expression
+ name
+
+ IsAlpha /^[LM]/
+ IsAlnum /^[LMN]/
+ IsASCII $code <= 127
+ IsCntrl /^C/
+ IsBlank $code =~ /^(0020|0009)$/ || /^Z[^lp]/
+ IsDigit Nd
+ IsGraph /^([LMNPS]|Co)/
+ IsLower Ll
+ IsPrint /^([LMNPS]|Co|Zs)/
+ IsPunct /^P/
+ IsSpace /^Z/ || ($code =~ /^(0009|000A|000B|000C|000D)$/
+ IsSpacePerl /^Z/ || ($code =~ /^(0009|000A|000C|000D|0085|2028|2029)$/
+ IsUpper /^L[ut]/
+ IsWord /^[LMN]/ || $code eq "005F"
+ IsXDigit $code =~ /^00(3[0-9]|[46][1-6])$/
You can also use the official Unicode class names with C<\p> and
C<\P>, like C<\p{L}> for Unicode 'letters', C<\p{Lu}> for uppercase
% cat > keymatch
#!/usr/bin/perl
$kwds = 'copy compare list print';
- while( $command = <> ){
- $command =~ s/^\s+|\s+$//g; # trim leading and trailing spaces
- if( ( @matches = $kwds =~ /\b$command\w*/g ) == 1 ){
+ while( $cmd = <> ){
+ $cmd =~ s/^\s+|\s+$//g; # trim leading and trailing spaces
+ if( ( @matches = $kwds =~ /\b$cmd\w*/g ) == 1 ){
print "command: '@matches'\n";
} elsif( @matches == 0 ){
- print "no such command: '$command'\n";
+ print "no such command: '$cmd'\n";
} else {
- print "not unique: '$command' (could be one of: @matches)\n";
+ print "not unique: '$cmd' (could be one of: @matches)\n";
}
}
^D
Rather than trying to match the input against the keywords, we match the
combined set of keywords against the input. The pattern matching
-operation S<C<$kwds =~ /\b($command\w*)/g>> does several things at the
+operation S<C<$kwds =~ /\b($cmd\w*)/g>> does several things at the
same time. It makes sure that the given command begins where a keyword
begins (C<\b>). It tolerates abbreviations due to the added C<\w*>. It
tells us the number of matches (C<scalar @matches>) and all the keywords
Guessed: match at offset 0
Matching REx 'a*b+c' against 'abc'
Setting an EVAL scope, savestack=3
- 0 <> <abc> | 1: STAR
- EXACT <a> can match 1 times out of 32767...
+ 0 <> <abc> | 1: STAR
+ EXACT <a> can match 1 times out of 32767...
Setting an EVAL scope, savestack=3
- 1 <a> <bc> | 4: PLUS
- EXACT <b> can match 1 times out of 32767...
+ 1 <a> <bc> | 4: PLUS
+ EXACT <b> can match 1 times out of 32767...
Setting an EVAL scope, savestack=3
- 2 <ab> <c> | 7: EXACT <c>
- 3 <abc> <> | 9: END
+ 2 <ab> <c> | 7: EXACT <c>
+ 3 <abc> <> | 9: END
Match successful!
Freeing REx: 'a*b+c'
Matching REx 'a*b+c' against 'abc'
Setting an EVAL scope, savestack=3
- 0 <> <abc> | 1: STAR
- EXACT <a> can match 1 times out of 32767...
+ 0 <> <abc> | 1: STAR
+ EXACT <a> can match 1 times out of 32767...
Setting an EVAL scope, savestack=3
- 1 <a> <bc> | 4: PLUS
- EXACT <b> can match 1 times out of 32767...
+ 1 <a> <bc> | 4: PLUS
+ EXACT <b> can match 1 times out of 32767...
Setting an EVAL scope, savestack=3
- 2 <ab> <c> | 7: EXACT <c>
- 3 <abc> <> | 9: END
+ 2 <ab> <c> | 7: EXACT <c>
+ 3 <abc> <> | 9: END
Match successful!
Freeing REx: 'a*b+c'
# localization of values
- local $foo; # make $foo dynamically local
- local (@wid, %get); # make list of variables local
- local $foo = "flurp"; # make $foo dynamic, and init it
- local @oof = @bar; # make @oof dynamic, and init it
+ local $foo; # make $foo dynamically local
+ local (@wid, %get); # make list of variables local
+ local $foo = "flurp"; # make $foo dynamic, and init it
+ local @oof = @bar; # make @oof dynamic, and init it
- local $hash{key} = "val"; # sets a local value for this hash entry
- delete local $hash{key}; # delete this entry for the current block
- local ($cond ? $v1 : $v2); # several types of lvalues support
- # localization
+ local $hash{key} = "val"; # sets a local value for this hash entry
+ delete local $hash{key}; # delete this entry for the current block
+ local ($cond ? $v1 : $v2); # several types of lvalues support
+ # localization
# localization of symbols
- local *FH; # localize $FH, @FH, %FH, &FH ...
- local *merlyn = *randal; # now $merlyn is really $randal, plus
- # @merlyn is really @randal, etc
- local *merlyn = 'randal'; # SAME THING: promote 'randal' to *randal
- local *merlyn = \$randal; # just alias $merlyn, not @merlyn etc
+ local *FH; # localize $FH, @FH, %FH, &FH ...
+ local *merlyn = *randal; # now $merlyn is really $randal, plus
+ # @merlyn is really @randal, etc
+ local *merlyn = 'randal'; # SAME THING: promote 'randal' to *randal
+ local *merlyn = \$randal; # just alias $merlyn, not @merlyn etc
A C<local> modifies its listed variables to be "local" to the
enclosing block, C<eval>, or C<do FILE>--and to I<any subroutine
{
local *grow = \&shrink; # only until this block exits
- grow(); # really calls shrink()
- move(); # if move() grow()s, it shrink()s too
+ grow(); # really calls shrink()
+ move(); # if move() grow()s, it shrink()s too
}
- grow(); # get the real grow() again
+ grow(); # get the real grow() again
See L<perlref/"Function Templates"> for more about manipulating
functions by name in this way.
for some other functions that parse almost exactly like the
corresponding built-in.
- Declared as Called as
-
- sub mylink ($$) mylink $old, $new
- sub myvec ($$$) myvec $var, $offset, 1
- sub myindex ($$;$) myindex &getstring, "substr"
- sub mysyswrite ($$$;$) mysyswrite $buf, 0, length($buf) - $off, $off
- sub myreverse (@) myreverse $a, $b, $c
- sub myjoin ($@) myjoin ":", $a, $b, $c
- sub mypop (+) mypop @array
- sub mysplice (+$$@) mysplice @array, 0, 2, @pushme
- sub mykeys (+) mykeys %{$hashref}
- sub myopen (*;$) myopen HANDLE, $name
- sub mypipe (**) mypipe READHANDLE, WRITEHANDLE
- sub mygrep (&@) mygrep { /foo/ } $a, $b, $c
- sub myrand (;$) myrand 42
- sub mytime () mytime
+ Declared as Called as
+
+ sub mylink ($$) mylink $old, $new
+ sub myvec ($$$) myvec $var, $offset, 1
+ sub myindex ($$;$) myindex &getstring, "substr"
+ sub mysyswrite ($$$;$) mysyswrite $buf, 0, length($buf) - $off, $off
+ sub myreverse (@) myreverse $a, $b, $c
+ sub myjoin ($@) myjoin ":", $a, $b, $c
+ sub mypop (+) mypop @array
+ sub mysplice (+$$@) mysplice @array, 0, 2, @pushme
+ sub mykeys (+) mykeys %{$hashref}
+ sub myopen (*;$) myopen HANDLE, $name
+ sub mypipe (**) mypipe READHANDLE, WRITEHANDLE
+ sub mygrep (&@) mygrep { /foo/ } $a, $b, $c
+ sub myrand (;$) myrand 42
+ sub mytime () mytime
Any backslashed prototype character represents an actual argument
that must start with that character (optionally preceded by C<my>,
like:
use Config;
- $Config{useithreads} or die('Recompile Perl with threads to run this program.');
+ $Config{useithreads} or
+ die('Recompile Perl with threads to run this program.');
A possibly-threaded program using a possibly-threaded module might
have code like this:
caller, chdir, chmod, chown, chomp, chop, chr,
close, closedir, cos, crypt*, defined, delete, die, do, dump*,
each, endgrent, endpwent, eof, eval, exec*, exists, exit, exp,
- fileno, flock getc, getgrent*, getgrgid*, getgrnam, getlogin, getppid,
- getpwent*, getpwnam*, getpwuid*, glob, gmtime*, goto,
+ fileno, flock getc, getgrent*, getgrgid*, getgrnam, getlogin,
+ getppid, getpwent*, getpwnam*, getpwuid*, glob, gmtime*, goto,
grep, hex, ioctl, import, index, int, join, keys, kill*,
- last, lc, lcfirst, lchown*, length, link*, local, localtime, log, lstat, m//,
- map, mkdir, my, next, no, oct, open, opendir, ord, pack,
- pipe, pop, pos, print, printf, push, q//, qq//, qw//,
- qx//*, quotemeta, rand, read, readdir, readlink*, redo, ref, rename,
- require, reset, return, reverse, rewinddir, rindex,
+ last, lc, lcfirst, lchown*, length, link*, local, localtime, log,
+ lstat, m//, map, mkdir, my, next, no, oct, open, opendir, ord,
+ pack, pipe, pop, pos, print, printf, push, q//, qq//, qw//,
+ qx//*, quotemeta, rand, read, readdir, readlink*, redo, ref,
+ rename, require, reset, return, reverse, rewinddir, rindex,
rmdir, s///, scalar, seek, seekdir, select(internal),
select (system call)*, setgrent, setpwent, shift, sin, sleep,
socketpair, sort, splice, split, sprintf, sqrt, srand, stat,
=head1 SYNOPSIS
- // in your App.mmp
- USERINCLUDE \symbian\perl\x.y.z\include
- LIBRARY perlXYZ.lib
-
- // in your App
- #include "PerlUtil.h" // includes also EXTERN.h and perl.h
-
- // Static methods for moving between Perl strings (SvPV)
- // and Symbian strings (HBufC and TDes).
-
- static SV* newSvPVfromTDesC8(const TDesC8& aDes);
- static void setSvPVfromTDesC8(SV* sv, const TDesC8& aDes);
- static HBufC8* newHBufC8fromSvPV(SV* sv);
- static void setTDes8fromSvPV(TDes8* aDes8, SV* sv);
-
- static SV* newSvPVfromTDesC16(const TDesC16& aDes);
- static void setSvPVfromTDesC16(SV* sv, const TDesC16& aDes);
- static HBufC16* newHBufC16fromSvPV(SV* sv);
- static void setTDes16fromSvPV(TDes16* aDes16, SV* sv);
-
- static HBufC8* newHBufC8fromPVn(const U8* s, STRLEN n);
- static void setTDes8fromPVn(TDes8* aDes8, const U8* s, STRLEN n);
- static HBufC16* newHBufC16fromPVn(const U8* s, STRLEN n, bool utf8);
- static void setTDes16fromPVn(TDes16* aDes16, const U8* s, STRLEN n);
- // An example
-
- const U8* s = (const U8 *)"foo";
- HBufC16* b = PerlUtil::newHBufC16fromPVn(s, 3, 0);
- someCallWithConstTDesCRefArgument(*b);
- delete b;
+ // in your App.mmp
+ USERINCLUDE \symbian\perl\x.y.z\include
+ LIBRARY perlXYZ.lib
+
+ // in your App
+ #include "PerlUtil.h" // includes also EXTERN.h and perl.h
+
+ // Static methods for moving between Perl strings (SvPV)
+ // and Symbian strings (HBufC and TDes).
+
+ static SV* newSvPVfromTDesC8(const TDesC8& aDes);
+ static void setSvPVfromTDesC8(SV* sv, const TDesC8& aDes);
+ static HBufC8* newHBufC8fromSvPV(SV* sv);
+ static void setTDes8fromSvPV(TDes8* aDes8, SV* sv);
+
+ static SV* newSvPVfromTDesC16(const TDesC16& aDes);
+ static void setSvPVfromTDesC16(SV* sv, const TDesC16& aDes);
+ static HBufC16* newHBufC16fromSvPV(SV* sv);
+ static void setTDes16fromSvPV(TDes16* aDes16, SV* sv);
+
+ static HBufC8* newHBufC8fromPVn(const U8* s, STRLEN n);
+ static void setTDes8fromPVn(TDes8* aDes8, const U8* s, STRLEN n);
+ static HBufC16* newHBufC16fromPVn(const U8* s, STRLEN n, bool utf8);
+ static void setTDes16fromPVn(TDes16* aDes16, const U8* s, STRLEN n);
+
+ // An example
+
+ const U8* s = (const U8 *)"foo";
+ HBufC16* b = PerlUtil::newHBufC16fromPVn(s, 3, 0);
+ someCallWithConstTDesCRefArgument(*b);
+ delete b;
=cut