[8876] in Perl-Users-Digest
Perl-Users Digest, Issue: 2493 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 4 16:17:26 1998
Date: Mon, 4 May 98 13:00:30 -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 Mon, 4 May 1998 Volume: 8 Number: 2493
Today's topics:
$$#_ ? <prl2@lehigh.edu>
Re: $$#_ ? (John Porter)
Re: $$#_ ? <rootbeer@teleport.com>
Re: $$#_ ? <jdf@pobox.com>
Re: $$#_ ? <cmargoli@world.northgrum.com>
Re: 1701 days hath September (was: Re: rename funciton) (Jim Michael)
Re: 1701 days hath September (was: Re: rename funciton) <cmargoli@world.northgrum.com>
Re: 1701 days hath September (was: Re: rename funciton) (Chris Nandor)
A bug in search function when using win32::ODBC (Connie Wang)
Re: ANNOUNCE: Perl Builder IDE Now Available <tchrist@mox.perl.com>
Re: ANNOUNCE: Perl Builder IDE Now Available <jdf@pobox.com>
Chicago Perl Mongers meeting May 8 (Jim Allenspach)
CPAN & Module gripes (was Re: Ever Wonder...?) (Clinton Pierce)
Re: CPAN & Module gripes (was Re: Ever Wonder...?) <jdf@pobox.com>
Re: Ever Wonder Why Not Everyone Uses Modules? <brianm@kodak.com>
fpt.pl needs sys/socket.ph / what is socket.ph? <kbaltrinic@shentel.net>
Re: If Perl had immediate subroutines... <jll@skynet.be>
Re: If Perl had immediate subroutines... <jll@skynet.be>
Re: If Perl had immediate subroutines... <jll@skynet.be>
Re: If Perl had immediate subroutines... <danboo@negia.net>
Re: If Perl had immediate subroutines... (John Porter)
Re: killing a child PID eryq@zeegee.com
Re: magic <> and Term::ReadLine::Gnu <jkry3025@comenius.ms.mff.cuni.cz>
perl script to trans smtp mail text to html ageorge@best.com
Re: Perl2Exe file for Unix? eryq@zeegee.com
Re: Problem building Perl on HPUX 9.04 <brianm@kodak.com>
Re: Problem evaluating scalars <jkry3025@comenius.ms.mff.cuni.cz>
Re: problem reading DB_File on win32 platform (Jason Taylor)
Returning an image <doug.carter@digital.com>
Re: Returning an image <jdf@pobox.com>
rewriting swatch <jmscott@ainet.com>
Script Needed: Referral/Affiliate/Commission reward scr <safepage@gte.net>
Re: Simple Perl Databases (Jason Taylor)
Re: Use of Uninitialized Value <doug@weboneinc.net>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 4 May 1998 14:47:36 -0400
From: "Phil R Lawrence" <prl2@lehigh.edu>
Subject: $$#_ ?
Message-Id: <6il2g5$1ai6@fidoii.cc.Lehigh.EDU>
$_ is a hard reference to an array. How do I determine the subscript of the
final element of the array?
$$#_ doesn't seem to work.
Of course I can:
my @param = $$_;
my $subscr = $#param;
but it seems rather lame to declare an array just for this purpose.
Thanks,
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Phil R Lawrence phone: 610-758-3051
Programmer / Analyst e-mail: prl2@lehigh.edu
194 Lehigh University Computing Center
E.W. Fairchild - Martindale, Bldg. 8B
Bethlehem, PA 18018
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: Mon, 04 May 1998 19:11:22 GMT
From: jdporter@min.net (John Porter)
Subject: Re: $$#_ ?
Message-Id: <MPG.fb7de5c5b90b5a49896a4@news.min.net>
On Mon, 4 May 1998 14:47:36 -0400,
in article <6il2g5$1ai6@fidoii.cc.Lehigh.EDU>,
prl2@lehigh.edu (Phil R Lawrence) wrote:
> $_ is a hard reference to an array. How do I determine the subscript of the
> final element of the array?
>
> $$#_ doesn't seem to work.
What would you do to $_ to get at the array it references?
Why, you'd stick a @ in front, of course: @$_, or @{$_}.
Naturally you do the same thing with $#: $#{$_}.
hth,
John Porter
------------------------------
Date: Mon, 04 May 1998 19:28:14 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Phil R Lawrence <prl2@lehigh.edu>
Subject: Re: $$#_ ?
Message-Id: <Pine.GSO.3.96.980504121917.20962B-100000@user2.teleport.com>
On Mon, 4 May 1998, Phil R Lawrence wrote:
> $_ is a hard reference to an array. How do I determine the subscript of
> the final element of the array?
>
> $$#_ doesn't seem to work.
I think you want $#$_ , ugly though it may be. You could use $#{$_} as
well. There's More Than One Ugly Way To Do It. :-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 04 May 1998 15:29:57 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: "Phil R Lawrence" <prl2@lehigh.edu>
Subject: Re: $$#_ ?
Message-Id: <ra293hkq.fsf@mailhost.panix.com>
"Phil R Lawrence" <prl2@lehigh.edu> writes:
> $_ is a hard reference to an array. How do I determine the subscript of the
> final element of the array?
$#{$_}
or
scalar @$_ - 1 # assuming you haven't twiddled $[
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: Mon, 4 May 1998 19:18:48 GMT
From: Charles Margolin <cmargoli@world.northgrum.com>
Subject: Re: $$#_ ?
Message-Id: <354E1498.3283@world.northgrum.com>
Phil R Lawrence wrote:
>
> $_ is a hard reference to an array. How do I determine the subscript of the
> final element of the array?
>
> $$#_ doesn't seem to work.
>
How about $#{$_} or $#$_ (whichever looks better to you).
--
Charles G. Margolin DSSD Internal Information Services
cmargoli@world.northgrum.com Northrop Grumman Corp. 0624/23
margolin@acm.org Hawthorne, California 90250-3277
------------------------------
Date: Mon, 4 May 1998 19:11:44 GMT
From: genepool@netcom.com (Jim Michael)
Subject: Re: 1701 days hath September (was: Re: rename funciton)
Message-Id: <genepoolEsG5BK.Jzy@netcom.com>
John Stanley (stanley@skyking.OCE.ORST.EDU) wrote:
: In article <genepoolEsFHCA.F1z@netcom.com>,
: Jim Michael <genepool@netcom.com> wrote:
: >Then use one of the free email services.
: The "free" email services require internet access, which in most places
: costs money.
You get usenet by smoke signal? OK, 2 ways for BBS users with plenty of
time and no money:
Method 1:
Go to the library and log onto the free internet feed. Set up your free
email account. Walk to the library so you don't have to pay for gas.
Method 2:
Ask your friend to set the account up for you. This might cost you a favor.
------------------------------
Date: Mon, 4 May 1998 19:23:35 GMT
From: Charles Margolin <cmargoli@world.northgrum.com>
Subject: Re: 1701 days hath September (was: Re: rename funciton)
Message-Id: <354E15B7.142C@world.northgrum.com>
Jim Michael wrote:
> Go to the library and log onto the free internet feed.
Free?? Where I live, the library charges $6.00 per hour.
--
Charles G. Margolin DSSD Internal Information Services
cmargoli@world.northgrum.com Northrop Grumman Corp. 0624/23
margolin@acm.org Hawthorne, California 90250-3277
------------------------------
Date: Mon, 04 May 1998 15:49:21 -0400
From: pudge@pobox.com (Chris Nandor)
Subject: Re: 1701 days hath September (was: Re: rename funciton)
Message-Id: <pudge-0405981549220001@ppp-47.ts-1.kin.idt.net>
In article <354DF38C.7BB@juicepigs.com>, Bob Trieger
<sowmaster@juicepigs.com> wrote:
# No there isn't. Think of this newsgroup as a moderated IRC channel. It
# starts off innocent enough with a couple of moderators elected. Then
# they op a couple of friends who elected them and they op some friends
# and they op some friends. Before you know it, the majority of people on
# the channel are ops and nobody is moderating the moderators.
Actually, if you are going to use this model, then we have proof it works
pretty well. #perl on EFNet right now has 87 users. Only 34 are not
ops. Yet the channel works remarkably well. If an operator or few get
out of line, they do get reprimanded by other operators, and sometimes
kicked and banned (I know, it has happened to me :).
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
MacPerl: Power and Ease (ISBN 1881957322), http://www.ptf.com/macperl/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: Mon, 04 May 1998 19:42:06 GMT
From: c0w0461@unix.tamu.edu (Connie Wang)
Subject: A bug in search function when using win32::ODBC
Message-Id: <354e19df.9774018@news.tamu.edu>
I use access database and Perl5.0 and win32::ODBC to do a dynamic
webpage project. The following are my add.pl and search.pl.
My problem is when I use search page, the result includes everything
that I input from add page and my search result. If I add data to
access database directly, the search page works perfectly.
I guess there must something wrong in while ($query->FetchRow()). Am I
right? How to correct this bug? Thanks for your advice in advance and
I appreciate your attention.
###########################################################
# This is my add.pl
###########################################################
use CGI;
print "Content-type: text/html\n\n";
$input=new CGI;
use Win32::ODBC;
$query = new Win32::ODBC("vitadb");
if (!($query = new Win32::ODBC("vitadb"))) {
print "Error conntcting to application database\n";
print "Error: " . Win32::ODBC::Error() ."\n";
exit;
}
$Title=$input->param('Title');
$FirstName=$input->param('FirstName');
$LastName=$input->param('LastName');
$sql = sprintf("insert into tblReference (Title,FirstName,LastName)
values ('$Title','$FirstName','$LastName');
$query->Sql($sql);
$query->Close();
########################################################
# This is my search.pl
########################################################
use CGI;
print "Content-type: text/html\n\n";
$input=new CGI;
use Win32::ODBC;
$query = new Win32::ODBC("vitadb");
if (!($query = new Win32::ODBC("vitadb"))) {
print "Error conntcting to application database\n";
print "Error: " . Win32::ODBC::Error() ."\n";
exit;
}
$query->Sql(" SELECT *
FROM tblReference
where FirstName='$FirstName' or LastName='$LastName' or
Title='$Title' ");
$count=0;
while ($query->FetchRow())
{
%hash=$query->DataHash();
$count=$count+1;
print qq~
<html>
$hash{FirstName},$hash{LastName},$hash{Title} <br>
</html>~;
}
$query->close();
###########################################################
------------------------------
Date: 4 May 1998 19:25:19 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: ANNOUNCE: Perl Builder IDE Now Available
Message-Id: <6il4mv$lon$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
:> So, Perl syntax depends on prior-seen Perl semantics. And until you
:> get an "editor" that knows all of Perl semantics, any hope at a
:> completely accurate syntax-assist is gone.
:Just insert
: (require "halting-problem")
:in the top of your perl-mode.el.
Really? Does that mean the perl compiler has solved the
halting problem?
Cool.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
With a PC, I always felt limited by the software available. On Unix, I am
limited by my knowledge. --Peter J. Schoenster <pschon@baste.magibox.net>
------------------------------
Date: 04 May 1998 15:37:01 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: tchrist@mox.perl.com (Tom Christiansen)
Subject: Re: ANNOUNCE: Perl Builder IDE Now Available
Message-Id: <lnsh3h8y.fsf@mailhost.panix.com>
Tom Christiansen <tchrist@mox.perl.com> writes:
> ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
> :Just insert
> : (require "halting-problem")
> :in the top of your perl-mode.el.
>
> Really? Does that mean the perl compiler has solved the
> halting problem?
No, not perl, emacs lisp. It comes with np-complete.el.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: 4 May 1998 14:19:22 -0500
From: jima@MCS.COM (Jim Allenspach)
Subject: Chicago Perl Mongers meeting May 8
Message-Id: <6il4bq$rg9@Mars.mcs.net>
Keywords: chicago,meeting,food
The next meeting of the Chicago chapter of Perl Mongers will be
held this Friday, May 8, at Cafe Iberico, 739 N. LaSalle. Meeting time is
around 6 PM, with drinks and (eventually) dinner. All interested parties
are invited to attend.
For more information on the meeting or the Chicago.PM chapter, send
e-mail to jima@mcs.com . Hope to see you there...
jma
------------------------------
Date: 4 May 1998 18:23:44 GMT
From: cpierce1@cp500.fsic.ford.com (Clinton Pierce)
Subject: CPAN & Module gripes (was Re: Ever Wonder...?)
Message-Id: <6il13g$cr21@eccws1.dearborn.ford.com>
In article <6iku8d$cvm@fridge.shore.net>,
Art Cohen <upsetter@shore.net> writes:
>Furthermore, if using module x requires a special installation of module
>y, that makes it all the more unlikely that I'd ever use it on a client's
>site.
I agree 100%. CPAN is a pain in the ass to use. It's a lot like an
unordered phone book--potentially useful, but not really.
Trying to find a module (library, etc...) to do something simple can be
overwhelming. If I'm a clueless newbie trying to, say, decode MIME
E-Mail messages (semi-random example). First, there's no hints in the
Documentation, other than to hunt around in CPAN.
CPAN (on a browser) presents a lits of directories, and a self-Congratulatory
message (the README), and references for further reading. Further reading
does explain what the directories are about--so far so good.
Searching for MIME turns up a plethora of MIME references, but the
interesting one seems to be MIME::Parser. Clicking on that takes me to a
listing of MIME-{Base64,Lite,tools,ispmailgate}.*. None of which looks
anything like the MIME::Parser module I asked for. Going BACK to the
CPAN.html#mime page gives you no hint that you need "MIME-tools.*".
Clicking on various README's will eventually turn up MIME-tools as
being the correct package.
But wait, the comment in CPAN.html says that it's not part of the
libwww bundle. Do I need libwww? Is it a prerequisite? Clicking on
libwww bundle says that MIME is _included_ in libwww. So which do I
want, libwww or MIME-tools. (The descriptions for MIME and libwww
in regards to MIME:: are contradictory. At least _VERY_ confusing.)
IF I had been misfortunate enough to search and stumble across libwww
first (instead of the MIME::Parser description), I might have downloaded
libwww, seen in the README that MIME-Base64, libnet and MD5 were all
prereqs, downloaded them, built them, built libwww and STILL HAD NO
MIME::Parser.
By sheer dumb luck, I would have avoided a LOT of frustrating work. But
only dumb luck.
For CPAN to be more useful, IMHO, Module authors (and CPAN maintainers)
need to somehow embed dependency information into the modules. That
would allow CPAN to present you with the option of downloading the
desired module--and its dependencies all in one shot. This would also
help keep the descriptions up to date about which modules are embedded
in which packages (i.e. MIME is _NOT_ part of libwww, despite what the
documentation says).
If Perl allows self-documenting programs, then there's no reason not
to extend this outward towards the modules...
--
+------------------------------------------------------------------------+
| Clinton A. Pierce | "If you rush a Miracle Man, | http://www. |
| cpierce1@ford.com | you get rotten miracles" | dcicorp.com/ |
| fubar@ameritech.net |--Miracle Max, The Princess Bride| ~clintp |
+------------------------------------------------------------------------+
GCSd-s+:+a-C++UALIS++++P+++L++E---t++X+b+++DI++++G++e+>++h----r+++y+++>y*
------------------------------
Date: 04 May 1998 15:21:54 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: cpierce1@cp500.fsic.ford.com (Clinton Pierce)
Subject: Re: CPAN & Module gripes (was Re: Ever Wonder...?)
Message-Id: <u3753hy5.fsf@mailhost.panix.com>
cpierce1@cp500.fsic.ford.com (Clinton Pierce) writes:
> For CPAN to be more useful, IMHO, Module authors (and CPAN maintainers)
> need to somehow embed dependency information into the modules. That
> would allow CPAN to present you with the option of downloading the
> desired module--and its dependencies all in one shot.
Does this not work for you?
# perl -MCPAN -e shell
cpan> install MIME::Parser
The CPAN module does indeed know about dependencies, etc. Try it, if
you haven't already.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: Mon, 04 May 1998 15:28:42 -0400
From: Brian Mathis <brianm@kodak.com>
Subject: Re: Ever Wonder Why Not Everyone Uses Modules?
Message-Id: <354E16EA.34EF25BA@kodak.com>
Art Cohen wrote:
>
> You know, it's very annoying to reply to an (unmarked) email cc only to
> discover that the same message was also posted to the group. Doesn't your
> newsreading software give you an option to put "posted and mailed" at the
> top of the message?
[...]
> --Art
I'm sorry for the inconveinence. I usually send an email reply, as well
as a newsgroup one, for courtesy of the original poster. Many people
post questions, and often time an email response gets to them much
faster than waiting for a usenet reponse to propagate through the
system. Quit your whining, it's not like you were spammed or anything.
------------------------------
Date: Mon, 04 May 1998 19:40:12 GMT
From: Kenneth Baltrinic <kbaltrinic@shentel.net>
Subject: fpt.pl needs sys/socket.ph / what is socket.ph?
Message-Id: <354E1936.243A0917@shentel.net>
To anyone who can help:
I have writen a perl script that needs aquire a datafile via ftp for
processing.
To do this I am "require"-ing ftp.pl which is found in /perl/lib in the
Perl 5 distribution.
This library contains the line:
eval "require 'socket.ph'" || eval "require 'sys/socket.ph'" || die
"socket.ph missing: $!\n";
Which causes a runtime error like its is supposed to if sys/socket.pl is
missing. What is sys/socket.ph, what does it do, do I need it and where
do I find it?
Or is there another way I can FTP via Perl? I just need to log on and
retrieve one file from a password secured FTP server.
Thanks in advance for any assistance anyone can give me on this matter.
Sincerely,
Ken Baltrinic
------------------------------
Date: Mon, 04 May 1998 21:28:01 +0200
From: Jean-Louis Leroy <jll@skynet.be>
Subject: Re: If Perl had immediate subroutines...
Message-Id: <VA.00000049.008dada7@enterprise>
> That's way nifty, except that it isn't necessary for those who
> think in perl when writing perl.
I'm a newbie at Perl. You may well be right ;)
> sub {
> print "this code doesn't get executed, right?\n";
> };
There's a simpler solution: quote it with q{}.
(below quotes are not in same order as in original message)
> no nasty string evals.
Remember that I'm proposing an extension to the Perl parser. I've built a
very simple, easily confused prototype on top of eval. That's only for
experimentation.
> > print max 1, 2 + 3;
>
> print &{ sub { ( $_[0] > $_[1] ) ? $_[0] : $_[1]; } }( 1, 2 + 3 );
>
> Or, if you're gonna use it more than once:
>
> # define it:
> my $max_macro = sub { ( $_[0] > $_[1] ) ? $_[0] : $_[1]; }
>
> # use it:
> print &$max_macro( 3, 1 + 2 );
There's a simpler way: make it a plain named sub.
> > compile_if $DEBUG, { print "debug build!\n" };
>
> $DEBUG && do { print "debug build!\n" };
Your three alternate solutions have this in common: they have a runtime
cost, both in terms of memory and execution speed.
Also, the upcoming Perl compiler would benefit from isubs: presumably, it
would see neither the code that is commented out, nor the debug code.
Jean-Louis Leroy
http://ourworld.compuserve.com/homepages/jl_leroy/
------------------------------
Date: Mon, 04 May 1998 21:28:02 +0200
From: Jean-Louis Leroy <jll@skynet.be>
Subject: Re: If Perl had immediate subroutines...
Message-Id: <VA.0000004a.008db258@enterprise>
> Hmm. You may use the C preprocessor for macros and conditional
> compilation (see perlrun).
I'm aware of that. I think isubs have three major advantages over the
cpp approach.
1) You must deal with two separate languages.
2) Perl is *way* more powerful than cpp. I think we're all in agreement
here ;) You can always use a different preprocessor (m4 or even a Perl
script), but you loose on the ease-of-use side. The swift edit-test
cycle that Perl enjoys then becomes edit-preprocess-test.
3) cpp may not be around on your customer's machine. This is the norm
for Wintel.
> You may use pod commands to construct multiline comments.
I've heard of that trick. That's my big problem with it: it's a very
ugly trick. Also, what happens if the module also contains *real*
comments?
> And in the case of sorting functions and constant
> functions, perl provides inlining, though (obviously) you're looking
> for a more generalized thingy.
Yes, I'm looking, among other things, for user-controllable inlining.
In another life I was a Forth expert. I confess being but a modest
beginner in Perldom.
Forth is an amazingly powerful language. It draws its power from
construct like IMMEDIATE and CREATE DOES>, but also from the fact that
its intermediate code compiler is open. Perl has a closed compiler, and
I doubt it can measure up with Forth on extensibility. But it has great
text processing capabilities...and programs *are* text.
That being said, perhaps it would be feasible to 'open' the Perl
compiler?
Jean-Louis Leroy
http://ourworld.compuserve.com/homepages/jl_leroy/
------------------------------
Date: Mon, 04 May 1998 21:28:03 +0200
From: Jean-Louis Leroy <jll@skynet.be>
Subject: Re: If Perl had immediate subroutines...
Message-Id: <VA.0000004b.008db7aa@enterprise>
> Have you looked into BEGIN blocks?
Yes, my example uses one to set the $DEBUG variable. This is necessary
because isubs are executed long before any regular code is.
> Very similar. VERY.
Indeed. One of the reasons why I think isubs would be a nice extension is
that they're the natural extrapolation of an existing language feature.
Jean-Louis Leroy
http://ourworld.compuserve.com/homepages/jl_leroy/
------------------------------
Date: Mon, 04 May 1998 13:15:03 -0400
From: Dan Boorstein <danboo@negia.net>
Subject: Re: If Perl had immediate subroutines...
Message-Id: <354DF797.DB9C2901@negia.net>
John Porter wrote:
>
> On Mon, 04 May 1998 11:06:11 -0600,
> in article <6ikp1j$554$1@nnrp1.dejanews.com>,
> jll@skynet.be (jll@skynet.be) wrote:
> >
> > Migrated to Perl, the concept might look like this: a sub marked as
> > immediate (by prefixing its definition with the 'immediate' keyword,
> > for example) would be called by the parser. The isub's return value,
> > which should be a (possibly empty) string, would replace the isub call
> > in the parse stream. The isub's arguments, if any, would implicitly be
> > quoted, as if enclosed in q{}.
>
> That's way nifty, except that it isn't necessary for those who
> think in perl when writing perl.
> At least for the examples you gave, there exist native perl ways
> of doing what you're trying to do.
>
> > BEGIN
> > {
> > $DEBUG = 1;
> > }
> >
> > sub test
> > {
> > comment
> > {
> > this block
> > has been
> > commented out
> > };
>
> # create a sub on the fly. discard the ref.
> # call it a comment if you want.
> sub {
> print "this code doesn't get executed, right?\n";
> };
>
perhaps it does not get executed, but it does get checked for
syntax. not sure if the original concept would cause this as well
but it sounds like a rather troublesome commenting system to me.
and if you run under -w (as we all do ;), you get a 'Useless
use...' warning.
--
Dan Boorstein home: danboo@negia.net work: danboo@y-dna.com
"THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
- Cosmic AC
------------------------------
Date: Mon, 04 May 1998 19:40:07 GMT
From: jdporter@min.net (John Porter)
Subject: Re: If Perl had immediate subroutines...
Message-Id: <MPG.fb7e514a753a82a9896a5@news.min.net>
On Mon, 04 May 1998 21:28:01 +0200,
in article <VA.00000049.008dada7@enterprise>,
jll@skynet.be (Jean-Louis Leroy) wrote:
>
> Your three alternate solutions have this in common: they have a runtime
> cost, both in terms of memory and execution speed.
>
> Also, the upcoming Perl compiler would benefit from isubs: presumably, it
> would see neither the code that is commented out, nor the debug code.
Sounds like you want a perl preprocessor.
Unless you save the output of the preprocessor, you're going to have
even more runtime cost. Although, it would be distributed differently,
so it may be a net gain in some situations.
John Porter
------------------------------
Date: Mon, 04 May 1998 14:24:38 -0600
From: eryq@zeegee.com
Subject: Re: killing a child PID
Message-Id: <6il4lm$ji0$1@nnrp1.dejanews.com>
In article <354D6EDA.1A89BE96@nectar.com.au>#1/1,
Justin Wills <justin@nectar.com.au> wrote:
>
> this code works for some reason :), but I don't understand why :(
>
> the kill statement won;t work if I use some other
> variable name, but $pid doesn't contain anything either.
>
> #!/usr/bin/perl
Start with:
#!/usr/bin/perl -w
use strict;
use vars qw($opt_t); # for getopt
> use POSIX;
> use Getopt::Std;
>
> trap_signals(); # trap SIGALRM and run the sig_handler function.
>
> getopt('t');
>
> $TMOUT=($opt_t ? $opt_t : 120);
my $TMOUT = $opt_t || 120; # sorry; can't resist...
> alarm $TMOUT;
> system("rsh @ARGV");
system('rsh', @ARGV);
die "rsh returned nonzero status\n" if ($? >> 8);
> exit;
> sub sig_handler
> {
>
> my($signal)=shift;
>
> # I don't know why $pid works when it's not set, but it does (at
> least
> # under linux)
No big mystery. Do a 'man kill'. See what kill(SIGNAL, 0)
means. :-)
>
> kill 9, $pid;
> exit(1);
>
> }
>
> --
> Justin Wills
> justin@nectar.com.au
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Mon, 04 May 1998 20:53:34 -0700
From: Jan Krynicky <jkry3025@comenius.ms.mff.cuni.cz>
Subject: Re: magic <> and Term::ReadLine::Gnu
Message-Id: <354E8D3D.538F@comenius.ms.mff.cuni.cz>
Tim Mueller-Seydlitz wrote:
>
> Hi,
> I am writing a program that shall have a shell like interface for users
> and/or shall be used in a pipeline of processes.
>
> This behavior is easily achieved if I use the line input (angle)
> operator <>; but to make the user interface more comfortable, I would
> like to use the Perl portation (Term::ReadLine::Gnu) of the ReadLine
> library.
> How can I switch between the ReadLine library and <>?
> How can I check how the program got called?
>
> Either as a filter:
>
> cat input | program
> program < input
>
> or as an interactive program:
>
> program
>
> Any ideas?
> TIM
print (-t STDIN ? 'TERMINAL' : 'FILE or PIPE');
See man perlop
HTH, Jenda
------------------------------
Date: Mon, 04 May 1998 13:51:10 -0600
From: ageorge@best.com
Subject: perl script to trans smtp mail text to html
Message-Id: <6il2mv$h7h$1@nnrp1.dejanews.com>
All,
I used to have one of these but have lost it.
Does anyone know where I can find a script that will translate smtp mail text
to html?
Mant thanks,
-alan
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Mon, 04 May 1998 14:27:44 -0600
From: eryq@zeegee.com
Subject: Re: Perl2Exe file for Unix?
Message-Id: <6il4rf$jns$1@nnrp1.dejanews.com>
In article <354d8bb7.0@newsread1.dircon.co.uk>#1/1,
"Tan" <tan@jettech.dircon.co.uk> wrote:
>
> Is there any way that I can convert a Perl script into an executable under
> unix? Basically I am developing some code and would prefer it if people
> couldn't see the underlying Perl script. I am using HPUX 9 & 10.
>
> Would be grateful for any help received.
Try the FAQ, at http://www.perl.com . Good luck!
Eryq.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Mon, 04 May 1998 15:38:57 -0400
From: Brian Mathis <brianm@kodak.com>
To: alank@mjr.com
Subject: Re: Problem building Perl on HPUX 9.04
Message-Id: <354E1951.D8F10EA8@kodak.com>
alank@mjr.com wrote:
>
> Hi,
>
> Am trying to build perl5.004_04 on HPUX 9.04 with gcc 2.7.2.
You'll never get it to build. Just download the package from
http://hpux.cs.utah.edu/
search for 'perl', and it'll come up.
Brian Mathis
orev
------------------------------
Date: Mon, 04 May 1998 21:18:13 -0700
From: Jan Krynicky <jkry3025@comenius.ms.mff.cuni.cz>
Subject: Re: Problem evaluating scalars
Message-Id: <354E9305.1C58@comenius.ms.mff.cuni.cz>
Kevin Reid wrote:
>
> Mihails Nikitins <nikitins@infoservriga.lv> wrote:
>
> > Hello PERL experts,
> >
> > I have a stupid problem evaluating strings being read from a text file.
> >
> > I'd like to substitute scalar names with its values for some pattern text
> > file looking like:
> > Some preformatted text $some $good $values
> >
> > Imagine a simple text file containing one string:
> > $name is cool
> >
> > Here are 4 lines of code:
> > *********************
> > $name = "PERL";
> > open( IN, "text.txt" );
> > $string = <IN>;
> > print $string;
> > *********************
> > The program prints out
> > $name is cool
> > instead of the desired
> > PERL is cool
> >
> > How can I force PERL to substitute $name with its value in a very simple
> > manner? Function eval tries to evaluate 'is' and 'cool'. It works
> > correctly only if $name is the only word in the string.
>
> print eval qq{
> "$string";
> };
>
> --
> Kevin Reid. | Macintosh.
> "I'm me." | Think different.
What about :
$string = 'I say: "Hello $some world."';
print eval qq{
"$string";
};
You gotta get error!
Either escape the double quotes in that string as :
$string =~ s/"/\\"/gm;
print eval qq{
"$string";
};
Or use heredoc syntax with some delimiter that is "garantied" to not
ocure in the $string:
print eval qq{
<<"*E*nD*";
$string
*E*nD*
}
Jenda
------------------------------
Date: Mon, 04 May 1998 19:39:27 GMT
From: jtaylor@ala.net (Jason Taylor)
Subject: Re: problem reading DB_File on win32 platform
Message-Id: <354e191f.36047814@news.ala.net>
I'm not a 100% sure on this, but Unix starts newlines with the newline
(/n) character and NT uses the linefeed-carriage return pair. This may
be the source of your problem.
On 1 May 1998 19:10:13 GMT, whc@mink.att.com (Wing Choy) wrote:
>I have installed the DB_File extension on Windows NT.
>I am not having any success trying to read a DB_File
>created on Unix on the Windows NT machine.
>
>I failed right in the beginning trying to tie to the
>DB_File. If the DB_File is created in the NT, it
>seems it can read or write with no problem.
>
>Have anyone run into such problem? Was there some
>special handling which need to be done in order to
>read the DB_File created in Unix?
>
>Thanks for any pointer.
>
> Wing
>
------------------------------
Date: Mon, 04 May 1998 15:15:22 -0400
From: Doug Carter <doug.carter@digital.com>
Subject: Returning an image
Message-Id: <354E13CA.6FEC0896@digital.com>
I use this code on UNIX with no problems . I can't seem to get it to
work on NT though. It does run the script but returns the 'broken'
image icon instead of the image. I've verified the path (and tried
several locations for the image) but no image!
Anyone??
$output = "image.gif";
# output image
print "Content-type: image/gif\n\n";
open(IMAGE, $output);
while(<IMAGE>) {print ;}
close(IMAGE);
------------------------------
Date: 04 May 1998 15:31:54 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: doug.carter@digital.com
Subject: Re: Returning an image
Message-Id: <ogxd3hhh.fsf@mailhost.panix.com>
Doug Carter <doug.carter@digital.com> writes:
> print "Content-type: image/gif\n\n";
> open(IMAGE, $output);
You forgot
or die "$!"
Then you'll want to
binmode IMAGE;
Go ahead and
C:\> perldoc -f binmode
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: Mon, 04 May 1998 12:41:32 -0700
From: "Joseph M. Scott" <jmscott@ainet.com>
Subject: rewriting swatch
Message-Id: <354E19EC.4ECF@ainet.com>
I have to admit I enjoyed finding out about swatch ( see
http://www.stanford.edu/~atkins/ ) by simple accident when looking for
something else in the Essential System Admin book from OReilly ( great
book by the way ). Especially since I was going to be faced with the
task of writing something just like anyway :-)
We've got serveral FreeBSD machines ( all with perl5004 ) and so I
downloaded swatch and started playing with it. In general I was very
happy with it, however it didn't quite work the way I expected. It
didn't HUP the way I expected, and after doing some looking it looks
like nothing has been done to swatch for several years. So I began
rewriting it, and in the process learned a great many things ( namely
signals, heavily borrowed from Tom Phoenix's posts on the subject ).
However before I commit too much time to getting it completely done I
wanted to find out if anyone else had already done this? I've already
email the original author ( Todd Atkins ) and haven't recieved a
response yet.
Some of my big concerns/reasons for rewriting/reworking/etc swatch were
the following:
1. Signal support should work really, really well :-)
2. Change the use of local in the sub's to my
3. Add support for qpage ( alphanumeric paging software ) in the conf
file
4. Replace many of the substring routines with regex's
5. Make sure it HUP's when the syslog files roleover
6. Make sure any features of perl5004 that may speed things up are in
place
7. Take a look at the timing sub's and make sure they are accurate and
fast
8. Anything else that may come up :-)
Some of these were fairly easy and I've already done ( like 2 and 3 ).
However I'm new to signals so I'm still working with that, 7 is also
taking a little bit of time. I believe I've got 4 pretty much done as
well. I may post some code when I feel reasonably confident in it :-)
Any hints on 1, 5, 6 would be especially helpful ( as I've either yet
to work on them or just don't have enough background in it yet ).
Thanks.....
Joseph Scott
jmscott@ainet.com
------------------------------
Date: Mon, 04 May 1998 14:30:30 -0500
From: "James R. Thomson" <safepage@gte.net>
Subject: Script Needed: Referral/Affiliate/Commission reward script
Message-Id: <6il4lf$9a$1@gte1.gte.net>
Script Needed: Pay commissions to sales as a result of a click on a
banner
Does anyone know of a script or can write a script where I can have web
site owners place my banner on their site, and when someone goes to
their site and clicks on my banner and they purchase my service, I can
pay a commission for the sale to that web site owner?
An example of this is at http://www.newsbureau.com/affiliate/
Any help will be appreciated
------------------------------
Date: Mon, 04 May 1998 19:43:48 GMT
From: jtaylor@ala.net (Jason Taylor)
Subject: Re: Simple Perl Databases
Message-Id: <354e1a4f.36351883@news.ala.net>
On Mon, 4 May 1998 11:13:39 GMT, Brent Michalski <perlguy@inlink.com>
wrote:
This drive letter is not required. It works fine on my NT4 w/ IIS4
server.
>Mike,
>
>Actually it is just Brent, my parents condemned me to my middle name ;-)
>
>I was thinking, scary, and you say you are on an NT system. On NT
>systems, you need to provide the FULL path to the file, I also include
>the drive letter but don't know if it is necessary.
>
>So, in search.pl you line that reads:
>
>&search("phonebk.dat","simple");
>
>Should read:
>
>&search("d:/inetpub/scripts/phonebk.dat","simple");
>
>Or wherever your true path to the phonebook.data file is. This
>modification is needed in all of the scripts that reference the data
>file. Also, your "require" statements need the same thing done to them.
>
>For a while, I had the script ported over to NT and these were the only
>changes I had to make.
>
>Try it out and let me know if it helped...
>
>Brent
------------------------------
Date: Mon, 04 May 1998 15:03:01 -0400
From: Douglas Clifton <doug@weboneinc.net>
Subject: Re: Use of Uninitialized Value
Message-Id: <354E10E5.8FA1CCAF@weboneinc.net>
rpearce@fastlane.net wrote:
>
> I've written a script that reads an html document, pulls out the email
> addresses, sorts and removes duplicates, then writes them to a .txt file.
>
> It does everything it's supposed to do, but I always get an error that states:
> Use of Uninitialized Variable. I've checked FAQ's, the Llama book, among
> others, and the perldiag.
[snip]
You are going one element too far, $SIZE is the number
of elements *not* the subscript of the last element in
the list. Change $i <= $SIZE to $i < $SIZE in your for
loop to fix.
You're lucky you're using Perl and not C, such a mistake
would cause a segmentation fault/core dump.
--
Douglas Clifton
Unix/C/Perl/CGI/HTML Programmer
doug@weboneinc.com
------------------------------
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 2493
**************************************