[17133] in Perl-Users-Digest
Perl-Users Digest, Issue: 4545 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 7 00:05:31 2000
Date: Fri, 6 Oct 2000 21:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <970891509-v9-i4545@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 6 Oct 2000 Volume: 9 Number: 4545
Today's topics:
Re: 1000 times slower? <rick.delaney@home.com>
Re: [UPDATE] mod_perl and ActiveState perl (v5.6.0 618) <jbaker6953@yahoo.com>
ANNOUNCE: Lingua::EN::Dict v0.20 beta <jdb@wcoil.com>
Re: Can't lock error (Martien Verbruggen)
CGI.pm and Tables question <Kurt@wagner.com>
Re: CGI.pm and Tables question <jeff@vpservices.com>
Re: factorial function problem iamnotananimal@my-deja.com
Re: factorial function problem <tony_curtis32@yahoo.com>
Re: factorial function problem <anmcguire@ce.mediaone.net>
Re: Function jump table <tzz@iglou.com>
Re: Gd library (Martien Verbruggen)
Re: How do I get a cgi script to load a url <jeff@vpservices.com>
Re: How do I get a cgi script to load a url <diab.lito@usa.net>
Re: How do I get a cgi script to load a url <jeff@vpservices.com>
looking for links to Perl+mysql how-to's - tutorials et <robert@chalmers.com.au>
Re: mod_perl and ActiveState perl (v5.6.0 618) <jbaker6953@yahoo.com>
Re: PP, 3rd ed.??? <godzilla@stomp.stomp.tokyo>
Re: PP, 3rd ed.??? <jdb@wcoil.com>
Re: PP, 3rd ed.??? <tzz@iglou.com>
Re: PP, 3rd ed.??? <godzilla@stomp.stomp.tokyo>
Re: printing a postscript file directly <juex@my-deja.com>
Re: Rounding Integers vivi16@my-deja.com
Re: Rounding Integers <godzilla@stomp.stomp.tokyo>
Re: Script sends mail, only get header!! (Martien Verbruggen)
Re: Splitting data <anmcguire@ce.mediaone.net>
STDERR>&STDOUT <chethan@cisco.com>
Re: Unexpected behavior in 5.005_03 (Martien Verbruggen)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 07 Oct 2000 02:42:00 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: 1000 times slower?
Message-Id: <39DE9045.2E417A83@home.com>
nobull@mail.com wrote:
>
> > timethese -5, {
> > VAR_INLINE => '
> > for (@lines) {
> > /^\s*$idPat\s*=\s*/o;
> > }
> > ',
> @lines and $idPat are a lexical variables in your script. As such
> when Benchmark.pm eval()s the string you give it in VAR_INLINE these
> variables are undefined. Use strict is lexically scoped so won't pick
> up this error. I don't know why the -w didn't pick it up.
Because, as you said, @lines is lexical so Benchmark.pm can't see it and
is using the empty @main::lines. Thus the loop is never entered and
$idPat is never interpolated. Of course, this answer assumes that you
were expecting a 'Use of uninitialized value' warning and not something
else.
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Sat, 07 Oct 2000 01:58:30 GMT
From: Jerry Baker <jbaker6953@yahoo.com>
Subject: Re: [UPDATE] mod_perl and ActiveState perl (v5.6.0 618)
Message-Id: <39DE833E.C4581F6A@weirdness.com>
Jerry Baker wrote:
>
> > Hi,
> > It would be good to try to track this down - others who
> > have used this mod_perl ppm haven't found such an error.
The problem only occurs if Apache is installed as a Windows NT service
(this is Windows 2000 I'm running). If you start the Apache Service, and
then stop it, it crashes. If you start Apache from the command line and
use apache -k shutdown, it does not crash.
--
Jerry Baker
PGP Key:
http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=0x8B9F6300
------------------------------
Date: 7 Oct 2000 04:02:17 GMT
From: "Josiah" <jdb@wcoil.com>
Subject: ANNOUNCE: Lingua::EN::Dict v0.20 beta
Message-Id: <8rm789$phh$0@206.230.71.50>
Greets perlfolk,
This is to announce the BETA release of:
Lingua::EN::Dict v0.20
Recomended download URL:
http://www.josiah.countystart.com/modules/get.pl?dict:clp.misc
This file has also entered the CPAN as:
file: $CPAN/authors/id/J/JB/JBRYAN/Lingua-EN-Dict-0.20.zip
size: 88914 bytes
md5: 6566bd7f410f3111b1e41088836fc489
**NAME:
Lingua::EN::Dict - BETA Version of XML english dictionary storage.
**SYNOPSIS:
use Lingua::EN::Dict;
my $dict = Lingua::EN::Dict->new('words.xml');
my $part_of_speech = $dict->type('abash');
my $verb_tense = $dict->tense('zoomed');
my $flag1 = $dict->is_verb('utilizes');
my $flag2 = $dict->is_verb('utilized');
my $flag3 = $dict->is_verb('utilizing');
my @synonyms = $dict->syns('dictate');
my @antonyms = $dict->opps('valid');
my $defenition = $dict->defn('vindicate');
undef $dict;
$dict = Lingua::EN::Dict->new(
server => e.tdcj.com
port => 7778,
}
# defaults to local file 'words.xml' if it
# cannot reach server.
# everything in first paragraph works here too
undef $dict;
$dict = Lingua::EN::Dict->new(
server => localhost
port => 7778,
}
# everything in first paragraph works here too
undef $dict;
$dict = Lingua::EN::Dict->new;
# same as above consructor, defaults to local file
# 'words.xml' if it cannot reach server.
# everything in first paragraph works here too
**DESCRIPTION
Note: BETA VERSION.
This is a small module I came up with to use as a storage format for
my humble attempt at a natural language parser (or a subset of natural
language - english that is). This is a seperate module that stores
the words in an xml-format file. With the distribution file, you
should have received an XML file called 'words.xml' that contains almost
3000 words consiting of several hundred verbs (not counting the seperate
forms of each of the verbs), as well as several hundred nouns, and
adjectives, articles, and modals. This module was created for the
storage and retrieval of words from the XML file.
The main reason for the beta relerase of this module is this: I would
like any and all feedback on the TCP server setup that I have added
to this module.
I often got fed-up with having to wait 20 - 40 seconds for the new()
constructor to load and parse the entire 590k of words just to run a
simple 2 line test script. And since I like to tweek and run, tweek
and run (the life of a Perl programmer, eh? :-), it was really annoying
to have to wait 30 seconds for each test to run, when the actual test
script took less than 50ms to run. Sooooo... I added a simple TCP transfer
setup for the dictionary.
To invovke a server process for the dictionary, simply use this one-liner:
% perl -MLingua::EN::Dict -e daemon
daemon() is a function automatically exported by this module for just this
purpose. It binds a TCP server to port 7778, accepting input from any IP
address and loads the file 'words.xml' into a dictionary object for
serving.
To create a client for this server, simply use:
my $dict = new Lingua::EN::Dict;
This automatically tries to connect to the server on port 7778 of '
localhost'. If it cannot connect to the server, it emits a warning
and proceeds to try to load the default file 'words.xml'.
The reason I released this beta version was to get input from those of
you who might have some idea of how to make sure I don't leave any
security holes in the TCP server portion.
Regards,
--
Josiah Bryan
jdb@wcoil.com
------------------------------
Date: Sat, 7 Oct 2000 13:33:56 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Can't lock error
Message-Id: <slrn8tt2sj.jr6.mgjv@martien.heliotrope.home>
On Fri, 06 Oct 2000 13:19:08 GMT,
Smitty <jpsmith@mediom.qc.ca> wrote:
> I'm sorry to be an inexperienced group user...
> Here is the problem I have:
> The perl routine is:
>
> open (FILE, ">>$data") || die "I can't open $data\n";
> if ($useflock) {
> flock (FILE, 2) or die "can't lock data file\n";
> }
Always include $! in the error message when you check system calls. It
will tell you WHY something went wrong.
> The error generated is :
>
> Content-type: text/html
> The following error occurred : can't lock data file
>
> That error occurs with perl 5.001 not with perl 5.003 (I tested it).
Looks like either your perl 5.001 is buggy, or your platform didn't
support the sort of locking perl wanted when it was compiled. Was this
5.001 compiled on this exact platform? Or have you been copying binaries
between different platform versions?
The flock in Perl can be implemented differently on different platforms.
On older platforms often an emulation using lockf or so had to be used.
More modern platforms all have flock. Sometimes this emulation wasn't
entirely successful. I've also seen perl installations 9especially on
Solaris) where the install process made the wrong decision, ending up
with a broken flock. Is that maybe what you have?
5.001 is ANCIENT. I don't really see any reason for you to still be
using it. pgrade to at least 5.004_05 (there shouldn't be any problems
there, I believe). 5.003 is ANCIENT.
You should consider upgrading to 5.6.0, but read the various perldelta
documents in the distribution to make sure that it won't break anything.
> Also when I cancel the 'flock' command, the script runs ok... but it is
> surely unsafe!
Yes, it is. If the problem is the perl binary, then you should not use
it.
>
> Do you know if there is a special option or formatting for the flock
> command in Perl 5.001?
>
> Thanks a lot.
> JPSmith
--
Martien Verbruggen |
Interactive Media Division |
Commercial Dynamics Pty. Ltd. | What's another word for Thesaurus?
NSW, Australia |
------------------------------
Date: Sat, 07 Oct 2000 03:25:23 GMT
From: Kurt Wagner <Kurt@wagner.com>
Subject: CGI.pm and Tables question
Message-Id: <cq4ttsc851an0ed6gu850it93k6mqu6q1a@4ax.com>
Hello,
Is there a way to format the contents of only a few cells in a row of
a table? I would like to change the background of a cell, but have
the other cells in the same row unaffected.
For example I use:
td({-bgcolor=>red},['cell1text', 'cell2text'])
but that changes the background color for the whole row. Is there any
way to change it for only certain cells?
Thanks a lot!
------------------------------
Date: Fri, 06 Oct 2000 20:46:29 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: CGI.pm and Tables question
Message-Id: <39DE9C95.12051B75@vpservices.com>
Kurt Wagner wrote:
>
> Is there a way to format the contents of only a few cells in a row of
> a table? I would like to change the background of a cell, but have
> the other cells in the same row unaffected.
>
> For example I use:
>
> td({-bgcolor=>red},['cell1text', 'cell2text'])
>
> but that changes the background color for the whole row. Is there any
> way to change it for only certain cells?
table(
Tr( {-bgcolor=>'blue'},
[
th({-bgcolor=>'red'},'red'),
th({-bgcolor=>'white'},'white'),
th('blue')
])
)
--
Jeff
------------------------------
Date: Sat, 07 Oct 2000 02:06:31 GMT
From: iamnotananimal@my-deja.com
Subject: Re: factorial function problem
Message-Id: <8rm0f6$a70$1@nnrp1.deja.com>
Thank you for the replies. All were helpful.
Can you point me to a reference for the Memoize function
Unless your from the bronks and just pulling my (leg). :)
Cheers,
ianaa
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 06 Oct 2000 21:22:25 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: factorial function problem
Message-Id: <87bswx1jby.fsf@limey.hpcc.uh.edu>
>> On Sat, 07 Oct 2000 02:06:31 GMT,
>> iamnotananimal@my-deja.com said:
> Thank you for the replies. All were helpful. Can you
> point me to a reference for the Memoize function
> Unless your from the bronks and just pulling my
> (leg). :)
It would be trivial to test this assertion with a web
search engine...
http://search.cpan.org/
And I think you mean "Bronx"? :-)
hth
t
--
Namaste!
And an "oogabooga" to you too!
-- Homer Simpson
------------------------------
Date: Fri, 6 Oct 2000 22:45:13 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: factorial function problem
Message-Id: <Pine.LNX.4.21.0010062244220.12847-100000@hawk.ce.mediaone.net>
On Sat, 7 Oct 2000, iamnotananimal@my-deja.com quoth:
> Thank you for the replies. All were helpful.
>
> Can you point me to a reference for the Memoize function
>
> Unless your from the bronks and just pulling my (leg). :)
[ snip ]
perl -MCPAN -e 'get Memoize'
should fetch the module for you.
anm
--
$please ++; $please ++;
open TFM, 'perldoc perl |'
and read TFM, $now, $please
for our $sake; die
"Just another Perl Hacker\n";
------------------------------
Date: 6 Oct 2000 23:34:47 -0500
From: Ted Zlatanov <tzz@iglou.com>
Subject: Re: Function jump table
Message-Id: <970889381.469@iglou.com>
In article <8rhgkq$i4d$1@magnum.mmm.com>, CDM wrote:
>Hi,
>How to build a function jump table? If say, a list of commands into a hash:
>eg. quit userQuit
> help helpHim
> showvar showVar
> display showRows
>
>and want the parser to jump to the right function. How to build/reference
>it?
a) build the table yourself
%jumptable = (
quit => sub { exit },
help => sub { print $help },
);
# access quit function
$jumptable{quit}->();
b) use a module like Parse::RecDescent. Here's an article on how to do almost
exactly what you describe:
http://www-4.ibm.com/software/developer/library/perl-speak.html?dwzone=linux
--
Teodor Zlatanov <tzz@iglou.com>
"Brevis oratio penetrat colos, longa potatio evacuat ciphos." -Rabelais
------------------------------
Date: Sat, 7 Oct 2000 12:06:40 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Gd library
Message-Id: <slrn8tstp0.jr6.mgjv@martien.heliotrope.home>
On Fri, 6 Oct 2000 10:12:51 -0400,
NCR Employee <NCR.Employee@NCR.COM> wrote:
> We have been using the GD library that is available from ActiveState's
> ActivePerl via the ppm library. With our latest upgrade, the perl programs
> appear to still work, but the image does not display.
What does that mean? How are you running this stuff? What was the
previous version of GD, and what is the current? Where is your code?
What do you mean by 'the image doesn't display'? The GD modules don't
display images.
What does 'appear to still work' mean? It either works, or it doesn't.
There are either error messages, or there aren't.
Are you checking return values of all important calls?
> Does anyone know a fix for this?
For what? We don't even know what the problem is, because you haven't
told us.
I could guess that the previous version of GD was 1.19 or before, and
the new one is 1.20 or later, and you run this stuff via the CGI, and
you are simply ignoring any possible errors. Is that the case? Read
perlfaq9 in that case:
# perldoc perlfaq9
If that isn't the case, phrase your problem correctly, present code that
displays the problem (i.e. works with the old version, but not with the
new), code that is stand-alone (NOT CGI), has been run from the command
line by you, uses -w and strict. Include any error messages.
Then, maybe, we can help.
If you go to the doctor, because you broke your arm playing football, do
you go in and say: "Doctor, something feels different from yesterday.
Can you tell me why?"
Martien
--
Martien Verbruggen |
Interactive Media Division | If at first you don't succeed, try
Commercial Dynamics Pty. Ltd. | again. Then quit; there's no use
NSW, Australia | being a damn fool about it.
------------------------------
Date: Fri, 06 Oct 2000 18:06:57 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: How do I get a cgi script to load a url
Message-Id: <39DE7731.93A1AD6A@vpservices.com>
[please put your response *after* the thing you are responding to,
thanks]
Ben Graves wrote:
>
> "Tony Curtis" <tony_curtis32@yahoo.com> wrote in message
> news:87hf6p1qnh.fsf@limey.hpcc.uh.edu...
> > >> On Sat, 7 Oct 2000 00:38:13 +0100,
> > >> "Ben Graves" <ben.graves@virgin.net> said:
> >
> > > What I would like the script to be able to do is,
> >
> > > 1) Recieve data from a form
> > > 2) Process the data
> > > 3) Send the users browser to a url.
> >
> > perldoc CGI
> >
> > redirect()
>
> How does this work?
Did you read the documentation for CGI.pm as Tony suggested? It gives
several examples of what you are trying to do.
> I have tried,
>
> redirect('http://www.bbc.com');
The redirect() method, like most CGI methods returns a value, it doesn't
print anything. If you want it to print, you have to say:
print redirect($uri);
If that isn't your problem, then you need to show more of your script.
> but this results in a server error.
If you don't tell us what the error is, how are we supposed to know?
ESP? Do you go to your doctor and say "it hurts" and then expect
him/her to guess what "it" is?
If you don't know what the error is, then run your script on the command
line and/or look in your server error logs, and/or run with CGI::Carp
qw(fatalsToBrowser). Error messages are your friend, but only if you
use them.
--
Jeff
------------------------------
Date: Sat, 07 Oct 2000 01:06:16 GMT
From: Mario <diab.lito@usa.net>
Subject: Re: How do I get a cgi script to load a url
Message-Id: <8rlsu6$7jo$1@nnrp1.deja.com>
In article <FnuD5.17843$uq5.351578@news6-win.server.ntlworld.com>,
"Ben Graves" <ben.graves@virgin.net> wrote:
> How does this work?
>
> I have tried,
>
> redirect('http://www.bbc.com');
>
> but this results in a server error.
>
Try this:
print "Location:http://www.bbc.com\n";
--
Mario
Free content for your web site:
http://www.horofree.com
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 06 Oct 2000 18:46:16 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: How do I get a cgi script to load a url
Message-Id: <39DE8068.47A0DF3F@vpservices.com>
Mario wrote:
>
> In article <FnuD5.17843$uq5.351578@news6-win.server.ntlworld.com>,
> "Ben Graves" <ben.graves@virgin.net> wrote:
> > How does this work?
> >
> > I have tried,
> >
> > redirect('http://www.bbc.com');
> >
> > but this results in a server error.
> >
> Try this:
> print "Location:http://www.bbc.com\n";
There's only three things wrong with your advice:
1) You are leading the OP away from CGI.pm which was strongly
recommended to him.
2) You have not answered the OP's question, which was, "how does the
CGI.pm redirect method work".
3) You didn't put the required two carriage returns after the URI.
But hey, that's only three mistakes in one line of code, imagine what
you could do with a full script.
--
Jeff
------------------------------
Date: Sat, 7 Oct 2000 12:00:59 +1000
From: "Robert Chalmers" <robert@chalmers.com.au>
Subject: looking for links to Perl+mysql how-to's - tutorials etc
Message-Id: <IkvD5.63$Kq1.2910@nsw.nnrp.telstra.net>
Looking for links to sites with howto's - tutorials - examples - code
examples and so on.
Does anyone know of a couple of good ones they can recommend. I know - I
could spend hours searching but maybe someone can offer a short cut.
Thanks a lot for any help
BC
------------------------------
Date: Sat, 07 Oct 2000 01:54:26 GMT
From: Jerry Baker <jbaker6953@yahoo.com>
Subject: Re: mod_perl and ActiveState perl (v5.6.0 618)
Message-Id: <39DE824E.5ABB87B4@weirdness.com>
Randy Kobes wrote:
>
> In comp.lang.perl.misc oliver@ig.co.uk <oliver@ig.co.uk> wrote:
> > I'm trying to get mod_perl to run with Apache (v1.3.12) and ActiveState
> > Perl (v5.6.0 618) under NT
>
> > I can compile mod_perl successfully by changing the library files to refer
> > to the ActiveState Perl libraries, but when I attempt to use the resulting
> > DLL, I simply get application errors...
>
> > I read an article by Sarathy (gsar@ActiveState.com) on this mailing list
> > (25th Aug) that suggested a few changes that could be made to the mod_perl
> > source to get it to work with ActiveState Perl. These changes allowed me to
> > get a working build of mod_perl, but unfortunatly it still raises an
> > application error when Apache is shutdown
>
> > The "official" Win32 ppm build of mod_perl for Win32 (made by Randy Kobes)
> > also suffer from the same problem when Apache is shutdown...
>
> > Can anyone help me with this?
>
> Hi,
> It would be good to try to track this down - others who
> have used this mod_perl ppm haven't found such an error.
I have this error as well. It is a crash in perl56.dll.
> - if you try a non-mod_perl apache configuration, and
> simply insert a line in it to load ApacheModulePerl.dll,
> does the error persist? Does it occur if you simply
> start and stop apache, or do you have to make certain
> requests to get the error?
No requests necessary.
Removed Alias and <Location> directive set up for mod_perl, but I left
the LoadModule. Still crashes.
> - are you preloading any modules? If so, can you narrow the
> error down to the preloading of any one module?
Just mod_perl
> - does the error occur only after making some requests?
> If so, is it for any request, or just certain types?
> Is there anything useful recorded in the apache error log?
> Can you narrow this down to the use of one particular
> module or script?
No. This occurs without calling any script at all. Nothing in the
error.log
> - are you using an apache binary *not* built with EAPI
> support (which is needed by, for example, mod_ssl)? The
> mod_perl ppm was compiled without EAPI support.
Default Apache install.
> - when installing things, are you sure that any files or
> libraries from possibly earlier installations aren't
> being picked up? Especially ApacheModulePerl.dll ...
I have never had mod_perl before.
--
Jerry Baker
PGP Key:
http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=0x8B9F6300
------------------------------
Date: Fri, 06 Oct 2000 18:29:21 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: PP, 3rd ed.???
Message-Id: <39DE7C71.D2217AD6@stomp.stomp.tokyo>
kj0 wrote:
> I read the 1st and 2nd editions of "Programming Perl" pretty much
> cover-to-cover when they came out. Therefore, I would like to read
> only those parts of the new 3rd edition that are substantially new
> relative to the first two editions. What would those be?
You say you have read both earlier editions of _Programming Perl_
in thier entirety. Why do you not know what is new in this
third edition? A quick glance at its table of contents and
foreword would tell you almost instantly, what is new. Open
your third edition copy and look. Like this is going to
cause you harm?
Sometimes I wonder if you people even have a lick of sense.
Godzilla!
--
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class
------------------------------
Date: 7 Oct 2000 02:59:36 GMT
From: "Josiah" <jdb@wcoil.com>
Subject: Re: PP, 3rd ed.???
Message-Id: <8rm3io$hug$0@206.230.71.61>
> You say you have read both earlier editions of _Programming Perl_
> in thier entirety. Why do you not know what is new in this
> third edition? A quick glance at its table of contents and
> foreword would tell you almost instantly, what is new. Open
> your third edition copy and look. Like this is going to
> cause you harm?
>
> Sometimes I wonder if you people even have a lick of sense.
Geesh Kiralynne... can't you answer with a bit of Kindness? There is
no need to always be so cruel and mean-spirited, always attacking
some unwary travler. It doesn't hurt you to just not answer such posts,
rather than having to subject everyone, including the poster, to some
rude comments. Geesh...you, being such a birlliant programmer (no
sarcasm intended), I would think you would at least have some people
skills...enough to know that you aren't winning any votes or changing
any minds by giving such hard-nosed replies. I am dissapointed in such
responses by the brilliant minds of this news group. One would think
that the more knowledgeable ones of this group would be more willing
to help, rather than bite everyones head off for asking a question. I agree,
a bit of commen sense could have saved kj0 his post, but I've seen many
examples of head-biting, rather than just this one. All I am suggesting
is a bit more kindness and courtesy, along with your much-desired
commen sense. Especially from you, Kiralynne.
Cheers to you all.
--
$josiah;
------------------------------
Date: 6 Oct 2000 23:26:41 -0500
From: Ted Zlatanov <tzz@iglou.com>
Subject: Re: PP, 3rd ed.???
Message-Id: <970888989.157@iglou.com>
In article <8rlraj$iee$1@panix3.panix.com>, kj0 wrote:
>I read the 1st and 2nd editions of "Programming Perl" pretty much
>cover-to-cover when they came out. Therefore, I would like to read
>only those parts of the new 3rd edition that are substantially new
>relative to the first two editions. What would those be?
As the 3rd edition is nearly twice the page count of the second one, you're
asking for quite a bit of work from someone else. Just sit down with the book
and go through it, and I guarantee you'll find every chapter worthwhile.
My review of PP3 at
http://www-4.ibm.com/software/developer/library/l-perl5.html?dwzone=linux
goes through every chapter in detail, if you are interested.
--
Teodor Zlatanov <tzz@iglou.com>
"Brevis oratio penetrat colos, longa potatio evacuat ciphos." -Rabelais
------------------------------
Date: Fri, 06 Oct 2000 20:40:00 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: PP, 3rd ed.???
Message-Id: <39DE9B10.2EDB600F@stomp.stomp.tokyo>
Josiah wrote:
> > You say you have read both earlier editions of _Programming Perl_
> > in thier entirety. Why do you not know what is new in this
> > third edition? A quick glance at its table of contents and
> > foreword would tell you almost instantly, what is new. Open
> > your third edition copy and look. Like this is going to
> > cause you harm?
> > Sometimes I wonder if you people even have a lick of sense.
> Geesh Kiralynne... can't you answer with a bit of Kindness? There is
(snipped)
Clearly you have mistaken me for someone who cares.
Ask an inane question, I may answer firmly but
fairly and, point out this inanity of yours. He
has this book. He can get off his lazy arse, open
this book and darn well look for himself. He has
wasted my personal time with his inanity.
Post a troll article such as the originating author
has, such as you have, there is a good chance I will
rip your cyber-head off and play cyber-soccer with it,
simply for wasting my time with an idiotic troll article.
I show no mercy for those who deliberately steal a
bit of my life to satiate their malice intent.
Buzz off, Frank.
Godzilla!
--
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class
------------------------------
Date: Fri, 6 Oct 2000 18:54:19 -0700
From: "Jürgen Exner" <juex@my-deja.com>
Subject: Re: printing a postscript file directly
Message-Id: <39de824c@news.microsoft.com>
[Inserting the original question and reply again]
"Brendon Caligari" <bcaligari@my-deja.com> wrote in message
news:8rh48k$cdj$1@nnrp1.deja.com...
> In article <8rfgld$ad$1@nnrp1.deja.com>,
> joseph7971@my-deja.com wrote:
> > I am trying to find out how to send a postscript file directly to a
> > printer from within a Perl program, especially for windows 95
> operating
> If your printer is a postscript printer, you
> could simply copy the postscript file to the
> printer (PRN, LTP1, \\servername\printer, whatever).
<joseph7971@my-deja.com> wrote in message
news:8rhl5a$p81$1@nnrp1.deja.com...
> Thanks for the reply. I tried to do this using a system command but it
> didn't work for me, I don't know why. I would prefer though to be able
> to print to all printer types, any other suggestions?
So, is your printer a postscript printer? As Brendon clearly stated this
works only for Postscript printers. Any other printer will either print an
ASCII dump of the PostScript code (probably not what you want) or doesn't
work at all (in the case of GDI printers).
Something will have to render the PostScript code, either the printer
directly or a SW rendering engine (Ghostscript comes to mind).
jue
------------------------------
Date: Sat, 07 Oct 2000 01:15:58 GMT
From: vivi16@my-deja.com
Subject: Re: Rounding Integers
Message-Id: <8rltgb$824$1@nnrp1.deja.com>
Okay. Let's say I always want to round up and to the hundreds. Do you
have a method aside from my first post?
In article <39DE65EA.F6C575A3@motorola.com>,
Matthew Stoker <matt.stoker@motorola.com> wrote:
> vivi16@my-deja.com wrote:
> >
> > Can you use sprintf(); to round integers? I want to round something
> > like 4568 to 4600. I suppose if I knew a number was always going
to be
> > in the thousands, I could divide by 100, use the CEIL function and
then
> > multiply by 100. But is there an easier way or built in command?
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
>
> Yes, in some cases sprintf() can be used to round integers. But you
> should be a little more specific about what you mean by rounding? Do
you
> want to always round to the hundreds place or do you just want 2
> significant figures? Also, which specific rounding rules do you wish
to
> use? The following are some common rules:
>
> 1. Always round down. (i.e. 4568 -> 4500, 3850 -> 3800, 3750 ->
3700)
>
> 2. Round up if x=>0.5 else round down (i.e. 4568 -> 4600, 3850 ->
3900,
> 3750 -> 3800, 2448 -> 2400)
>
> 3. Round up if x>0.5, round down if x < 0.5 and round to even number
if
> x = 0.5 (i.e. 4568 -> 4600, 3850 -> 3800, 3750 -> 3800, 2448 -> 2400)
>
> --
> /------------------------------------------------------------------\
> | Matt Stoker | email: matt.stoker@motorola.com |
> | Unit Process Modeling | Mail Drop: M360 |
> | DigitalDNA(TM) Laboratories| Phone: (480)655-3301 |
> | Motorola, SPS | Fax: (480)655-5013 |
> | 2200 W Broadway Road | Pager: (888)699-8803 |
> | Mesa, AZ 85202 | |
> \------------------------------------------------------------------/
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 06 Oct 2000 20:23:37 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Rounding Integers
Message-Id: <39DE9739.8F183A9F@stomp.stomp.tokyo>
vivi16 wrote:
> Matthew Stoker wrote:
> > vivi16 wrote:
(snipped)
> Okay. Let's say I always want to round up and to the hundreds.
> Do you have a method aside from my first post?
"Let's say...."
* laughs *
There is no clear rule for rounding off numbers which
are not decimal in nature. Reason for this is rounding
off numbers left of a decimal place, gives an extremely
wide margin of error, unless you are dealing with numbers
a million or over. Rounding off tens, perhaps hundreds,
would be acceptable when dealing with a number a million
or over. Why do you want to introduce so much error into
your numbers?
* shrugs *
Do not respond with changed parameters and,
"This does not work."
Godzilla!
--
Robby The Remarkable Robot, Cowboy Song Writer
http://la.znet.com/~callgirl/android/cowboy.cgi
TEST SCRIPT:
____________
#!/usr/local/bin/perl
print "Content-Type: text/plain\n\n";
$number = 149;
&Do_It;
$number = 150;
&Do_It;
$number = 151;
&Do_It;
$number = 100;
&Do_It;
$number = 3149;
&Do_It;
$number = 3150;
&Do_It;
$number = 3151;
&Do_It;
$number = 3100;
&Do_It;
$number = 31549;
&Do_It;
$number = 31550;
&Do_It;
$number = 31551;
&Do_It;
$number = 31000;
&Do_It;
$number = 3.51;
&Do_It;
$number = 50;
&Do_It;
$number = 0000;
&Do_It;
$number = "0000";
&Do_It;
$number = "";
&Do_It;
sub Do_It
{
if ($number == 0)
{ print "You are an idiot.\n"; }
elsif (index ($number, ".") > -1)
{ print "You are an idiot.\n"; }
elsif (length ($number) < 3)
{ print "You are an idiot.\n"; }
else
{
print "Input: $number\n";
if (substr ($number, -2, 2) <= 50)
{ $round = substr ($number, -2, 2, "00"); }
else
{
$round = substr ($number, -2, 2, "00");
$round = substr ($number, -3, 1, substr ($number, -3, 1) + 1);
}
}
if (length ($number) > 0)
{ print "Output: $number\n\n"; }
else
{ print "There is no number.\n\n"; }
}
exit;
PRINTED RESULTS:
________________
Input: 149
Output: 100
Input: 150
Output: 100
Input: 151
Output: 200
Input: 100
Output: 100
Input: 3149
Output: 3100
Input: 3150
Output: 3100
Input: 3151
Output: 3200
Input: 3100
Output: 3100
Input: 31549
Output: 31500
Input: 31550
Output: 31500
Input: 31551
Output: 31600
Input: 31000
Output: 31000
You are an idiot.
Output: 3.51
You are an idiot.
Output: 50
You are an idiot.
Output: 0
You are an idiot.
Output: 0000
You are an idiot.
There is no number.
------------------------------
Date: Sat, 7 Oct 2000 12:29:06 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Script sends mail, only get header!!
Message-Id: <slrn8tsv32.jr6.mgjv@martien.heliotrope.home>
On Fri, 06 Oct 2000 23:35:03 GMT,
Dean J. Pompilio <dean_j_pompilio@yahoo.com> wrote:
> I have a perl script which mails an output file to my account on
> another Unix box. Here are the two commands I have tried:
>
> `cat $outfile | mailx -s $outfile me\@unix.com`;
>
> system("cat $outfile | mailx -s $outfile me\@unix.com");
Why are you treating Perl as a shell script language? There are many
modules out there that can do this for you.
Have you thought about what happens if
$outfile = '; rm -rf /;';
? Do you know what happens now? Why are you using cat? Why are you using
mailx, which is not available on that many systems? Have you read the
perl FAQ?
# perldoc -q 'send.*mail'
Found in /opt/perl/lib/5.6.0/pod/perlfaq9.pod
How do I send mail?
[SNIP]
> If I run the command from the shell, everything works just fine. Any
> ideas Perl/Unix gurus????
Yep. Don't use cat unnecessarily. If you must use mailx, read its manual
page. But... Don't use mailx. If you must directly use an external
program, use sendmail (and realise that sendmail may not be in the
user's path). But, to avoid making silly mistakes, just use one of the
modules from CPAN
http://search.cpan.org/
http://www.cpan.org/
Oh, and READ this group before you post. The question 'ho do I send
email' comes up at least once a week here. It's probably the most FAQ
there is. Almost.
Martien
--
Martien Verbruggen |
Interactive Media Division |
Commercial Dynamics Pty. Ltd. | Curiouser and curiouser, said Alice.
NSW, Australia |
------------------------------
Date: Fri, 6 Oct 2000 21:44:54 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: Splitting data
Message-Id: <Pine.LNX.4.21.0010062139370.12400-100000@hawk.ce.mediaone.net>
On Fri, 6 Oct 2000, Linc Madison quoth:
LM> In article <slrn8trhtp.f8v.bernard.el-hagin@gdndev25.lido-tech>,
LM> Bernard El-Hagin <bernard.el-hagin@lido-tech.net> wrote:
LM>
LM> > On Fri, 06 Oct 2000 12:06:15 GMT, vivekvp <vivekvp@spliced.com> wrote:
LM> > > Hello,
LM> > >
LM> > >I have a list of delimited data like this:
LM> > >
LM> > >BILL|$10000|555-5555|4|HOUSE|NEW YORK
LM> > >CHRIS|$4000|666-6666|7|APT|BOSTON
LM> > >LIU|$120000|777-7777|12|MANSION|SHANGHAI|CHINA
LM>
[ snip ]
LM> Close but not quite. As posted, there is an optional additional field
LM> at the end for the country if it's not USA (extrapolating from what's
LM> shown). However, the basic concept is correct.
LM>
LM> Why are you bothered about assigning to variables you don't use? It
LM> shouldn't be an issue, even with 200 fields. If it's cleaner, you can
LM> index the split array directly, or, if you're using 14 of the 200
LM> fields, you might do something like
LM>
LM> @temp = split '|', $line;
LM> $phone = $temp[2];
LM> $city = $temp[5];
Why even do that though? Use my in a list context to select the elements you
need from the list that split returns.. Also both of your posts are just plain
wrong, as splitting on '|' will make $temp[2] eq 'L' for the line:
BILL|$10000|555-5555|4|HOUSE|NEW YORK
You have to backwack the '|'.
--
perl -wMstrict -e '
$a=[[qw[J u s t]],[qw[A n o t h e r]],[qw[P e r l]],[qw[H a c k e r]]];$.++
;$@=$#$a;$$=[reverse sort map$#$_=>@$a]->[$|];for$](--$...$$){for$}($|..$@)
{$$[$]][$}]=$a->[$}][$]]}}$,=$";$\=$/;print map defined()?$_:$,,@$_ for @$;
'
------------------------------
Date: Fri, 06 Oct 2000 18:42:08 -0700
From: Chethan Anand <chethan@cisco.com>
Subject: STDERR>&STDOUT
Message-Id: <39DE7F70.B3859876@cisco.com>
Hello,
I have a small problem.
I have one statement "my $cmd = open(QBTFILE, "$arg 2>&1 |");" .
This statement is not being executed on NT. When I see the variable it
says undef .
This is happening on one system. Can you help me out ??
Thanks,
Chethan
------------------------------
Date: Sat, 7 Oct 2000 12:22:53 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Unexpected behavior in 5.005_03
Message-Id: <slrn8tsund.jr6.mgjv@martien.heliotrope.home>
On Fri, 06 Oct 2000 17:54:58 GMT,
mrcribbins@my-deja.com <mrcribbins@my-deja.com> wrote:
> open(TBR, "/mweb/docs/IT/$2") or warn $!;
>
> # Opened read-only unless $^I is defined, right?
>
> while (<TBR>) {
Euhmmm.. I would doubt that, but it's hard to tell. The documentation on
$^I points of to the -i switch. The documentation on -i states:
-i[extension]
specifies that files processed by the `<>' construct
are to be edited in-place. It does this by renaming
Note that it only mentions <>, as in the empty magic use of the diamond
operator. Now... That is of course a bit ambiguous. But I think what is
really meant is _only_ the files opened through the magic of <>. The
file you mention above isn't magically opened, but explicitly.
> I ended up with a bunch of 0 length files, and no backup copies.
> (Fortunately, I do have backup tapes...) Is this a bug, or am I
> an idiot? Or both?
However, that should mean that it should not write to those files, and
indeed, it doesn't.
# ls -l feeb*
-rw------- 1 mgjv users 1474 Oct 5 21:49 feebie
-rw------- 1 mgjv users 1474 Oct 7 12:15 feeboo
# cat foo
#!/usr/local/bin/perl -w
use strict;
$^I = '.bak';
while(<>)
{
chomp;
open(FOO, $_) or die "$_: $!";
while (my $line = <FOO>)
{
$line =~ s/foo/bar/;
}
close FOO;
}
# ./foo
feebie
feeboo
^D
# ls -l feeb*
-rw------- 1 mgjv users 1474 Oct 5 21:49 feebie
-rw------- 1 mgjv users 1474 Oct 7 12:15 feeboo
I'm not sure why your program clobbers files, but the code above
doesn't. (5.00503 and 5.6.0) Of course, it also doesn't change the
files.
Martien
--
Martien Verbruggen |
Interactive Media Division | System Administration is a dirty
Commercial Dynamics Pty. Ltd. | job, but someone said I have to do
NSW, Australia | it.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 4545
**************************************