[12889] in Perl-Users-Digest
Perl-Users Digest, Issue: 299 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 29 14:07:15 1999
Date: Thu, 29 Jul 1999 11:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 29 Jul 1999 Volume: 9 Number: 299
Today's topics:
Re: [Summary] Korn Shell or Perl? <aqumsieh@matrox.com>
Re: ASCII to ANSI conversion -- HELP <flavell@mail.cern.ch>
Re: Book "Perl Annotated Archives" Good?Bad? (Randal L. Schwartz)
Re: Comparing Scalars (Larry Rosler)
Re: Die process, Die! <cassell@mail.cor.epa.gov>
Re: Don't want to make file that owner is "NOBODY" <vlad@doom.net>
Re: Easy way to emulate Unix's "sort" command? <cassell@mail.cor.epa.gov>
Re: Find::File -- skipping a directory? (J. Moreno)
Re: Getting Height and Width of GIF/JPEG in PERL? <cassell@mail.cor.epa.gov>
Re: Help! tied DB_RECNO ->put() fails with R_IAFTER (Anno Siegel)
Re: How to determine a date in the past (Mesarchm)
Re: How to determine a date in the past (Larry Rosler)
Re: How to determine a date in the past (Larry Rosler)
Re: How to determine a date in the past <cassell@mail.cor.epa.gov>
Re: how to open remote file from the server?? <cassell@mail.cor.epa.gov>
Re: How to trim a String <dgris@moiraine.dimensional.com>
Re: How to trim a String <swiftkid@bigfoot.com>
is process still running? mrduane@my-deja.com
Re: is process still running? <worenklein@iname.com>
LanMAN error! <gio98dr@yahoo.com>
Re: OOP question. (Randal L. Schwartz)
Re: OOP question. (Randal L. Schwartz)
paging text <johnp@vcimail.com.remove.me>
Re: perl port to windows CE ? <worenklein@iname.com>
Re: preventing more than 1 submission (Anno Siegel)
Re: Reading the binary files in Perl <revjack@radix.net>
Re: reg expression <dgris@moiraine.dimensional.com>
Re: Seeking good Perl Examples (Anno Siegel)
Re: Sending HTML emails from perl script jedaustin1999@my-deja.com
Re: Sending HTML emails from perl script (Larry Rosler)
Re: Split is coming Back False?!? (Larry Rosler)
two forms interact with one script? <nslatius@dds.nl>
Re: use lib - Problem (Anno Siegel)
Re: using sendmail in .pl <worenklein@iname.com>
variation on /^=/ .. /^=cut/ <karner@andrew.cmu.edu>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 29 Jul 1999 11:35:28 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: [Summary] Korn Shell or Perl?
Message-Id: <x3ybtcveaff.fsf@tigre.matrox.com>
Tom Christiansen <tchrist@mox.perl.com> writes:
> As surely as Perl harbors no recondite artifice so puissant as your
> hypervaunted parentless shell's if/then/else marvel, a wonder heretofore
> unrevealed in any programming language's paradigms previously perused, so
> too shall readers of your gentle and most learned lecture surely find no
> other remedy or response than that they should dutifully abase themselves
> before your inimitable immolation of willful and wanton stultiloquence.
My thoughts exactly ..
------------------------------
Date: Thu, 29 Jul 1999 18:42:58 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: ASCII to ANSI conversion -- HELP
Message-Id: <Pine.HPP.3.95a.990729183849.3459F-100000@hpplus03.cern.ch>
On Thu, 29 Jul 1999, Philip 'Yes, that's my address' Newton wrote:
> > > I need to create a script that converts ANSI characters to ASCII
> > > characters.
> >
> > So what is it actually that you hope to achieve with this
> > "conversion"?
>
> Chances are he means, roughly, "ISO-Latin-1 (or Windows-1252) --> IBM
> Codepage 437 (or 850)".
Well, I thought he _might_ have meant the exact opposite, but I didn't
want to put words into his mouth. I think the recode program was the
right thing to point at, anyhow.
But ASCII is still a 7-bit code.
all the best
------------------------------
Date: 29 Jul 1999 10:45:35 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Book "Perl Annotated Archives" Good?Bad?
Message-Id: <m1r9lr2vuo.fsf@halfdome.holdit.com>
>>>>> "Uri" == Uri Guttman <uri@sysarch.com> writes:
Uri> from what i can find on the net (which you should have done yourself) i
Uri> can tell you very little. only one review at amazon, no code examples
Uri> and its publisher osborne/mcgraw-hill is not known for their computer
Uri> book quality especially in the perl world.
I picked it up a while back. It's halfway between MattWright and
a good book. Reinvents a lot of wheels. Calls Perl programs "foo.pl".
Parses its own QUERY_STRING instead of using CGI.pm. Even says in a
footnote on page 503, "If you want to use a more standard and
stress-tested solution for your CGI needs, then you should examine the
CGI module that comes with the Perl distribution". Ha! What do you
want to bet that came from a reviewer comment? :)
Other than that, the code looks reasonable, and the comments look
reasonable.
print "Just another Perl book hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Thu, 29 Jul 1999 10:30:16 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Comparing Scalars
Message-Id: <MPG.120a2f82f6838c48989d6e@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7npup0$q72$1@nnrp1.deja.com> on Thu, 29 Jul 1999 16:16:40
GMT, jverk@mediaone.net <jverk@mediaone.net> says...
> I'm having a problem comparing 3 scalars. In english, here's what I'm
> trying to do:
>
> if $scalar1 and $scalar2 and $scalar3 eq ""
> then do this
> else do this
>
> My problem is I don't know the correct way to write the comparison
> between the variables. If all three variables are null, then do this.
> If at least one of the variables has a value (any value) then do this.
> But how do I write this?
One needs to know a bit more about the possible values. I will assume
that when you say 'has a value (any value)' that 0 might be one such
value, which complicated things somewhat, but that the null string "" is
not such a value. The real question is if all the variables have
*defined* values, and if by 'null' you mean the null string "".
The worst-case solution deals with undefined values without generating
warnings.
unless (defined $scalar1 && $scalar1 ne ""
&& defined $scalar2 && $scalar2 ne ""
&& defined $scalar3 && $scalar3 ne "") {
do 'this'
} else {
'do that'
}
Now that you see the basic structure, you should be able to adapt it to
your specific needs.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 29 Jul 1999 10:30:44 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Die process, Die!
Message-Id: <37A08FC4.3DA2F723@mail.cor.epa.gov>
elephant wrote:
>
> Uri Guttman writes ..
> >>>>>> "A" == Abigail <abigail@delanet.com> writes:
> >
> > A> JME (raceE@yahoo.com) wrote on MMCLVIII September MCMXCIII in
> > A> <URL:news:_QMn3.109$Ga2.8231@news.cwix.com>:
> > A> &&
> > A> && Any ideas why a script would hang after it seemingly completes?
> >
> > A> Yeah, take a closer look at line 17.
> >
> >boy, a lot of people seem to make mistakes on that line. maybe they
> >should make sure line 17 is always a comment or blank. sorta like hotels
> >don't have a 13th floor in the us.
>
> you're joking aren't you ? .. these types are still writing their
> copyright and licensing notices on line 17
ASCII art. Line 17 is still smack in the middle of their
header, which has a dramatic 40-line rendering of their
self-concept.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 29 Jul 1999 13:58:03 GMT
From: <vlad@doom.net>
Subject: Re: Don't want to make file that owner is "NOBODY"
Message-Id: <7npmlb$iiu$1@news.servint.com>
Abigail <abigail@delanet.com> wrote:
> Think about. Suppose you find a way that a normal user has a file, that
> doesn't have permission xx6, yet your script can modify it anyway. Then
> any other user on the same system can write a script that modifies said
> file; all they need to do is the same as you did.
Thats what I mean, Use the source... Luke
> If you don't trust the users that have access to the same things you have,
> don't do your business there. Go elsewhere.
Exactly, but thats the nature of shared webservers, if you're dealing with
data files that are _that_ important, it should be on its own dedicated server
to begin with.
Either way... suexec is one way of dealing with the problem.
------------------------------
Date: Thu, 29 Jul 1999 10:48:03 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Easy way to emulate Unix's "sort" command?
Message-Id: <37A093D3.C8BB8158@mail.cor.epa.gov>
Jim Hutchison wrote:
[snip]
> Thanks Jonathan. As I'm still digesting the basics, the FAQ wasn't
> clear on how to do a simple numeric sort on, say, the 3rd column of a
> multi-column table.
>
> Their example was for "the first word after the first number"... I
> don't know perl enough yet to be creative, so it's not clear to me how
> to change the script to sort on another column.
I believe that the FAQ goes on to say:
"See http://www.perl.com/CPAN/doc/FMTEYEWTK/sort.html for
more about this approach."
Hop on over there, and you'll see even more on sorting, including
an example which may be more like what you have in mind.
> Thanks for your patience.
Patience? You must be mistaken. This is comp.lang.perl.misc
and we have *no* patience. Everyone on Usenet knows we're all
surly and rude to beginners. It's our Tom-given right. :-)
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 29 Jul 1999 13:09:24 -0400
From: planb@newsreaders.com (J. Moreno)
Subject: Re: Find::File -- skipping a directory?
Message-Id: <1dvpfzj.h17ex871n3n9N@roxboro0-0013.dyn.interpath.net>
Bart Lateur <bart.lateur@skynet.be> wrote:
> J. Moreno wrote:
>
> >Am, I missing something or is there no way to skip a directory when
> >using Find::File?
>
> It's File::Find, but that's probably just a typo. And yes, I bet you're
> interested in "pruning". From the docs:
>
> The function may set $File::Find::prune to prune the tree.
Thanks, that's what I thought it was supposed to do, but because of Yet
Another Typo it wasn't, so I thought I was misreading it.
Thanks.
--
John Moreno
------------------------------
Date: Thu, 29 Jul 1999 10:29:19 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Getting Height and Width of GIF/JPEG in PERL?
Message-Id: <37A08F6F.F7E70331@mail.cor.epa.gov>
Sean McAfee wrote:
> [snip of 'intense' discussion]
> Erp... I had a feeling the joke was too well-disguised even as I posted it.
> Maybe I should have written "<blink>" instead. But you're right; now that
> I think about it, it's hard to imagine that even Microsoft could be evil
> enough to create that monstrosity of a tag.
Well, some of us got the joke.
> Did you ever see that document containing the list of new WebTV-specific
> tags that made the rounds back when WebTV first came out? Reading it caused
I ran and hid under my desk until the fallout was gone.
> me to collapse to the ground, limbs twitching as every synapse in my brain
> fired chaotically. Well, almost. The trauma has mercifully removed
> most of my memories of the event, but I do recall that one of the tags
> was <audioscope>. And there was also the suggestion that it would be rude
> of the rest of the Web not to cater to WebTV-ers' special needs. *shudder*
'Special needs'? Is WebTV implying that their clients are DD?
Are they saying that the Americans with Disabilities Act applies
to anyone who has to use WebTV ?
Never mind. I don't want to know the answers.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 29 Jul 1999 17:12:32 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Help! tied DB_RECNO ->put() fails with R_IAFTER
Message-Id: <7nq220$1nv$1@lublin.zrz.tu-berlin.de>
Sara London <SaraNOS@ixPAMquick.com> wrote in comp.lang.perl.misc:
>I'm using version 1.57 of DB_File.pm. I tried to follow your advice
>re: installing the new version of BerkeleyDB, which I take is c code
>version db-2.7.5 from sleepycat.com and perl module BerkeleyDB-0.06
>from cpan, but they require that I recompile and install it, which I'm
>not experienced with. I ran into trouble here because it wants to
>install to /usr/local and /usr/local/lib, but I don't have write
>access to those directories.
>
>I (believe I) followed the documentation for db-2.7.5 to compile it to
>another directory and it passed all its tests, but the BerkeleyDB-0.06
>perl module didn't have similar documentation and despite trying a
>similar command (replacing 'make install' with 'make
>prefix=/usr/home/mydir/Berkeley/BerkeleyDB-0.06 install') it didn't
>work. I manually adjusted the prefix in the Makefile and it mostly
>worked but said that some directory didn't exist. So I created the
>directory, and it compiled and installed, but when I try to reference
>the module it says "Can't locate loadable object for module BerkeleyDB
>in @INC....".
>
>This is so frustrating! This was my first time recompiling a unix
>utility so I'm probably missing something along that line.
>
>If anyone has insight into compiling this module into a non /usr/local
>directory, or into the original problem where the DBFile that is
>bundled with the recent Perl distribution fails on ->put($key, $value,
>R_IAFTER), I would be very, very grateful.
Well, it *should* be possible to work with a private version of
DB_File that links against Berkeley 2.7.5. You may have to use
the PERL5LIB environment variable to tell it where to link from,
for one. Or use lib '/your/library/directory'. Then there is
the issue that you need to build a shared library from Berkeley DB,
it doesn't do that by default. There's also a header file involved:
When you build the perl extension, it must use the new db.h, not
the one that is installed on your system, otherwise it can't load
2.7.5.
This is a lot of hassle, especially since you don't know if it will
indeed solve your problem. How about you reduce your problem to
a self-contained example and post it (or mail it to me). I'd
run it on 2.7.5 to see if the problem goes away. Then we'll see.
Anno
------------------------------
Date: 29 Jul 1999 17:27:18 GMT
From: mesarchm@aol.com (Mesarchm)
Subject: Re: How to determine a date in the past
Message-Id: <19990729132718.06997.00000334@ng-ch1.aol.com>
This will subtract 1 day from the current date. You can change how far it goes
back my adding to the 24,60,60 (Days, Hours, Minutes)
my ($ss, $mi, $hh, $dd, $mm, $yy) = localtime(time - (*24 * 60 * 60));
------------------------------
Date: Thu, 29 Jul 1999 10:45:24 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How to determine a date in the past
Message-Id: <MPG.120a330f632db1d5989d6f@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <37A07A71.28798CAC@ing-barings.com> on Thu, 29 Jul 1999
16:59:45 +0100, Steve Walker <Steve.Walker@ing-barings.com> says...
> Does anyone know of a way of determining a date in the past, by counting
> back a specified number of days? Ideally the date would be returned as
> an integer, i.e. YYYYMMDD.
>
> Are there any Perl libraries which provide such a function?
The built-in functions are all you need.
#!/usr/local/bin/perl -w
use strict;
my $interval = 5 * 24 * 60 * 60; # 5 days ago -> seconds
my ($day, $month, $year) = (localtime(time - $interval))[3 .. 5];
# Print as a string.
printf "%d%.2d%.2d\n", 1900 + $year, $month + 1, $day;
# Print as an integer (same difference in Perl!).
my $then = 100 * (100 * (1900 + $year) + $month + 1) + $day;
print "$then\n";
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 29 Jul 1999 10:53:08 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How to determine a date in the past
Message-Id: <MPG.120a34db926b5dec989d71@nntp.hpl.hp.com>
In article <19990729132718.06997.00000334@ng-ch1.aol.com> on 29 Jul 1999
17:27:18 GMT, Mesarchm <mesarchm@aol.com> says...
> This will subtract 1 day from the current date. You can change how far it goes
> back my adding to the 24,60,60 (Days, Hours, Minutes)
>
> my ($ss, $mi, $hh, $dd, $mm, $yy) = localtime(time - (*24 * 60 * 60));
Argument "*main::24" isn't numeric in multiply at ...
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 29 Jul 1999 10:57:17 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: How to determine a date in the past
Message-Id: <37A095FD.A6930C16@mail.cor.epa.gov>
Steve Walker wrote:
>
> Does anyone know of a way of determining a date in the past, by counting
> back a specified number of days? Ideally the date would be returned as
> an integer, i.e. YYYYMMDD.
YYYYMMDD is a format. I wouldn't describe it as an integer,
even after I got back a string of consecutive numbers. But
I see what you mean.
> Are there any Perl libraries which provide such a function?
Yes. In fact, there's references to such modules in the FAQ.
You would have gotten a faster response if you had just typed
perldoc perltoc
and looked for a FAQ or two about dates. So next time, you'll
know.
But you'll probably want to take a look at the Date::Calc and
Date::Manip modules. Otherwise, you'd have to use the Perl
functions time(), localtime(), and printf() to: take the
current time minus a set number of seconds corresponding to
the number of days you had in mind [adjusting for daylight
savings time problems at boundary conditions]; get the year
month and day from that [adjusting the appearance to handle
the peculiarities of the C struct tm]; and print it in the
format you desire.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 29 Jul 1999 10:42:24 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: how to open remote file from the server??
Message-Id: <37A09280.212128FB@mail.cor.epa.gov>
HING wrote:
>
> Hi.
> I have this situation show below:
> I am writing a cgi file by using perl .
You mean that you are writing a Perl program to do some CGI.
> the file is put in a web server(NT4.0).
NT 4.0 isn't a webserver. It's an OS [okay, it's almost an
OS]. Your webserver is something else. IIS of unspecified
number, Apache, etc.
> My question is how to write the code in order that the
> server can open a file from my local harddisk??
Do you mean that you want to upload a file from your hard
disk to the server? Or do you mean that you want the web
server to have to stop what it is doing, contact your
local machine, cross its fingers you left your machine on,
find your file, then upload it? Or do you want users to be
able to upload files to the webserver at will?
You're not being specific enough or clear enough for us to
answer the question you really have.
> I downloaded some "upload module" from the internet..and they work in
> unix server but not NT,, why??
Probably because it's not an 'upload module' but some krufty
piece of dreck with non-portable features embedded.
You might want the Net::FTP module which comes in the libnet
bundle from CPAN. You can find out about the module and about
CPAN by reading the Perl FAQ which comes with every [proper]
install of Perl.
Umm, you do have Perl on your own hard disk, don't you?
Well, why not?
> Any resource can be found about the perl in win NT??
There's a bunch of good info on win32 Perl in the ActivePerl
FAQ which is probably sitting right there on that NT box.
But it will tell you that for the most part, well-written
Perl scripts run on NT boxes with minor revisions.
Net::FTP runs on unix and NT and pretty much everything else
where you find Perl.
I suggest that you'll want to learn some Perl before going
too much further. Check out the tutorials page at perl.com
and consider buying the book "Learning Perl for win32".
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 29 Jul 1999 11:14:53 -0600
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: How to trim a String
Message-Id: <m3aesf2x9u.fsf@moiraine.dimensional.com>
"Faisal Nasim" <swiftkid@bigfoot.com> writes:
> I wonder why there aren't precompiled functions like:
>
> rtrim(), ltrim, trim()....
Because there isn't a point in creating built-ins that
map to constructs compact enough to win a few rounds of
perl golf.
> sub trim
> {
> ( local $_ = shift ) =~ s/\s+|\s+$//gs;
> $_
> }
Yuck.
Why bother with the alternation when the second part can
_never_ match?
Why bother with the anchor at the end when the first
alternative has already eaten _all_ whitespace?
Why bother posting buggy code when this is answered in the
FAQ?
> Faisal Nasim (the Whiz Kid)
^^^^^^^^^^^^
Aaaahhhhh, I see. The entire post was meant to be sarcastic. My bad.
dgris
--
It's good to live in the bleeding edge ;-)
------------------------------
Date: Thu, 29 Jul 1999 22:42:29 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: How to trim a String
Message-Id: <7nr74p$oo09@news.cyber.net.pk>
: ( local $_ = shift ) =~ s/\s+|\s+$//gs;
Oops, I meant
( local $_ = shift ) =~ s/^\s+|\s+$//gs;
:P
------------------------------
Date: Thu, 29 Jul 1999 17:31:44 GMT
From: mrduane@my-deja.com
Subject: is process still running?
Message-Id: <7nq361$t7n$1@nnrp1.deja.com>
Is there a function call available that can tell me if a UNIX process is
still running, given that I have the pid?
Thanks.
-Duane
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 29 Jul 1999 17:44:37 GMT
From: "dcw" <worenklein@iname.com>
Subject: Re: is process still running?
Message-Id: <9q0o3.8710$J5.96570@c01read02-admin.service.talkway.com>
perldoc -f kill
--
Posted via Talkway - http://www.talkway.com
Exchange ideas on practically anything (tm).
------------------------------
Date: Thu, 29 Jul 1999 17:59:24 GMT
From: "Giovanni Davila" <gio98dr@yahoo.com>
Subject: LanMAN error!
Message-Id: <0E0o3.6220$OP.91545@news1.frmt1.sfba.home.com>
I'm trying to retrieve all shares on NT servers but if the server is not an
NT machine then I get this error: "Error: Runtime exception" and my program
aborts!
I'm using NetShareEnum and I'm running a script that looks for a file that
contains all the server names.
Anyone knows how to continue with the program execution and not abort?
Thank you.
------------------------------
Date: 29 Jul 1999 10:35:40 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: OOP question.
Message-Id: <m1zp0f2wb7.fsf@halfdome.holdit.com>
>>>>> "Colin" == Colin Jacobs <coljac@home.com> writes:
Colin> [...] I came across an exercise that instructed me to
EXERCISE? Is this the homework-help channel now?
Colin> create a class C that inherits from classes A and B in that order. The
Colin> trick was, if a C object should have a particular value (in this case,
Colin> instance variable "name" has value "blah") the order of inheritance
Colin> should be reversed.
So, you're being asked to do an exercise that first deals with
multiple inheritance (usually a sign of bad design) and then wants to
violate it (clearly the sign of a bad design). Have you considered
that the course you are taking in which this exercise is being
requested has been badly designed? :)
print "Just another Perl hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: 29 Jul 1999 10:38:01 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: OOP question.
Message-Id: <m1vhb32w7a.fsf@halfdome.holdit.com>
>>>>> "Eugene" == Eugene van der Pijll <pijll@phys.uu.nl> writes:
Eugene> local @ISA = ($self->{name} eq 'blah'? @_ISA : reverse @_ISA);
I believe this will either blow the lookup cache (bad), or use bad
elements from the lookup cache (bad). In either case, that's bad.
Don't be messing with @ISA more than you have to.
Just because you *can* change @ISA at runtime doesn't mean you must. :)
print "Just another Perl hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Thu, 29 Jul 1999 13:50:48 -0400
From: "John Pavlakis" <johnp@vcimail.com.remove.me>
Subject: paging text
Message-Id: <rq15q6$0$37nspbi$n2p@corp.supernews.com>
How do I page text read from STDIN or a file so it does not scroll all at
once? I am using NT and Unix. Thank you.
--
John Pavlakis
Systems Administrator
http://www.virtualcommunitiesinc.com
Remove the "remove.me" from my email
johnp@vcimail.com.remove.me
------------------------------
Date: Thu, 29 Jul 1999 17:52:13 GMT
From: "dcw" <worenklein@iname.com>
Subject: Re: perl port to windows CE ?
Message-Id: <hx0o3.8720$J5.96181@c01read02-admin.service.talkway.com>
The current opinion is that it's not doable. The small OSes (CE,
PalmOS) don't allow you to allocate a large block of continuous memory.
I believe there's going to be a get-together at the O'Reilly conference
to discuss it.
--
Posted via Talkway - http://www.talkway.com
Exchange ideas on practically anything (tm).
------------------------------
Date: 29 Jul 1999 17:33:01 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: preventing more than 1 submission
Message-Id: <7nq38d$1qj$1@lublin.zrz.tu-berlin.de>
Administrator <bobby@alpstreet.com> wrote in comp.lang.perl.misc:
>hello, - if you can get through this it would be much appreciated.
>
> I'm using a form to appened data to a pipe delimited database.
>First a user does a keyword search and gets a return on their query,
>Which might be say 6 matches.
> They then can choose to add these to their database. The problem is
>I only want them to add 1 item at a time.
> Im using an array variable in the script to add all the data to the
>database it looks like this:
>
>foreach $field (@details_row)
> {
> $details_row .= "$field\|";
> }
>
>$details_row .= "$name\|$address\|$phone\n";
You can do all of the above with
$details_row = join '|', @details_row . "|$name|$address|$phone\n";
>print BOOK "$details_row";
>close (BOOK);
So far I'm following you. I think.
> Is there a way to say if there is 2 $details_row return page
>print "sorry only one entry can be made at a time\n";
What on earth is this sentence supposed to mean? I have no idea
what the problem is.
Anno
------------------------------
Date: 29 Jul 1999 17:36:57 GMT
From: revjack <revjack@radix.net>
Subject: Re: Reading the binary files in Perl
Message-Id: <7nq3fp$aat$1@news1.Radix.Net>
Keywords: Hexapodia as the key insight
:Where is this module PSI:ESP and where can I find it?
Shame on all of you. SHAME.
------------------------------
Date: 29 Jul 1999 11:56:52 -0600
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: reg expression
Message-Id: <m3yafz1grf.fsf@moiraine.dimensional.com>
sjs@yorku.ca (Steven Smolinski) writes:
> But come on, what sort of fool is writing production code in Perl, and at
> the same time asking FAQs in newsgroups? Is it *that* easy to get a
> programming job nowadays?
Yes, it is. Especially for those willing to work for $25/hour.
dgris
--
It's good to live in the bleeding edge ;-)
------------------------------
Date: 29 Jul 1999 17:41:46 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Seeking good Perl Examples
Message-Id: <7nq3oq$1rr$1@lublin.zrz.tu-berlin.de>
James Nedham <James_Nedham@ml.com> wrote in comp.lang.perl.misc:
>I am a newbie seeking good Perl examples, not CGI scripts. I am interested
>in scripts which look for certain processes to be running which notify me
>when they ahve died. Also I want to look at perl scripts that monitor log
>files and notify me when there are certain errors
These are rather specific demands that could be realized in any
language. What is it that gives me the feeling you hope to avoid
learning Perl?
Anno
------------------------------
Date: Thu, 29 Jul 1999 17:01:28 GMT
From: jedaustin1999@my-deja.com
Subject: Re: Sending HTML emails from perl script
Message-Id: <7nq1d2$ruk$1@nnrp1.deja.com>
In article <379dde1c@news.jakinternet.co.uk>,
"Michael Dransfield" <mike@euromortgage.cc>
wrote:
> I have a script which returns the contents of a
script. It is difficult to
> read however in its current format. I would
like to send it in HTML format
> with a table.
>
> I have amended the script so that it adds
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN">
> <HEAD>
> <META content="text/html; charset=iso-8859-1"
http-equiv=Content-Type>
> <META content="MSHTML 5.00.2314.1000"
name=GENERATOR>
> <STYLE></STYLE>
> </HEAD><HTML><BODY><TABLE>
>
> (This is exactly what is returned by the form) I
added the \'s
>
> at the start of the email and then the required
<TD> and <TR> HTML tags
> between each bit of information.
>
> What am I doing wrong?? Is this possible - or
am I barking up the wrong
> tree??
>
> Mike
>
>
Are imbedding the headers needed in the email to
do this?
IE: the Content-Type line below
open (MAIL,"|/usr/sbin/sendmail $auditoremail\n");
print MAIL "MIME-Version: 1.0\n";
print MAIL "Content-Type: text/html\n";
print MAIL "Subject: $subject";
print MAIL "\n";
print MAIL "From: $from\n";
print MAIL "\n";
print MAIL "To: $to";
print MAIL "\n\n";
print MAIL "$emailbody<BR>\n";
close MAIL;
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 29 Jul 1999 10:50:26 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Sending HTML emails from perl script
Message-Id: <MPG.120a343ac6f7d4ae989d70@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7nq1d2$ruk$1@nnrp1.deja.com> on Thu, 29 Jul 1999 17:01:28
GMT, jedaustin1999@my-deja.com <jedaustin1999@my-deja.com> says...
> In article <379dde1c@news.jakinternet.co.uk>,
> "Michael Dransfield" <mike@euromortgage.cc>
> wrote:
> > I have a script which returns the contents of a
> script. It is difficult to
> > read however in its current format. I would
> like to send it in HTML format
> > with a table.
This post is difficult to read however in its current format, so I
won't.
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
Hey, Deja.com users, more than 72 characters per line is too long, but
fewer than 50 is ridiculous, especially with the clueless folding
markers (see above). Surely you can figure your 'newsreaders' better
than that!
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 29 Jul 1999 10:55:18 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Split is coming Back False?!?
Message-Id: <MPG.120a355cdd7876ac989d72@nntp.hpl.hp.com>
In article <19990729123122.07000.00000307@ng-ch1.aol.com> on 29 Jul 1999
16:31:22 GMT, Mesarchm <mesarchm@aol.com> says...
> For some reason my split function is not updating. I am getting the error "No
> such file or directory". The split function works 25% of the time, but the
> other 75% I get the error. Why would split be returning false (or zero). Here
> is the code. Any help would be appreciated.
>
> open(FILE,"$readdir\\$file") || print ERROR "couldn't open $readdir\\$file $!";
> while ($line=<FILE>)
> {splitit($line) || print ERROR "$!\n";}
> close(FILE) || print ERROR "couldn't close $file $!";
There is an error on line 17 of the splitit function.
Also, your lines are too long. Wrap them at 72 characters.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 29 Jul 1999 19:42:14 +0200
From: Niek Slatius <nslatius@dds.nl>
Subject: two forms interact with one script?
Message-Id: <37A09274.34C8A7AE@dds.nl>
Hi people,
I probably have a pretty basic question that has been asked before, but
I can't seem to find the answer in previous posts nore do i see it in
FAQ's and such. If I've overlooked somehow please forgive me and
redirect if you would. Thanx!
I have two forms in one HTML page. Both have their own submit button.
The FORM tags both call for the same perlscript in the ACTION variable.
Both forms have one hidden field each for recognision purposes. Lets say
the NAME values of each is resp. name1 and name2. Thus if one submit
button is being clicked it sends the NAME value of the HIDDEN tag from
the appropriate form.
In my perlscript I have code which interprets the HIDDEN field NAME
values like this:
IF ($FORM{'name1'})
{
#open file and write the name and email address of form name1
#close file
}
ELSEIF ($FORM{'name2'})
{
#open another file and write the name and email address of form
name2
#close file
}
This doesn't seem to work however. I've even tried giving the HIDDEN
tags the same NAME value but assigning them different VALUE values and
adjusting my perl code like this:
IF ($FORM{'hide'} eq 'name1')
{
#open file and write the name and email address of form name1
#close file
}
ELSEIF ($FORM{'hide'} eq 'name2')
{
#open another file and write the name and email address form name2
#close file
}
This doesn't seem to work either :-(.
Could somebody please shed a light on my problem. Otherwise I would have
to wright two scripts, not that that's such a hasle but its pretty
inefficient!
Any help is very much appreciated !!
Thanx in advance,
Niek Slatius
nslatius@NO_SPAM.dds.nl (you know the drill)
http://huizen.dds.nl/~nslatius
------------------------------
Date: 29 Jul 1999 17:22:46 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: use lib - Problem
Message-Id: <7nq2l6$1pb$1@lublin.zrz.tu-berlin.de>
A Zielke <azielke@hotmail.com> wrote in comp.lang.perl.misc:
>Hi,
>
>could anyone give me a hint, please?
>I'm trying to add a path to @INC.
>
>#-------SNIP-------------------------
>
>#!shebang
>use strict;
>my $BaseDir = $ENV{'FOODIR'};
>### Why is $BaseDir.'/lib' _not_ added to @INC this way?
>use lib $BaseDir.'/lib';
>use SomeModuleInFooDir;
[similar example]
>#!shebang
>use strict;
>### Why does this work, opposed to the other two ways????
>use lib $ENV{'FOODIR'}.'/lib';
>use SomeModuleInFooDir;
>
>#-------SNAP-------------------------
Because use is evaluated at compile time and $BaseDir = ... at run
time which is too late. $ENV{ FOODIR} exists at compile time. You
can do
BEGIN { $BaseDir = $ENV{ FOODIR} }
use lib "$BaseDir/lib";
if you need $BaseDir elsewhere.
Anno
------------------------------
Date: Thu, 29 Jul 1999 17:56:03 GMT
From: "dcw" <worenklein@iname.com>
Subject: Re: using sendmail in .pl
Message-Id: <TA0o3.8722$J5.96446@c01read02-admin.service.talkway.com>
Take a look at the current issue of The Perl Journal (Issue #14, Summer
1999)
http://www.tpj.com
--
Posted via Talkway - http://www.talkway.com
Exchange ideas on practically anything (tm).
------------------------------
Date: Thu, 29 Jul 1999 13:14:55 -0400
From: Keith A Arner <karner@andrew.cmu.edu>
Subject: variation on /^=/ .. /^=cut/
Message-Id: <Pine.SOL.3.96L.990729125053.1976G-100000@unix6.andrew.cmu.edu>
Say I have the following file (line numbers added for discussion
purposes):
1: #!/usr/local/bin/perl
2: =head1 Foo
3:
4: Bar
5:
6: =cut
7:
8: use strict;
If I run it through: while(<>) {print unless /^=/ .. /^=cut/}
I will get lines 1,7-8. Great.
If I run it through: while(<>) {print if /^=/ .. /^=cut/}
I will get lines 2-6. Fine.
What if I want to print the lines between (but not including) the
delimiters? In this example, lines 3-5. That is, I want the transition
states of either side of the flip flop to evaluate to false, rather than
true.
I know I could do something like:
while(<>) {
if (/^=/ ) {$flag=1; next}
if (/^=cut/) {$flag=0; next}
print if $flag;
}
...but, ICK! Is there an easier way?
Keith
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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 V9 Issue 299
*************************************