[9272] in Perl-Users-Digest
Perl-Users Digest, Issue: 2867 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 13 19:07:11 1998
Date: Sat, 13 Jun 98 16:00:23 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 13 Jun 1998 Volume: 8 Number: 2867
Today's topics:
Re: $a: numeric or NOT ? <tchrist@mox.perl.com>
Re: COMPARING TIME & DATE (Steffen Beyer)
Re: How do I limit the number of rows in sql query usin scott@softbase.com
how to honestly make money fast... (Charlie Pratt)
Re: lambda fun in Perl <scribble@pobox.com>
Re: New module/pragma "enum.pm" (was "fields.pm") (Broc Seib)
Re: new to this - simple if statement question (Florian Kuehnert)
Re: new to this - simple if statement question <tchrist@mox.perl.com>
Re: Perl editor debugger (Florian Kuehnert)
Reference Arithmetic? (jfm)
Re: Reference Arithmetic? <tchrist@mox.perl.com>
Re: Reference Arithmetic? (Jim Miner)
Re: refs and nested hashes <bowlin@sirius.com>
REVIEW: Advanced Perl Programming <tchrist@mox.perl.com>
REVIEW: Effective Perl Programming <tchrist@mox.perl.com>
REVIEW: MacPerl: Power and Ease <tchrist@mox.perl.com>
Re: REVIEW: Perl CGI Programming - No Experience Requir (Rahul Dhesi)
Re: REVIEW: Perl CGI Programming - No Experience Requir <tchrist@mox.perl.com>
REVIEW: Perl5 for Dummies <tchrist@mox.perl.com>
REVIEW: Perl5 Interactive <tchrist@mox.perl.com>
REVIEW: Perl: The Programmer's Companion <tchrist@mox.perl.com>
Re: splitting config file fascist@posix.org
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 13 Jun 1998 21:13:50 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: $a: numeric or NOT ?
Message-Id: <6luq2e$knc$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
"Michael D. Schleif" <mike.schleif@aquila.com> writes:
:This is a cryptographically signed message in MIME format.
Must you? Really?
:But, seriously, folks, is regular expression the only way to reasonably
:accomplish my task? I can handle this; in fact, my current solution
:makes use of that found in perldata.pod.
I believe it the *best* way. After all, not everyone considers
the same thing a number.
You could also call the Perl API's C function looks_like_a_number()
from an XS file.
:I will check out more recent versions of perldata.pod; but, if:
:
: if ($str == 0 && $str ne "0") {
: warn "That doesn't look like a number";
: }
:really should work, why NOT on my systems? If it no longer works, but
:once did, what broke? Nevertheless, if it does NOT work, it ought not
:be in perldata.pod.
It's simply not -w friendly. Not everything is.
:On another note, although perldata.pod is very informative on these
:issues, I have not found similar references in the FAQ.
*REALLY*?
% man perlfaq4
How do I determine whether a scalar is a number/whole/integer/float?
:please, direct me to which FAQ and what search criteria to use?
The FAQ that comes with the current standard Perl distribution.
Accept no substitutes.
--tom
--
Remember though that
THERE IS NO GENERAL RULE FOR CONVERTING A LIST INTO A SCALAR.
--Larry Wall in the perl man page
------------------------------
Date: 13 Jun 1998 18:26:46 GMT
From: sb@engelschall.com (Steffen Beyer)
Subject: Re: COMPARING TIME & DATE
Message-Id: <6lug96$4ul$1@en1.engelschall.com>
Mathijs Oosterom <thijs@esense.nl> wrote:
> In a temp-file on my Linux-server I have a date & time written. In a
> certain Perl-script I want to determine the difference between the date &
> time in the temp-file and the current date & time.
> Of course this can be done by writing a routine that does a lot of
> calculations, but I wonder if there is a better and faster way to do it.
> Maybe there's some sort of function for this?
> All help will be appreciated, thanx in advance,
Hint #1: http://freshmeat.net/ is a server where new Linux software is
announced daily.
Hint #2: Perl modules are your friend.
See http://www.perl.com/CPAN/modules/by-module/Date/.
Or see Date::Calc on my web server at
http://www.engelschall.com/u/sb/download/.
With Date::Calc, you'd solve your problem roughly as follows:
($yy,$mm,$dd,$HH,$MM,$SS) =
($input =~ /(\d{4}).(\d{2}).(\d{2}) (\d{2}):(\d{2}):(\d{2})/);
# (or something like that)
($Dd,$DH,$DM,$DS) = Delta_DHMS($yy,$mm,$dd,$HH,$MM,$SS,Today_and_Now());
# (difference in days, hours, minutes and seconds)
Yours,
--
Steffen Beyer <sb@engelschall.com>
Free Perl and C Software for Download: www.engelschall.com/u/sb/download/
"Perl is like sex: If you never had it, you wonder what the fuss is all
about. Once you had it, you never want to be without it again." (unknown)
------------------------------
Date: 13 Jun 1998 19:46:16 GMT
From: scott@softbase.com
Subject: Re: How do I limit the number of rows in sql query using Win32::ODBC?
Message-Id: <6luku8$3qe$2@mainsrv.main.nc.us>
Eric Pan (pan@part.net) wrote:
> I have an ODBC connection to MS SQL Server and would like to retrieve the
> first ten rows from the query result. Then, I would like be able to retrieve
> the next 10.
> Is this possible? Please help. Thanks.
SQL itself is based on sets, and doesn't support in principle or
ideology returning part of a set. You either get the whole query or
nothing. I don't believe any databases I've used support partial sets
of results.
Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more.
------------------------------
Date: 13 Jun 1998 21:52:00 GMT
From: web3151@charweb.org (Charlie Pratt)
Subject: how to honestly make money fast...
Message-Id: <897759733.475046@news.charweb.org>
------------------------------
Date: 13 Jun 1998 16:12:03 -0500
From: Tushar Samant <scribble@pobox.com>
Subject: Re: lambda fun in Perl
Message-Id: <6lupv3$cbc@tekka.wwa.com>
xah@shell13.ba.best.com writes:
>In Mathematica, one can write f[g[h]] as f@g@h or h//g//f.
Use the overload facility by the mighty Ilya Zakharevich:
(made idiotic for hours of fun)
package composable;
use overload
"*" => sub {
my($f,$g) = @_;
composable(sub {&$f(&$g(@_))});
},
"|" => sub {
my($f,$g) = @_;
composable(sub {&$g(&$f(@_))});
},
;
sub composable {
bless $_[0], "composable";
}
sub apply_to {
my @args = @_;
bless sub { @args }, "composable";
}
sub import {
*{(caller)[0]."::composable"} = \&composable;
*{(caller)[0]."::apply_to"} = \&apply_to;
}
#####
package main;
import composable;
#start playing
$f = composable (sub { $_[0]+2 });
$g = composable (sub { $_[0]*3 });
#you can now say
$h = $g * $f;
print &{ $h }(1);
#or put the print inside
$print = composable(sub {print @_});
&{ $print * $g * $f * $g * $f }(4);
#or do it left to right
&{
apply_to(4) | $f | $g | $f | $g | $print
};
------------------------------
Date: Sat, 13 Jun 1998 17:06:19 -0500
From: bseib@purdue.edu (Broc Seib)
Subject: Re: New module/pragma "enum.pm" (was "fields.pm")
Message-Id: <bseib-1306981706190001@beryl.cc.purdue.edu>
> Speaking of which, anyone know an efficient way to see if a number
> is a power of 2 without needing a lookup table?
Zenin,
This will work for your typical integers...
sub is_power_of_2 {
my $s = sprintf('%lx',shift); ## format the number into hex-dec string
$s =~ s/0//g; ## nuke all "0" that are in string
return 1 if ($s =~ /^[1248]$/); ## only one bit can be a "1" in the str
return 0; ## otherwise it is not a power of 2
}
Probably not the "most" efficient, but is readable and may do the job
depending on your application.
-b
Broc Seib, Purdue University Computing Center <bseib@purdue.edu>
------------------------------
Date: 13 Jun 1998 21:29:29 GMT
From: sutok@gmx.de (Florian Kuehnert)
Subject: Re: new to this - simple if statement question
Message-Id: <slrn6o5rpo.1f.sutok@babelon.in-brb.de>
Greg Andrews schrieb/wrote/icrivait/ha scritto:
>>>sorry this is probably a horribly simple question but.....
>>"I did not read the documentation and the FAQs".
>>>if ($state == California) {
>>s/==/eq/
>>"eq" compares strings, "==" tries to compare the numerical values of them.
>Most of the respondents also seem to have overlooked that the
>strings being compared against are barewords instead of being
>quoted.
Yup.
>...Or did I overlook that that's not a problem?
Camel Book, 2nd edition, page 42 (sic!) tells us:
"A word that has no other interpetation in the grammar will be treated
as if it were a quoted string. These are known as barewords. [...] If
you use the -w switch, perl will warn you about barewords."
-> barewords are just bad style, but perfectly legal.
Funnily, I get no warning with -w (taking Kessies example):
babelon(1) ~/develop/usenet> cat perl2.pl
#!/usr/bin/perl -w
$state = "California";
if ($state eq Arizona) {
print "Location:/newpublic/investors/az.html\n\n";
}
if ($state eq California) {
print "Location:/newpublic/investors/ca.html\n\n";
}
babelon(1) ~/develop/usenet> ./perl2.pl
Location:/newpublic/investors/ca.html
Hmmm... Why doesn't perl warn me?
Florian
--
"Warum kostet Linux nichts?
Warum gibt es kein einheitliches Frontend?"
-- aus "Wie starte ich einen Endlos-Thread?", Teil 1327
(Holger Schauer in dcolm)
------------------------------
Date: 13 Jun 1998 21:44:25 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: new to this - simple if statement question
Message-Id: <6lurrp$m89$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
sutok@gmx.de (Florian Kuehnert) writes:
:Hmmm... Why doesn't perl warn me?
Because there will never be a reserved word
with an initial capital letter.
--tom
--
"Most of what I've learned over the years has come from signatures."
--Larry Wall
------------------------------
Date: 13 Jun 1998 21:10:42 GMT
From: sutok@gmx.de (Florian Kuehnert)
Subject: Re: Perl editor debugger
Message-Id: <slrn6o5qmi.vpj.sutok@babelon.in-brb.de>
Patrick Lanphier schrieb/wrote/icrivait/ha scritto:
>What would you say is the best Perl editor/debugger available is
>commercially or free for Windows NT?
Editor? vim (http://www.vim.org) or XEmacs (http://www.xemacs.org). If
you like, even notepad.exe, depends on your personal taste.
Debugger? perl -d
Florian
--
"Warum kostet Linux nichts?
Warum gibt es kein einheitliches Frontend?"
-- aus "Wie starte ich einen Endlos-Thread?", Teil 1327
(Holger Schauer in dcolm)
------------------------------
Date: Sat, 13 Jun 1998 16:35:13 -0500
From: jfm@winternet.com (jfm)
Subject: Reference Arithmetic?
Message-Id: <jfm-1306981635140001@jfm.winternet.com>
The following gets a warning under 5.004_4.
#!/usr/bin/perl -w
$x = '012Q'; # or any non-numberic string
print 5 + $x, "\n";
'Argument "012Q" isn't numeric in add.' is very helpful.
I was surprised and disappointed to find that the following does
not get a warning.
#!/usr/bin/perl -w
$x = bless {}; # or any reference
print 5 + $x, "\n";
Rather, it just now gave me the result 166109801.
I skimmed the 600+ occurrences of "reference" in the pod directory
of 5.004_4 and didn't see any mention of references in numeric
context. Did I miss something?
I understand where the number comes from. But who cares?
Does anyone Intentionally use this, er, feature?
It sure would be nice to be warned when accidentally using it!
Jim
--
Jim Miner jfm@winternet.com
------------------------------
Date: 13 Jun 1998 21:41:48 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Reference Arithmetic?
Message-Id: <6lurms$knc$8@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
jfm@winternet.com (jfm) writes:
:
:I skimmed the 600+ occurrences of "reference" in the pod directory
:of 5.004_4 and didn't see any mention of references in numeric
:context. Did I miss something?
Yes, the footnote on p38 of the Camel not found in perlref. :-)
While strings and numbers are interchangeable for nearly all intents
and purposes, references are a bit different. They're strongly-typed,
uncastable
[FOOTNOTE: By which we mean that you can't, for instance,
convert a reference to an array into a reference to a hash.
References are not castable to other pointer types. However,
if you use a reference as a number or a string, you will get
a numeric or string value, which is guaranteed to retain the
uniqueness of the reference even though the "referenceness" of the
value is lost when the value is copied from the real reference.
You can compare such values or test whether they are defined.
But you can't do much else with the values, since there's no way
to convert numbers or strings into references. In general this
is not a problem, since Perl doesn't force you to do pointer
arithmetic--or even allow it.]
pointers with built-in reference-counting and destructor invocation.
You can use them to create complex data types, including user-defined
objects. But they're still scalars, for all that. See chapter 4
for more on references.
:I understand where the number comes from. But who cares?
:Does anyone Intentionally use this, er, feature?
:It sure would be nice to be warned when accidentally using it!
It's for using == and != on references for equality testing.
--tom
--
"So much mail, so little time."
------------------------------
Date: Sat, 13 Jun 1998 17:27:07 -0500
From: jfm@winternet.com (Jim Miner)
Subject: Re: Reference Arithmetic?
Message-Id: <jfm-1306981727080001@jfm.winternet.com>
In article <6lurms$knc$8@csnews.cs.colorado.edu>, Tom Christiansen wrote:
> In comp.lang.perl.misc,
> jfm@winternet.com (jfm) writes:
> :
> :I understand where the number comes from. But who cares?
> :Does anyone Intentionally use this, er, feature?
> :It sure would be nice to be warned when accidentally using it!
>
> It's for using == and != on references for equality testing.
Ah, now that's useful! Just checked, and it looks like == and != are
over 10 times faster than the brand I've been using (eq and ne)!
But is there any use for REF + NUM ?
And speaking of absurd things, does anyone else see humor in the warning
'Argument "0123z" isn't numeric in eq.'?
Jim
--
Jim Miner jfm@winternet.com
------------------------------
Date: Sat, 13 Jun 1998 15:12:17 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: gossamer@tertius.net.au
Subject: Re: refs and nested hashes
Message-Id: <3582F941.2575BD86@sirius.com>
Gossamer wrote:
>
> I'm 99% sure the answer to this is going to be one of those "kickself"
> things, but I've been figuring all night and I can't figure it. So,
> in desperation:
>
> (Sorry for the length, I'm being as short as I can).
>
> I have an object, $foo, and one of the variables I need the object to
> hold is reference, $bar, to a nested hash, %baz. %baz is tied to a
> database.
>
> I know bits about problems with tied hashes and nesting, and reading
> of the docs seems to indicate that MLDBM using GDBM_File and Storable
> works, so I'm using that. The require line, for reference, being "use
> MLDBM qw(GDBM_File Storable);"
>
> In the constructor, I have (amongst other things):
> my %baz;
> tie(%baz, 'MLDBM', $filename, O_RDWR | O_CREAT, 0644) ||
> die "Can't open \"$filename\": $!\n";
> $self->{"bar"} = \%baz;
>
> In the methods for the object, I've tried two ways of assigning values
> to the hash:
>
> ${$self->{"bar"}}{$fred}{$barney} = $quux;
>
> and:
>
> my %baz = %{$self->{"bar"}};
> $baz{$fred}{$barney} = $quux;
>
> Neither of them give errors (yes, I have -w and use strict :)) but
> neither of them work. The former sets ${$self->{"bar"}}{$fred} to {}
> (it didn't exist at all before). The latter sets %baz correctly but
> doesn't alter $self->{"bar"}.
The following code works for me.
my %baz;
dbmopen(%baz, 'baz', 0666) or die;
my $foo = { bar => \%baz };
$baz{three} = 3; # comment this line out and run it again
my $hash = $$foo{bar};
print $$hash{three};
HTH -- Jim Bowlin
------------------------------
Date: 13 Jun 1998 21:18:40 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: REVIEW: Advanced Perl Programming
Message-Id: <6luqbg$knc$2@csnews.cs.colorado.edu>
Advanced Perl Programming, by Sriram Srinivasan and published
by O'Reilly, is hereby given a rating of 4 Camels on the
http://www.perl.com/perl/critiques/ page.
Here's the mini-review by Graham Barr included there:
This book touches on many subjects which are not described by other
books and frequently have questions asked about. The book is written
as a step-by-step guide to many areas of perl and gradually takes
the reader from the basics to an advanced stage of programming.
I was a reviewer for many chapters in this book, and I must admit
that while I was reading these chapters I was already getting excited
about reading the rest of the book. When I saw the final book I
was impressed about the range of subjects that were covered.
--tom
--
"Unix has its weak points, but its file system is not one of them." -Chris Torek
------------------------------
Date: 13 Jun 1998 21:23:55 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: REVIEW: Effective Perl Programming
Message-Id: <6luqlb$knc$3@csnews.cs.colorado.edu>
Effective Perl Programming, by Joseph Hall (with Randal as kibitzer)
and published by Addison-Wesley, is hereby awarded a rating of 4 Camels
on the Camel Critiques page found at http://www.perl.com/perl/critiques/
Here's the mini-review by Graham Barr included there:
Effective Perl Programming
by Joseph N. Hall
with Randal L. Schwartz
(Reviewed by Graham Barr)
The book is very well written and has content which will be of
interest to the novice and the expert programmer. As well as giving a
short introduction to perl this book describes many common situations
and how they can effectively be solved using perl.
This book also describes other areas of perl. I was pleased to see the
chapter on debugging. Of all the other books that have been written
about perl, none of them have covered this topic particularly well.
The chapter on packages and modules will be of a great help to all
those who are new to perl and want to use modules from CPAN. It gives
a good introduction to what packages and modules are and how to get
them from CPAN, build, test and install them. This was followed
by another chapter on writing modules which I thought was a very
good guide for those who what to develop modules. This chapter ended
with details on how to submit to CPAN. Hopefully this will encourage
people to do just that.
The book also has what I thought was a thorough coverage of perl's
object model and finishes with some interesting perl one-liners
(which I am sure Randal had a lot of input to)
--tom
--
There is always a better way.
-- Thomas Edison
------------------------------
Date: 13 Jun 1998 21:31:23 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: REVIEW: MacPerl: Power and Ease
Message-Id: <6lur3b$knc$5@csnews.cs.colorado.edu>
MacPerl: Power and Easeby by Vicki Brown and Chris Nandor with foreword
by Matthias Neeracher and published by Prime Time Freeware, is hereby
awarded a rating of 4 Camels on the Camel Critiques page found at
http://www.perl.com/perl/critiques/
Here's the capsule review included there:
If you're on a Mac and want to learn Perl, you want this book. It's
specifically geared for you, written from an Apple perspective
throughout. The prose is clean, and the typesetting refreshingly
direct and easy to read, free of annoying artifacts too often found
in books mentioned lower down on this list.
I note that it is relatively expensive ($40), but worth it.
This is a tutorial book.
--tom
--
A factor of 3000 is actually significant --Andrew Hume
------------------------------
Date: 13 Jun 1998 22:20:05 GMT
From: c.c.eiftj@54.usenet.us.com (Rahul Dhesi)
Subject: Re: REVIEW: Perl CGI Programming - No Experience Required
Message-Id: <6lutul$9gv$1@samba.rahul.net>
In <6luiv7$f59$1@csnews.cs.colorado.edu> Tom Christiansen
<tchrist@mox.perl.com> writes:
>An array holds a list. This is easy. The bottom line has to do with
>wither there's an AV * sitting around somewhere. Don't think that too
>confusing for page six?
>You can't say ++128, and you can't say pop(1,2,3) either.
As you know, you can't say ++128 in C, but you can say 'i = 128' and
then i++, and that does not prevent us from considering both i and 128
to be integers.
Is it fair to say that if you can use a list as an lvalue, then the list
is an array, otherwise it's not? But that's more a distinction between
lvalues and rvalues, than between arrays and lists. Both seem to me
to be ordered sequences of items.
I can assure you that I searched 'Programming Perl' quite extensively
and found no other distinction between arrays and lists.
--
Rahul Dhesi <dhesi@spams.r.us.com>
------------------------------
Date: 13 Jun 1998 22:25:19 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: REVIEW: Perl CGI Programming - No Experience Required
Message-Id: <6luu8f$p9f$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
c.c.eiftj@54.usenet.us.com (Rahul Dhesi) writes:
:Is it fair to say that if you can use a list as an lvalue, then the list
:is an array, otherwise it's not? But that's more a distinction between
:lvalues and rvalues, than between arrays and lists. Both seem to me
:to be ordered sequences of items.
No. Behold a list as an lvalue:
($a, $b, $c) = fred();
And I don't know that you would call the argument to pop in
lvalue position. In fact, I know you can't.
pop(@a = @b);
isn't legal.
An array has an AV associated with it. A list is merely
SVs sitting on a stack somewhere.
I wish I understood why no one understands this.
Did you read the Perl Wizard Quiz?
--tom
--
Emacs is a fine editor, but I still prefer vi. -me
------------------------------
Date: 13 Jun 1998 21:37:16 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: REVIEW: Perl5 for Dummies
Message-Id: <6lurec$knc$7@csnews.cs.colorado.edu>
Perl5 for Dummies, by Paul E Hoffman, and published by IDG Books, is
hereby awarded a rating of 2 Camels on the Camel Critiques page found
at http://www.perl.com/perl/critiques/
Here's the capule review included there:
Perl5 For Dummies
by Paul E. Hoffman
Barely achieving its two camels, this book is not only made for
dummies, it's guaranteed to keep you one. But hey, if you like to
have your competence and intelligence insulted everywhere from the
title to the text, then this is the book for you. This book can't
figure out the difference between an array and a list, thinks there's
a \v escape, screws up the CGI form decoding (why does everyone
do this?), doesn't understand the difference between programs and
libraries, massively screws up quoting on Win32 paths, spreads FUD
about $_, omits $!, and relegates the true heart and soul of Perl,
pattern matching and hashes, way to the end, in chapters 14 and
15 respectively. So, it's technically screwed up, has hard-to-read
style, does nearly everything the hard way, hides the good stuff
where you won't find it, and likes to put its reader down. Even more
so, it revels in showing disrespect to anyone who seems to enjoy
or be good at programming. Perhaps this makes dummies feel good.
Its effect on the rest of us can be seen in this review.
I guess this just goes to show you that the old adage about avoiding
books with numbers in their titles is right.
--
QVIDQVID LATINE DICTVM SIT PROFVNDVM VIDITVR
------------------------------
Date: 13 Jun 1998 21:27:44 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: REVIEW: Perl5 Interactive
Message-Id: <6luqsg$knc$4@csnews.cs.colorado.edu>
Perl5 Interactive (2nd Edition), by Jon Orwant and published by Waite,
is hereby awarded a rating of 4 Camels on the Camel Critiques page found
at http://www.perl.com/perl/critiques/
Here's the capsule review included there:
Perl5 Interactive Course [2nd edition]
by Jon Orwant
Now in its second edition, this book has finally lived up to what
it was supposed to be -- technically. It's still too heavy to
tote conveniently, and the typesetting is lamentably far too busy
for my tastes, but this is the publisher's standard -- and fault.
It has been cleaned up remarkably since its botched first printing.
Written by the editor and publisher of The Perl Journal, this book
is technically competant and replete with good examples.
--tom
--
"Everything you said about Plan 9 is wrong"
-- Rob Pike, letting a speaker have it
------------------------------
Date: 13 Jun 1998 21:34:03 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: REVIEW: Perl: The Programmer's Companion
Message-Id: <6lur8b$knc$6@csnews.cs.colorado.edu>
Perl: The Programmers Companion, by Nigel Chapman and published by Jon
Wiley and Sons, is hereby awarded the coveted rating of 5 Camels on the
Camel Critiques page found at http://www.perl.com/perl/critiques/
Here's the review included there:
Review of Perl: The Programmer's Companion
Title: Perl: The Programmer's Companion
ISBN 0 471 97563 X
Author: Nigel Chapman
Publisher: John Wiley and Sons, Ltd.
Pages: 268pp + xii
Size: 9 1/8" W 7 1/2" W 3/4"
Price: US $29.95
Rating: 5 out of 5 possible camels -- Terrific!
------------------------------------------------------------------------
Capsule Review
This small, delightful book published by John Wiley and Sons is just book
for the accomplished programmer who wants to learn Perl. It is not only free
of technical errors, it is a pleasure to read. You will laugh a lot. This is
not a book about Unix, about systems administration, or about the web.
Rather, it is about Perl as a serious programming langauge.
------------------------------------------------------------------------
Longer Description
I give it five camels. Yup, that's what I said. I may be waxing overly
ecstatic. I've only spot checked it so far, but with delight. But it sure
looks terrific. Everything I looked at was right on the money technically,
even scoping, which no one ever ever gets right. It's a tiny, no frills, no
crap book. With a touch of whimsey.
Here are excerpts:
The aim of this book is to introduce programmers to Perl, and Perl
to programmers. It offers an invitation to look at a programming
language that is different from the everyday ones, and can save
you an awful lot of time and programming effort. [...]
Perl: The Programmer's Companion is not a tutorial on computer
programming. It is a book aimed at people who already know
something--possibly quite a lot--about programming, and at least a
little about computer science. [...] I also assume that you enjoy
programming computers, even if you find that these days you don't
have much time for the enjoyable bits.
Perl: The Programmer's Companion differs from most other offerings
on the same subject by being written by someone who doesn't mind
being described as a computer scientist. It is customary for
computer scientists to treat Perl as an aberration and to ignore
it as much as possible. Perl enthusiasts, for their part, tend to
treat computer scientists with scorn, and accuse them of being
detached from the real world, and generally no fun.
I hope that this book may do something to reconcile the two
factions, by showing that Perl is a worthy object of anyone's
attention, and that a broader computer science viewpoint can
provide some context for understanding and making judgements about
Perl.
There appear to be two views of what Perl is. One school of
thought, based on the fact that Perl was born to Unix, inherits
many features from the Unix shells and tools like sed and awk, and
has a high level of support for interacting with that operating
system built in to it, holds that it is primarily a Unix system
administration tool.
The other school of thought holds that Perl is a general-purpose
programming languages, whose slightly unusual nature should not
prevent it being taken as seriously as C++, Modula-3, or Java.
This book is based on the second view.
The epilogue is really worth raving about. I can't repro it here. It's a
coffee shop dialogue on theory versus practice, and what we programmers have
been doing wrong a long time. I wonder whether Larry wrote it
pseudonymously. :-)
The book is written by a fellow from in the UK. Malcolm was the technical
reviewer. The English is well-formed, perhaps even literate; in fact, his
level of prose is going to leave the Perl for Dummies and CGI
wannaprogrammerbees crying and confused. :-)
--tom
--
I know it's weird, but it does make it easier to write poetry in perl. :-)
--Larry Wall in <7865@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: 13 Jun 1998 22:08:42 GMT
From: fascist@posix.org
Subject: Re: splitting config file
Message-Id: <6lut9a$epp$1@eve.enteract.com>
Bingo. Once you gave me that, I played around with it for a
while and now it takes 15 or so lines instead of the ugly 100
I had before. Thanks!
Jonathan Feinberg <jdf@pobox.com> wrote:
> fascist@posix.org writes:
> > ok, I'd like to be able to parse the file in a specific way
> > that I could perform a specific set of operations on each
> > <blah>...</blah> chunk independently.
> This might give you an idea or two. You might also consider using one
> of the existing modules for parsing SGML.
> #!//c/perl/bin/perl -w
> use strict;
> use Data::Dumper;
> my @blahs = ();
> my %current_blah = ();;
> while (<DATA>) {
> chomp;
> next if /^\s*$/;
> %current_blah = (), next if m!<blah>!i;
> push(@blahs, {%current_blah}), next if m!</blah>!i;
> /^([^:]+):\s*(.+)$/; #($1, $2) = split /:\s+*/
> $current_blah{$1} = $2;
> }
> print Dumper(\@blahs);
> __DATA__
> <blah>
> bleh: 1
> frob: biscuit
> </blah>
> <blah>
> bleh: 2
> frob: cornpone
> </blah>
> --
> Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
> http://pobox.com/~jdf/
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 2867
**************************************