[9259] in Perl-Users-Digest
Perl-Users Digest, Issue: 2854 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 12 11:17:19 1998
Date: Fri, 12 Jun 98 08:00:35 -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 Fri, 12 Jun 1998 Volume: 8 Number: 2854
Today's topics:
Re: [META] hypersensitivity (Hunter Johnson)
Re: CGI - Posting to newsgroups, how? (Alex Kovalenko)
Re: chopping leading spaces <postmaster@castleamber.com>
Re: Code Generator using Perl (Mike Stok)
Re: Code Generator using Perl <postmaster@castleamber.com>
Re: Compile Perl5.4 on AIX 4.2 with Gcc 2.8.0 <Walter.Harms@Informatik.Uni-Oldenburg.DE>
diff-like utility in Perl? <foosejm@bp.com>
Re: diff-like utility in Perl? <tchrist@mox.perl.com>
Re: Eval questions. <postmaster@castleamber.com>
Re: Eval questions. <postmaster@castleamber.com>
Re: ftp'ing within a perl script <blaer@spamfree.azu.nl>
Had a small AHA on objects <quednauf@nortel.co.uk>
Re: Have we got a good free Perl manual? <zkessin@lhr-sys.dhl.com>
Re: How can I write to specific line ? (M.J.T. Guy)
Re: localtime() and y2k (Stefan Scholl)
Mailing checkbox info from form with perl cgi - help!!! <tim.swallow@mta.jenson.com>
Re: Mailing checkbox info from form with perl cgi - hel <quednauf@nortel.co.uk>
Re: Making object accessors efficent (Kevin Reid)
Re: Making object accessors efficent <tchrist@mox.perl.com>
NEED PERL SCRIPT WRITTEN <ppdc@ix.netcom.com>
NEED PERL SCRIPTING <ppdc@ix.netcom.com>
Re: NEED PERL SCRIPTING (Andy Lester)
Re: Perl5.004_04 Win32 build problems <smithr@lexma.meitech.com>
prob compil perl5.004_04 under SCO unix with cc <bill@TechServSys.com>
Re: Stages in a pipeline <jdf@pobox.com>
Subs and References and implicit arguments <demaille@inf.enst.fr>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 12 Jun 1998 14:12:11 GMT
From: jhunterj@lexis-nexis.com (Hunter Johnson)
Subject: Re: [META] hypersensitivity
Message-Id: <6lrcvr$irc@mailgate.lexis-nexis.com>
In article <6lq3c8$clc@nntp02.primenet.com>,
Gary L. Burnore <gburnore@primenet.com> wrote:
> On 11 Jun 1998 18:37:59 GMT in article <6lp867$s25$1@csnews.cs.colorado.edu>, Tom Christiansen <tchrist@mox.perl.com> wrote:
>> The problem, in a nutshell, is that whenever we point out a simple
>> and obvious--sometimes even elegant--solution, one which inevitably
>> involves gluing together other tools (which, I must point out, was
>> what Perl *designed* for), we get back nothing but flames from
>> those who cannot help themselves.
> No, the problem in a nutshell is not answering a perl question by
> complaining about an os. The problem in a nutshell is you.
He answered the perl question; the answer just happened to involve
resources in addition to perl. The complaint about an os didn't come
until complaints about the universality of the solution.
> If you don't want to answer a question because of the OS someone
> uses, the shut the f*** up and let someone else answer it. How hard
> can that be? Clue: It's not hard, you'd just not have any fun at
> it.
Who was going to answer it? I scanned through DejaNews looking for
the answers you've provided, and didn't find anything other than this
post. (I myself am certainly not as prolific an answerer as Tom, et
al., either, but that makes me appreciate their presence here.)
Many newsreaders will let you tweak your newsreading experience by
junking certain posters and flagging others. I use this to seek out
posts by (in no particular order) Tom C., Randal, Tom P., Abigail, and
Craig, but it could also be used to weed them out, if their attitudes
irritate.
Perhaps they're only bad in large quantities, and would be easier to
take in moderation. :-)
Hunter
--
J. Hunter Johnson | "A little consistent wholesome modeling and
jhunterj@lexis-nexis.com | costly servanthood are worth millions of
(937) 865-6800 x5385 | true words harshly spoken."
Lexis-Nexis, Dayton, OH | -- Ron Sider
------------------------------
Date: Fri, 12 Jun 1998 16:39:55 GMT
From: techsoft@abcpages.com (Alex Kovalenko)
Subject: Re: CGI - Posting to newsgroups, how?
Message-Id: <358159c8.45311711@news.ica.net>
sorry my e-mail is screwed.. the real one is techsoft@abcpages.com
sorry
On 11 Jun 98 22:56:01 GMT, wrs@mailcity.com wrote:
>Hi there! I am looking for a way to post
>messages to newsgroups from web. Something
>like DejaNews.
>But I want to implement WebBBS in order that
>as someone posts message on it, it also
>posts on several newsgroup.
>
>Any ideas how it can be done in Perl or C?
>
>I am willing to pay as long as price
>is reasonable.
>
>Regards,
>Alex.
>
>http://www.philex.net/websub/
>
>
Sincerely,
Alex.
WRS programmer
http://www.philex.net/websub/
INCREASE TRAFFIC TO YOUR SITE NOW!
------------------------------
Date: 12 Jun 1998 13:20:11 GMT
From: "John Bokma" <postmaster@castleamber.com>
Subject: Re: chopping leading spaces
Message-Id: <01bd9605$27cea960$02521e0a@tschai>
Phil Taylor <phil@ackltd.demon.co.uk> wrote in article
<35804f17.8960454@news.demon.co.uk>...
> How do you chop off leading spaces in a string?
$str =~ s/^\s+//;
> How do you test for a string containing spaces as opposed to being
> empty?
print "Empty" if $str eq "";
print "Contains spaces" if $str =~ /\s+/; # white spaces that is, otherwise
use / +/
John
--
------------------------------------------------------------------
C A S T L E A M B E R Software Development (Java/Perl/C/CGI)
http://www.castleamber.com/ john@castleamber.com
NEW: http://www.binaries.org/ Guide to Program Binaries & Pictures
------------------------------
Date: 12 Jun 1998 13:08:33 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Code Generator using Perl
Message-Id: <6lr98h$e6u@news-central.tiac.net>
In article <6lpha8$i4n$1@heliodor.xara.net>,
Lance Whittaker <lancew@globalnet.uk.co> wrote:
>I have posted this message at alt.perl but maybe this group could assist me.
>I am a professional software engineer who has been given the enviable task
>of writing a code generator which is designed to produce code which has a
>syntax simular to C. I have been advised by a friend that using Perl with C
>wrappers would be a good method of quickly getting the job done, I am new to
>the world of Perl I am not sure whether this rather sweeping statement is
>valid. I believe that Perl's string handling capability is superior to C but
>have yet to be convinced. Does anyone have any comments, suggestions or
>links to www pages where someone has written a C (or basic) code generator
>in Perl????
Perl's automatic memory management and dynamically sized data structures
make using it as a rapid prototyping language very easy (once you've come
to terms with Perl's quirks). Once a perl script has been parsed and
turned into bytecode perl runs quite fast, frequently I end up using code
which was intended for a quick prototype or proof of concept much longer
than I expected to.
http://lcs.www.media.mit.edu/groups/el/projects/spacewar/sources/
Might be an interesting link for you to follow, an assembler written in a
perl4 style is there - current perl versions have more features to help
programming in the large.
http://netside.simplenet.com/pp/technical/mac/machack.html
might be interesting too.
Perl gives you convenience at the cost of memory and speed, but it's
possible to control the trade offs, and if there are core routines you
already have in C libraries then you can wrap the libraries relatively
easily.
You might want to go and visit CPAN, the comprehensive perl archive
network, which is a repository of modules which can be added into a perl
distribution. One module which might be useful to you, if you're reading
some source from a file, is Parse::RecDescent.
One place to find CPAN is a link on http://www.perl.com/ Tom Christiansen
has written a multiplexor which should point you at a nearby mirror site
(based on domain your address maps to).
As of version 5 perl has language constructs to allow simple construction
of data structures, this is documented in the perlol (lists of lists) and
perldsc (data structures cookbook) man pages. The data structures all
make use of another perl 5 feature, references, whose documentation is in
the perlref man page. If you're used to working with objects as a way of
encapsulating your data then perl has a mechanism for allowing you to do
OO programming.
Recent perl distributions have a program called perldoc included which
allows you to read the docs on-line
perldoc perlfaq
gets you the overview of questions which many people might ask about perl
and their answers.
perldoc perllol
will get you the perlLoL - Manipulating Lists of Lists in Perl page etc.
With these features you can do most of the tree construction and walking
you might do in C but with much more flexibility.
Perl's major "problem" is that there are many ways to skin a cat and you
can do most (if not all) of them in perl (with varying degrees of ease :-)
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: 12 Jun 1998 13:22:10 GMT
From: "John Bokma" <postmaster@castleamber.com>
Subject: Re: Code Generator using Perl
Message-Id: <01bd9605$70202680$02521e0a@tschai>
Lance Whittaker <lancew@globalnet.uk.co> wrote in article
<6lpha8$i4n$1@heliodor.xara.net>...
> I have posted this message at alt.perl but maybe this group could assist
me.
> I am a professional software engineer who has been given the enviable
task
> of writing a code generator which is designed to produce code which has a
> syntax simular to C. I have been advised by a friend that using Perl with
C
> wrappers would be a good method of quickly getting the job done, I am new
to
> the world of Perl I am not sure whether this rather sweeping statement is
> valid. I believe that Perl's string handling capability is superior to C
but
> have yet to be convinced. Does anyone have any comments, suggestions or
> links to www pages where someone has written a C (or basic) code
generator
> in Perl????
Well, http://www.binaries.org/ and http://www.caiw.nl/~jbokma are both
generated
using Perl. I've also written documentation generators and code generators
with
Perl. I think that Perl is *the* language for jobs like this (and not C/C++
or Java)
John
--
------------------------------------------------------------------
C A S T L E A M B E R Software Development (Java/Perl/C/CGI)
http://www.castleamber.com/ john@castleamber.com
NEW: http://www.binaries.org/ Guide to Program Binaries & Pictures
------------------------------
Date: 12 Jun 1998 13:07:51 GMT
From: "Walter Harms" <Walter.Harms@Informatik.Uni-Oldenburg.DE>
Subject: Re: Compile Perl5.4 on AIX 4.2 with Gcc 2.8.0
Message-Id: <6lr977$o3i@news.Informatik.Uni-Oldenburg.DE>
"H.Merijn Brand" <PROCURA_BV@CompuServe.com> writes:
>I got it running perfectly with AIX's cc, could send you my "perl -V"
>if you like.
>zhang yao wrote:
>>
>> If you are refering perl v5.00404, yes. I compiled it using gcc2.8.0 on aix
>> v4.2.1.0
>> I could email you the perl -V result if that is what you want
>Yes, please!
>Got the same problems you described with gcc 2.8.1, so I'm very
>interested in your gcc version of `perl -V`
>thnx
i had also some strange problems with configure. using ./Configure asks some
question you can answer by hand and worked for me. (using gcc2.7.2)
walter
--
-----
'Real programmers confuse christmas and halloween, |
because Dec 25 = Oct 31.'
-----
------------------------------
Date: 12 Jun 1998 12:33:08 GMT
From: "Joe Foose" <foosejm@bp.com>
Subject: diff-like utility in Perl?
Message-Id: <01bd95fe$77930ec0$3f8a63a1@amervw29436.clv.am.bp.com>
Does anybody know if there is a Perl function which compares two files or
strings and returns output similar to Unix's diff command?
------------------------------
Date: 12 Jun 1998 13:06:37 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: diff-like utility in Perl?
Message-Id: <6lr94t$4t3$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
"Joe Foose" <foosejm@bp.com> writes:
:Does anybody know if there is a Perl function which compares two files or
:strings and returns output similar to Unix's diff command?
$delta= `diff f1 f2`;
Or are we supposed to reinvent this wheel, too?
--tom
--
"...we will have peace, when you and all your works have perished--and
the works of your dark master to whom you would deliver us. You are a
liar, Saruman, and a corrupter of men's hearts." --Larry Wall in perl/taint.c, citing Theoden from LOTR
------------------------------
Date: 12 Jun 1998 13:26:28 GMT
From: "John Bokma" <postmaster@castleamber.com>
Subject: Re: Eval questions.
Message-Id: <01bd9606$09b3f240$02521e0a@tschai>
Charles DeRykus <ced@bcstec.ca.boeing.com> wrote in article
<EuEJ60.Cqz@news.boeing.com>...
> In article <01bd955c$6c1e5920$02521e0a@tschai>,
> John Bokma <john@castleamber.com> wrote:
[snip]
> That's totally disingenuous. Here's a direct quote from
> your post:
>
> I have this already working using:
>
> s/\\([^\\]+\\/ eval $1 ./ meg;"
>
>
> That has 2 syntax errors which I cited in an attempt to
> help. If you're going to post, please ensure that you
> post accurately.
>
> I won't waste any futher bandwidth on this subject.
I am very happy now, since you can't answer the original
question. From the original posting it must have been clear
that it where tiny examples. As you stated, it won't even
compile, so how can I have it working? The only answer
is, I typed from memory. (Or I use a special Perl version
which can guess.). It is wasting bandwith pointing out
spelling errors and obvious typos that have nothing to
do with the problem at hand.
John
--
------------------------------------------------------------------
C A S T L E A M B E R Software Development (Java/Perl/C/CGI)
http://www.castleamber.com/ john@castleamber.com
NEW: http://www.binaries.org/ Guide to Program Binaries & Pictures
------------------------------
Date: 12 Jun 1998 13:27:57 GMT
From: "John Bokma" <postmaster@castleamber.com>
Subject: Re: Eval questions.
Message-Id: <01bd9606$3ef73340$02521e0a@tschai>
John Bokma <postmaster@castleamber.com> wrote in article
<01bd955c$c0740240$02521e0a@tschai>...
>
>
> Kevin Reid <kpreid@ibm.net> wrote in article
> <1dad5yb.xiyxyp17dx0juN@slip166-72-108-72.ny.us.ibm.net>...
> > John Bokma <postmaster@castleamber.com> wrote:
> >
>
> <snip>
>
> > Try this:
> >
> > s/\\([^\\]+)\\/my $temp = eval $1; $@ ? $@ : $temp/meg;
>
> I will. I've tried several other tricks (like enclosing everything
> with eval { .... };). But this one "feels" good.
But it doesn't work... Somehow the program bombs out.
So the question is:
How can I trap errors in a multi-line string when using eval?
John
--
------------------------------------------------------------------
C A S T L E A M B E R Software Development (Java/Perl/C/CGI)
http://www.castleamber.com/ john@castleamber.com
NEW: http://www.binaries.org/ Guide to Program Binaries & Pictures
------------------------------
Date: Fri, 12 Jun 1998 15:14:57 +0200
From: Bart <blaer@spamfree.azu.nl>
Subject: Re: ftp'ing within a perl script
Message-Id: <358129D1.15DF@spamfree.azu.nl>
Dave Wright wrote:
>
> I am writing a Perl script that must run on both nt and solaris.
> The script needs to transfer files via ftp. I tried code such as
> the following sample to automate the ftp transfer:
>
> <snip>
> open(FD,"| ftp") or die "cannot start ftp session";
> print FD "open samplehostname\n";
> print FD "guest\n";
> print FD "guestpassword\n";
> print FD "put filename\n";
> close(FD);
> <snip>
>
> but the script hangs when ftp prompts for the password. The password
> supplied via the Perl script is apparently not accepted by ftp.
>
> Is there a way to do what I want? I guess this is really not
> a Perl problem but perhaps a limitation of ftp?
Try this
open(FD, "| ftp -n -i samplehostname") or die "cannot start ftp";
print FD "user guest guestpassword";
print FD "put filename";
print FD "quit";
close(FD);
> Thanks in advance,
> Dave
> dhwright@mindspring.com
--
You're welcome,
bart
------------------------------
Date: Fri, 12 Jun 1998 13:58:17 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Had a small AHA on objects
Message-Id: <358125E9.AE583257@nortel.co.uk>
Silly piece of experimental code:
sub openthat {
print "I know you, and I know",$hashref->{DIR}," and I am known by many other
things...";
}
$hashref = {
DIR => "/u/quednauf/temp"
};
bless($hashref);
$hashref->openthat;
So all about an object is really that it miraculously knows everything what is
going on inside its package (which I suppose it's main:: as default, as no
package has been explicitly specified here), as I can call openthat through the
$hashref. COOL! So that's about the namespace stuff, nice. But I would like to
know how I could get something like that:
$hasref->openthat( -DIR =>"/u/quednauf/temp");
and then getting exactly the same output as above. One does that in CGI.pm, I
looked inside the module and understood sort of 0-20%. Which leads directly to
my next question: Can someone recommend me a module I can look at, which is
relatively straightforward to grasp, but shows good programming techniques in
Perl?
PS
If answering, please also send mail, as I am gone over the weekend, and the
messages expire damn quick on our server...Cheers
--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________
------------------------------
Date: 12 Jun 1998 14:26:54 +0100
From: Zachary Kessin <zkessin@lhr-sys.dhl.com>
Subject: Re: Have we got a good free Perl manual?
Message-Id: <m3vhq6kaxt.fsf@pc-hhu-52.lhr-sys.dhl.com>
David Kastrup <dak@mailhost.neuroinformatik.ruhr-uni-bochum.de> writes:
>
> > > What they can't be is part of the free software
> > > community.
> >
> > I would argue that the O'Reilly Perl books and TPJ are in fact very much a
> > part of the free software community (w.r.t. Perl) as they document a piece
> > of free software.
>
> They are not part of the free software community because nothing free
> ever comes back from them. Documentation by them is as much part of
> the free software community as dandruff is part of my body: initially
> very close, it nevertheless does not contribute anything to any living
> cells of me and will eventually in its unchanged state fall off. It
> is associated to free software, but is not part of the community.
>
> > Does not the free software community extend far beyond
> > the simple set of things which are free?
>
> Nope. Free software community is the people working on free
> software. A bar is not part of the mining industry even when it keeps
> alive by being visited by miners.
>
>
O'Reilly's Boos are very much part of the Free software community,
They are written by people who use free software for people who use
Free Software. O'Reilly is very much a part of the Free software
industry as many of us who have been using Perl and other free
products (such as emacs) learned them from an O'Reilly book. I Keep 3
O'Reilly Perl books handy (and 3 or 4 of the Java books too). (Camel,
Advanced and the RegExp book, FYI). As for free stuff from ORA I would
point out that they *PAY* Larry Wall to work on Perl and they promote
Free software in many forms which has a carry on result that benefits
us all. I would also say that Perl's Free status is not why I use it,
I use it because it works well.
There seems to be a decicive group out there who are just dont like
they idea of someone making money.
--Zach
I dont have any connection with O'Reilly other than owning a lot of
their books.
------------------------------
Date: 12 Jun 1998 12:56:22 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: How can I write to specific line ?
Message-Id: <6lr8hm$eke$1@pegasus.csx.cam.ac.uk>
Justin Vallon <vallon@bear.com> wrote:
>Or, the ever popular:
>
>perl5 -pen '$_ = "replace\n" if $. == 2' < xyz
Make that
perl5 -pe '$_ = "replace\n" if $. == 2' < xyz
since your version will execute the program "n". And -p implies -n
in any case.
Mike Guy
------------------------------
Date: 12 Jun 1998 12:35:02 GMT
From: stesch@parsec.inka.de (Stefan Scholl)
Subject: Re: localtime() and y2k
Message-Id: <slrn6o283m.lml.stesch@parsec.inka.de>
On 8 Jun 98 22:36:39 GMT, Chris <chris@bcadventure.com> wrote:
> The perl script command:
> localtime(time)
>
> Will give a 2 digit date, several small scripts I have seen in this newsgroup
^^^^^^^^^^^^ wrong!
> simply add 1900 to the year and say it is y2k compliant.
> Am I missing something here?
Perhaps you miss the man-file? :-)
[...]
0..6 with sunday as day 0. Also, $year is the
number of years since 1900, that is, $year is 123
in year 2023.
[...]
localtime() gives you the years sind 1900, not a 2 digit date.
MfG
Stefan
------------------------------
Date: Fri, 12 Jun 1998 11:34:38 +0100
From: "Tim Swallow" <tim.swallow@mta.jenson.com>
Subject: Mailing checkbox info from form with perl cgi - help!!!
Message-Id: <897656678.21233.0.nnrp-04.c1ed5aeb@news.demon.co.uk>
Hi,
I've just started to look at using Perl CGI scripts on my web page to mail
the contents of a form back to me.
My form has some check boxes in and I am having problems mailing the
selected checkboxex info. back to me.
The checkboxes are defined in my HTML code as follows:
<LI> <INPUT TYPE="checkbox" NAME="information" VALUE="Box1">Box1.
<LI> <INPUT TYPE="checkbox" NAME="information" VALUE="Box2">Box2.
<LI> <INPUT TYPE="checkbox" NAME="information" VALUE="Box3">Box3
Using the following piece of code in my perl script, I can print the form
output including checked checkboxes to an html page:
@pairs = split(/&/, $buffer);
foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
print "Setting $name to $value<P>";
$FORM{$name} = $value;
}
.
I am having a problems seperating the checked checkbox info when mailing the
form output back to me. The code I am using in my form to try to do this is
as follows:
@INFORMATIONS = split("\0",$FORM{'information'});
open (MAIL, "|$mailprog $recipient") || die "Can't open $mailprog!\n";
print MAIL "Reply-to: $FORM{'username'} ($FORM{'realname'})\n";
print MAIL "Subject: WWW comments (Forms submission)\n\n";
print MAIL "$FORM{'username'} ($FORM{'realname'}) sent the following\n";
print MAIL
"------------------------------------------------------------\n";
print MAIL "$FORM{'name'}\n";
print MAIL "$FORM{'phone'}\n";
foreach $INFORMATION (@INFORMATIONS) {print MAIL "$INFORMATION \n";}
print MAIL
"\n------------------------------------------------------------\n";
print MAIL "Server protocol: $ENV{'SERVER_PROTOCOL'}\n";
print MAIL "Remote host: $ENV{'REMOTE_HOST'}\n";
print MAIL "Remote IP address: $ENV{'REMOTE_ADDR'}\n";
close (MAIL);
Instead of listing each checked checkbox being listed, only the last one
checked is listed.
I'm not sure if i am making a mistake in the following lines from the code
above..
@INFORMATIONS = split("\0",$FORM{'information'});
foreach $INFORMATION (@INFORMATIONS) {print MAIL "$INFORMATION \n";}
Please help...
Cheers
Tim
------------------------------
Date: Fri, 12 Jun 1998 15:00:48 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Mailing checkbox info from form with perl cgi - help!!!
Message-Id: <35813490.1C859783@nortel.co.uk>
Tim Swallow wrote:
> The checkboxes are defined in my HTML code as follows:
>
> <LI> <INPUT TYPE="checkbox" NAME="information" VALUE="Box1">Box1.
> <LI> <INPUT TYPE="checkbox" NAME="information" VALUE="Box2">Box2.
> <LI> <INPUT TYPE="checkbox" NAME="information" VALUE="Box3">Box3
>
> @INFORMATIONS = split("\0",$FORM{'information'});
...
> foreach $INFORMATION (@INFORMATIONS) {print MAIL "$INFORMATION \n";}
...
What you get back from the form is always of the form name=value. So if you have
the third checkbox checked, provided you already did proper splitting when
extracting the params, then $form{'information'} will be "Box3". This is your
selected checkbox. No array, no nothing. Just a value.
-> print MAIL $form{'information'},"\n";
Hope it's true, hope it helps.
--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________
------------------------------
Date: Fri, 12 Jun 1998 10:05:48 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: Making object accessors efficent
Message-Id: <1dai2b1.1rab65ff4f8muN@slip166-72-108-55.ny.us.ibm.net>
Mark Westling <westling@concept5.com> wrote:
> I'm implementing objects the traditional way, via hashes, and I'm trying to
> find a more efficient way of creating accessor methods. I'd really, really
> like to use accessor functions instead of touching the hash directly, but
> when I write
> package MyObj;
> sub obj_field {
> my $this = shift;
> @_ ? $this->{obj_field} = shift : $this->{obj_field};
> },
> $x = $obj->obj_field() runs about eight times slower than $x =
> $obj->{obj_field}. With this much penalty, I discovered that don't feel as
> nearly as guilty as I thought I would going right to the hash. (Run times
> are cut from 60 minutes to 30 minutes.) Is there any way around this?
You can speed it up by putting the setting into a separate routine:
sub obj_field ($) {$_[0]->{obj_field}}
sub set_obj_field ($;$) {$_[0]->{obj_field} = $_[1]}
Before someone points it out, I do know that the prototypes don't do
anything for methods. I just find them helpful to see what kind of
parameters it takes.
Here's the Benchmark program and results:
#!perl -w
use Benchmark;
$obj = bless {obj_field => "!!"};
timethese(100000, {
'yours' => sub { $x = $obj->y_obj_field},
'mine' => sub { $x = $obj->m_obj_field},
});
sub y_obj_field {
my $this = shift;
@_ ? $this->{obj_field} = shift : $this->{obj_field};
}
sub m_obj_field ($) {$_[0]->{obj_field}}
__END__
Benchmark: timing 100000 iterations of mine, yours...
mine: 4 secs ( 5.33 usr 0.00 sys = 5.33 cpu)
yours: 8 secs ( 6.72 usr 0.00 sys = 6.72 cpu)
--
Kevin Reid. | Macintosh.
"I'm me." | Think different.
------------------------------
Date: 12 Jun 1998 14:14:23 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Making object accessors efficent
Message-Id: <6lrd3v$94j$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
kpreid@ibm.net (Kevin Reid) writes:
:You can speed it up by putting the setting into a separate routine:
:
:sub obj_field ($) {$_[0]->{obj_field}}
:sub set_obj_field ($;$) {$_[0]->{obj_field} = $_[1]}
:
:Before someone points it out, I do know that the prototypes don't do
:anything for methods. I just find them helpful to see what kind of
:parameters it takes.
They don't do much for functions, either. It's not as though they
actually tell you what kind of parameters they take, as you say.
Consider:
sub getlen($) { length $_[0] }
getlen(23);
getlen($var);
getlen(@ARGV);
getlen(%ENV);
getlen(&getlen);
getlen(());
Notice how all those are allowed. Not really what I would
call helpful to see what kind of parameters the function takes.
--tom
--
Like Dennis' love note about rk05s, early Berkeley tapes cane with a
suggestion from Bill Joy that "this is a tape of bits," meaning there was no
guarantee of anything, and that complaints should be directed to /dev/null.
--Andy Tannenbaum, "Politics of UNIX," Washington, DC USENIX Conference, 1984
------------------------------
Date: Fri, 12 Jun 1998 09:37:43 -0400
From: "ALAN FEILER" <ppdc@ix.netcom.com>
Subject: NEED PERL SCRIPT WRITTEN
Message-Id: <6lrac2$t6b@dfw-ixnews9.ix.netcom.com>
not certain on pay but will consider workout.
I have new startup application require perl scripting to
automate thru unix server orders.
1. script to create client page,split with vendor reply
2. scrpt to validate credit card payment, and report.
3. script to store orders in unique bin and summarize quantiity ,
then move bin contents to appropriate vendor.
Please email me your phone # so we can tall further about
implementation.
Thanks,
Alan Feiler
------------------------------
Date: Fri, 12 Jun 1998 09:40:10 -0400
From: "ALAN FEILER" <ppdc@ix.netcom.com>
Subject: NEED PERL SCRIPTING
Message-Id: <6lragl$t8u@dfw-ixnews9.ix.netcom.com>
Not certain on pay but will consider workout.
I have new startup application require perl scripting to
automate thru unix server orders.
1. script to create client page,split with vendor reply
2. scrpt to validate credit card payment, and report.
3. script to store orders in unique bin and summarize quantiity ,
then move bin contents to appropriate vendor.
Please email me your phone # so we can tall further about
implementation.
Thanks,
Alan Feiler
248-540-4289
800-210-8339 voicemail
------------------------------
Date: 12 Jun 1998 14:01:38 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: Re: NEED PERL SCRIPTING
Message-Id: <6lrcc2$c8r$1@usenet11.supernews.com>
: Not certain on pay but will consider workout.
Having to exercise hardly seems like adequate remuneration for my
programming skills, but maybe I'm just overly sedentary.
xoxo,
Andy
--
--
Andy Lester: <andy@petdance.com> http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com> http://ChicagoMusic.com/
------------------------------
Date: Fri, 12 Jun 1998 10:00:15 -0400
From: "Ray Smith" <smithr@lexma.meitech.com>
Subject: Re: Perl5.004_04 Win32 build problems
Message-Id: <6lrc4p$rpe$1@client3.news.psi.net>
Well...most of the problem was solved by setting the environment variables
CL, for the MSVC compiler and LINK for the linker as follows, using
Start|Settings|Control Panel|System|Environment.
CL: -Ic:/progra~1/devstu~1/vc/include
LINK: -LIBPATH:c:/progra~1/devstu~1/vc/lib
Then, other than the instalation destination, no changes need be made to
Makefile.
Things seem to build, and test ok. However during the installation I get
numous messages (e.g. "cannot resolve L<perl_call_sv> in paragraph 521") as
below. Any ideas?
See "???" for questionable lines below:
Installation output (partial):
Microsoft (R) Program Maintenance Utility Version 1.62.7022
Copyright (C) Microsoft Corp 1988-1997. All rights reserved.
cd ..\pod
nmake -nologo -f ..\win32\pod.mak checkpods pod2html pod2latex pod2man
pod2text
'checkpods' is up-to-date
'pod2html' is up-to-date
'pod2latex' is up-to-date
'pod2man' is up-to-date
'pod2text' is up-to-date
xcopy /f /r /i /d *.bat ..\win32\bin\*.*
0 File(s) copied
cd ..\win32
copy ..\README.win32 ..\pod\perlwin32.pod
1 file(s) copied.
..\perl.exe
.\installhtml --podroot=.. --htmldir=./html --podpath=pod:lib:ext:utils --h
tmlroot="//d|\perl5044\lib\pod\html" --libpod=perlfunc:perlguts:perlvar:per
lrun:perlop --recurse
copy ..\README.win32 ..\pod\perlwin32.pod
1 file(s) copied.
..\perl.exe
.\installhtml --podroot=.. --htmldir=./html --podpath=pod:lib:ext:utils --h
tmlroot="//d|\perl5044\lib\pod\html" --libpod=perlfunc:perlguts:perlvar:per
lrun:perlop --recurse
??? ..\installhtml: ../pod/perlcall.pod: cannot resolve L<perl_call_sv> in
paragraph 521: no such page 'perl_call_sv'
??? ..\installhtml: ../pod/perldebug.pod: cannot resolve LTerm::ReadLine in
paragraph 128: no .pod or .pm found
...
D:\crs\perl\p544\perl5.004_04\win32\html\pod\perlxs.html ->
D:\perl5044\lib\pod\html\pod\perlxs.html
D:\crs\perl\p544\perl5.004_04\win32\html\pod\perlxstut.html ->
D:\perl5044\lib\pod\html\pod\perlxstut.html
185 File(s) copied
------------------------------
Date: Fri, 12 Jun 1998 05:06:25 -0400
From: -bill- <bill@TechServSys.com>
Subject: prob compil perl5.004_04 under SCO unix with cc
Message-Id: <3580EF91.6113@TechServSys.com>
It would be nice if you would send me a courtesy email reply
when I get to "make" after the configure for perl5.004_04
I get the following error:
./miniperl configpm tmp
sh mv-if-diff tmp lib/Config.pm
File lib/Config.pm not changed.
AutoSplitting perl library
Making DynaLoader (static)
Making utilities
Making x2p stuff
`all' is up to date.
Making Fcntl (dynamic)
LD_RUN_PATH="" ld -o ../../lib/auto/Fcntl/Fcntl.so
-L/usr/local/lib -L/f/perl/sfio/lib Fcntl.o
undefined first referenced
symbol in file
__stat32 Fcntl.o
__fstat32 Fcntl.o
__lstat32 Fcntl.o
__statlstat32 Fcntl.o
Perl_croak Fcntl.o
errno Fcntl.o
strncmp Fcntl.o
strcmp Fcntl.o
Perl_stack_sp Fcntl.o
Perl_stack_base Fcntl.o
Perl_markstack_ptr Fcntl.o
Perl_na Fcntl.o
Perl_sv_2pv Fcntl.o
Perl_sv_2iv Fcntl.o
Perl_sv_newmortal Fcntl.o
Perl_sv_setnv Fcntl.o
Perl_Sv Fcntl.o
Perl_form Fcntl.o
perl_get_sv Fcntl.o
Perl_newXS Fcntl.o
Perl_sv_yes Fcntl.o
i386ld fatal: Symbol referencing errors. No output written to
../../lib/auto/Fcntl/Fcntl.so
*** Error code 13 (bu21)
*** Error code 1 (bu21)
--
--
-bill-
Technical Service Systems - bill@TechServSys.com
------------------------------
Date: 12 Jun 1998 09:25:05 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Stages in a pipeline
Message-Id: <hg1qd7em.fsf@mailhost.panix.com>
Tom Christiansen <tchrist@mox.perl.com> writes:
> In comp.lang.perl.misc, Scott Bronson <sbronson@opentv.com> writes:
> :Unfortunately, the pipe between each stage means that I have to print
> :and then re-parse to move data between each stage. Doable, but I think
> :that's making the computer work harder than it should.
>
> Oh well. That's what it's there for. :-) Anyway, people write
> makefiles and multistage pipelines all the time.
I'd like to remind everyone watching that mjd contributed to The Perl
Journal an article about the implementation of streams. Said article
(and the module that goes with it) might provide a foundation for
whatever streamish problem you're trying to solve here.
The Perl Journal #7, p18: "Infinite Lists", Mark-Jason Dominus
http://orwant.www.media.mit.edu/tpj/programs/Issue_7_Infinite/
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf/
------------------------------
Date: 12 Jun 1998 16:47:50 +0200
From: Akim Demaille <demaille@inf.enst.fr>
Subject: Subs and References and implicit arguments
Message-Id: <qylg1hafzhl.fsf@ubu.enst.fr>
Hi!
How do I program a function which transparently modifies its argument,
and is able, when no argument is given, to apply on $_?
For instance:
#! /usr/local/bin/perl -w
sub clean (\$);
sub clean (\$)
{
$string = shift or die "Missing argument\n";
for ($$string)
{
s/\s+/ /g;
s/^\s//;
s/\s$//;
}
print "($$string)\n";
}
$foo = " lsk fl; l; sdfk; ";
clean $foo;
print "($foo)\n";
$_ = " jdklsjfg s ";
clean;
print "($_)\n";
Does not work (because of the proto I guess, but without, the call is
no longer transparent: I need to give a reference, right?)
Akim
--
P-mail: Akim Demaille, 107 rue Bobillot, F-75013 Paris, France
E-mail: demaille@inf.enst.fr
V-mail: +33 1 45 81 78 68
------------------------------
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 2854
**************************************