TODO: perltodo really could use major updating.
p4raw-id: //depot/perl@9998
source. Security through obscurity, the name for hiding your bugs
instead of fixing them, is little security indeed.
-You can try using encryption via source filters (Filter::* from CPAN),
-but any decent programmer will be able to decrypt it. You can try using
-the byte code compiler and interpreter described below, but the curious
-might still be able to de-compile it. You can try using the native-code
-compiler described below, but crackers might be able to disassemble it.
-These pose varying degrees of difficulty to people wanting to get at
-your code, but none can definitively conceal it (true of every
-language, not just Perl).
+You can try using encryption via source filters (Starting from Perl
+5.8 the Filter::Simple and Filter::Util::Call modules are included in
+the standard distribution), but any decent programmer will be able to
+decrypt it. You can try using the byte code compiler and interpreter
+described below, but the curious might still be able to de-compile it.
+You can try using the native-code compiler described below, but
+crackers might be able to disassemble it. These pose varying degrees
+of difficulty to people wanting to get at your code, but none can
+definitively conceal it (true of every language, not just Perl).
If you're concerned about people profiting from your code, then the
bottom line is that nothing but a restrictive license will give you
If you are serious about writing a parser, there are a number of
modules or oddities that will make your life a lot easier. There are
the CPAN modules Parse::RecDescent, Parse::Yapp, and Text::Balanced;
-and the byacc program.
+and the byacc program. Starting from perl 5.8 the Text::Balanced
+is part of the standard distribution.
One simple destructive, inside-out approach that you might try is to
pull out the smallest nesting parts one at a time:
For some specific applications, you can use one of the DBM modules.
See L<AnyDBM_File>. More generically, you should consult the FreezeThaw,
-Storable, or Class::Eroot modules from CPAN. Here's one example using
+Storable, or Class::Eroot modules from CPAN. Starting from Perl 5.8
+Storable is part of the standard distribution. Here's one example using
Storable's C<store> and C<retrieve> functions:
use Storable;
This is explained in more depth in the L<perlsyn>. Briefly, there's
no official case statement, because of the variety of tests possible
in Perl (numeric comparison, string comparison, glob comparison,
-regex matching, overloaded comparisons, ...). Larry couldn't decide
-how best to do this, so he left it out, even though it's been on the
-wish list since perl1.
+regex matching, overloaded comparisons, ...).
+Larry couldn't decide how best to do this, so he left it out, even
+though it's been on the wish list since perl1.
-The general answer is to write a construct like this:
+Starting from Perl 5.8 to get switch and case one can use the
+Switch extension and say:
+
+ use Switch;
+
+after which one has switch and case. It is not as fast as it could be
+because it's not really part of the language (it's done using source
+filters) but it is available, and it's very flexible.
+
+But if one wants to use pure Perl, the general answer is to write a
+construct like this:
for ($variable_to_test) {
if (/pat1/) { } # do something
If you want finer granularity than the 1 second that the sleep()
function provides, the easiest way is to use the select() function as
documented in L<perlfunc/"select">. Try the Time::HiRes and
-the BSD::Itimer modules (available from CPAN).
+the BSD::Itimer modules (available from CPAN, and starting from
+Perl 5.8 Time::HiRes is part of the standard distribution).
=head2 How can I measure time under a second?
In general, you may not be able to. The Time::HiRes module (available
-from CPAN) provides this functionality for some systems.
+from CPAN, and starting from Perl 5.8 part of the standard distribution)
+provides this functionality for some systems.
If your system supports both the syscall() function in Perl as well as
a system call like gettimeofday(2), then you may be able to do
CPAN/modules/by-module/Filter
+Starting from Perl 5.8 Filter::Util::Call (the core part of the
+Source Filters distribution) is part of the standard Perl distribution.
+Also included is a friendlier interface called Filter::Simple, by
+Damian Conway.
+
=head1 AUTHOR
Paul Marquess E<lt>Paul.Marquess@btinternet.comE<gt>
For delays of finer granularity than one second, you may use Perl's
four-argument version of select() leaving the first three arguments
undefined, or you might be able to use the C<syscall> interface to
-access setitimer(2) if your system supports it. The Time::HiRes module
-from CPAN may also prove useful.
+access setitimer(2) if your system supports it. The Time::HiRes
+module (from CPAN, and starting from Perl 5.8 part of the standard
+distribution) may also prove useful.
It is usually a mistake to intermix C<alarm> and C<sleep> calls.
(C<sleep> may be internally implemented in your system with C<alarm>)
For delays of finer granularity than one second, you may use Perl's
C<syscall> interface to access setitimer(2) if your system supports
-it, or else see L</select> above. The Time::HiRes module from CPAN
-may also help.
+it, or else see L</select> above. The Time::HiRes module (from CPAN,
+and starting from Perl 5.8 part of the standard distribution) may also
+help.
See also the POSIX module's C<pause> function.
$s = q{ if($a eq "}") ... }; # WRONG
-is a syntax error. The C<Text::Balanced> module on CPAN is able to do this
-properly.
+is a syntax error. The C<Text::Balanced> module (from CPAN, and
+starting from Perl 5.8 part of the standard distribution) is able
+to do this properly.
There can be whitespace between the operator and the quoting
characters, except when C<#> is being used as the quoting character.
One can circumnavigate both these problems in two ways. Either
transfer and store numbers always in text format, instead of raw
binary, or else consider using modules like Data::Dumper (included in
-the standard distribution as of Perl 5.005) and Storable. Keeping
-all data as text significantly simplifies matters.
+the standard distribution as of Perl 5.005) and Storable (included as
+of perl 5.8). Keeping all data as text significantly simplifies matters.
=head2 Files and Filesystems
source. Security through obscurity, the name for hiding your bugs
instead of fixing them, is little security indeed.
-You can try using encryption via source filters (Filter::* from CPAN).
-But crackers might be able to decrypt it. You can try using the
-byte code compiler and interpreter described below, but crackers might
-be able to de-compile it. You can try using the native-code compiler
+You can try using encryption via source filters (Filter::* from CPAN,
+or Filter::Util::Call and Filter::Simple since Perl 5.8).
+But crackers might be able to decrypt it. You can try using the byte
+code compiler and interpreter described below, but crackers might be
+able to de-compile it. You can try using the native-code compiler
described below, but crackers might be able to disassemble it. These
pose varying degrees of difficulty to people wanting to get at your
code, but none can definitively conceal it (this is true of every
}
There is no official C<switch> statement in Perl, because there are
-already several ways to write the equivalent. In addition to the
-above, you could write
+already several ways to write the equivalent.
+
+However, starting from Perl 5.8 to get switch and case one can use
+the Switch extension and say:
+
+ use Switch;
+
+after which one has switch and case. It is not as fast as it could be
+because it's not really part of the language (it's done using source
+filters) but it is available, and it's very flexible.
+
+In addition to the above BLOCK construct, you could write
SWITCH: {
$abc = 1, last SWITCH if /^abc/;
=head1 Perl Language
-=head2 64-bit Perl
-
-Verify complete 64 bit support so that the value of sysseek, or C<-s>, or
-stat(), or tell can fit into a perl number without losing precision.
-Work with the perl-64bit mailing list on perl.org.
-
=head2 Prototypes
=over 4
=head2 Reliable signals
-Sarathy and Dan Sugalski are working on this. Chip posted a patch
-earlier, but it was not accepted into 5.005. The issue is tricky,
-because it has the potential to greatly slow down the core.
+Mostly done in Perl 5.8, there is now a reliable signal handler
+despatch. No measurable slowdown detected in Linux or Solaris
+with the 5.8 approach (implemented by Nick I-S).
There are at least three things to consider:
=item Alternate runops() for signal despatch
-Sarathy and Dan are discussed this on perl5-porters.
+Sarathy and Dan discussed this on perl5-porters.
=item Figure out how to die() in delayed sighandler
=head2 Memory leaks from failed eval/regcomp
The only known memory leaks in Perl are in failed code or regexp
-compilation. Fix this. Hugo Van Der Sanden will attempt this but
-won't have tuits until January 1999.
+compilation. Fix this.
+
+Noticed in Perl 5.6: Also local()ising tied variables leak.
=head2 Make XS easier to use
There was interest in SWIG from porters, but nothing has happened
lately.
+New development in 2001: the Inline module, when it gels, shows great
+promise.
+
=head2 Make embedded Perl easier to use
This is probably difficult for the same reasons that "XS For Dummies"
=over 4
-=item Regular expressions
-
-Robin Berjon (r.berjon@ltconsulting.net) has volunteered.
-
=item I/O
Mark-Jason Dominus (mjd@plover.com) has an outline for perliotut.
Make C<perldoc> tell users what they need to add to their .login or
.cshrc to set their MANPATH correctly.
-=head2 Install ALL Documentation
-
-Make the standard documentation kit include the VMS, OS/2, Win32,
-Threads, etc information. installperl and pod/Makefile should know
-enough to copy README.foo to perlfoo.pod before building everything,
-when appropriate.
-
=head2 Outstanding issues to be documented
Tom has a list of 5.005_5* features or changes that require
=head2 Profiler
-Make the profiler (Devel::DProf) part of the standard release, and
-document it well.
+Devel::DProf requires more documentation.
=head2 Tie Modules
Write a module for transparent, portable remote procedure calls. (Not
core). This touches on the CORBA and ILU work.
-=head2 y2k localtime/gmtime
-
-Write a module, Y2k::Catch, which overloads localtime and gmtime's
-returned year value and catches "bad" attempts to use it.
-
=head2 Export File::Find variables
Make File::Find export C<$name> etc manually, at least if asked to.
Permit a user to debug an already-running program.
-=head2 Regular Expression debugger
-
-Create a visual profiler/debugger tool that stepped you through the
-execution of a regular expression point by point. Ilya has a module
-to color-code and display regular expression parses and executions.
-There's something at http://tkworld.org/ that might be a good start,
-it's a Tk/Tcl RE wizard, that builds regexen of many flavours.
-
=head2 Alternative RE Syntax
Make an alternative regular expression syntax that is accessed through
=head2 Optimize away @_ where possible
-=head2 Optimize sort by { $a <=> $b }
-
-Greg Bacon added several more sort optimizations. These have
-made it into 5.005_55, thanks to Hans Mulder.
-
=head2 Rewrite regexp parser for better integrated optimization
The regexp parser was rewritten for 5.005. Ilya's the regexp guru.
=item Loop control on do{} et al
-=item Explicit switch statements
-
-Nobody has yet managed to come up with a switch syntax that would
-allow for mixed hash, constant, regexp checks. Submit implementation
-with syntax, please.
-
=item compile to real threaded code
=item structured types
Can we install modules as bytecode?
-=head1 Recently Finished Tasks
-
-=head2 Figure a way out of $^(capital letter)
-
-Figure out a clean way to extend $^(capital letter) beyond
-the 26 alphabets. (${^WORD} maybe?)
-
-Mark-Jason Dominus sent a patch which went into 5.005_56.
-
=head2 Filenames
-Keep filenames in the distribution and in the standard module set
-be 8.3 friendly where feasible. Good luck changing the standard
-modules, though.
+Ongoing effort: keep filenames in the distribution and in the standard
+module set be 8.3 friendly where feasible. Good luck changing the
+standard modules, though.
=head2 Foreign lines
Rename and alter ISA.pm. B<Done>. It is now base.pm.
-=head2 gettimeofday
-
-See Time::HiRes.
-
=head2 autocroak?
This is the Fatal.pm module, so any builtin that does