[18398] in Perl-Users-Digest
Perl-Users Digest, Issue: 566 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 26 06:05:46 2001
Date: Mon, 26 Mar 2001 03:05:15 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <985604714-v10-i566@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 26 Mar 2001 Volume: 10 Number: 566
Today's topics:
Email do not show up in MYSQL <vivekvp@spliced.com>
Re: FAQ 8.24: Why can't I get the output of a command <persicom@acedsl.com>
Re: fetch back STDERR outputs <johnlin@chttl.com.tw>
FOREACH little victory, I take a beating <pigpen@easynews.com>
Re: FOREACH little victory, I take a beating (Bernard El-Hagin)
Re: Help needed: simulating a browser to download web-b <tinamue@zedat.fu-berlin.de>
Re: Hmmm... Which PERL Book Is Best Suited For This??? <sheryle@mediaone.net>
Re: How to post to a newsgroup from a script? blah@blah.blah.invalid
Net::FTP <David.Hiskiyahu@alcatel.be>
Re: Net::FTP <wuerz@yahoo.com>
Re: Net::FTP <wuerz@yahoo.com>
Newbie help <chaga@hotmail.com>
Re: Newbie help <krahnj@acm.org>
Re: passwd change from cgi-script (Alan Barclay)
Perl for ISAPI <Patrick_member@newsguy.com>
Perl is much simpler than it looks! <bones3d@charter.net>
Re: Perl public key encryption <chris@cake.clara.net>
Re: PERL (Bernard El-Hagin)
Re: PLEASE HELP (0/1) <c_clarkson@hotmail.com>
Re: Problem running 'traceroute' command from perl scri <johnlin@chttl.com.tw>
Re: Problem running 'traceroute' command from perl scri (Andre Malo)
Reading Ms Word <tom@hotversion.com>
remove 'new line' from last element in array <tobias.ruehle@de.bosch.com>
Re: remove 'new line' from last element in array <wuerz@yahoo.com>
Re: remove 'new line' from last element in array <wyzelli@yahoo.com>
Re: require'ing OO modules on the fly - any danger? <uri@sysarch.com>
Re: require'ing OO modules on the fly - any danger? <iltzu@sci.invalid>
Re: Routine to Color-Code Java/C/C++ Code [OT] (Rafael Garcia-Suarez)
Re: Statistics <jonni@ifm.liu.se>
String::Approx buggy ? <scollyer@netspinner.dont-spam.co.uk>
system() return value <kellyboy@nospanner>
Re: system() return value <philipg@atl.mediaone.net>
Re: the space (Martien Verbruggen)
Re: Writing a script to install Perl modules automatica <persicom@acedsl.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 26 Mar 2001 10:55:51 GMT
From: Victor Prasad <vivekvp@spliced.com>
Subject: Email do not show up in MYSQL
Message-Id: <3ABF2189.6DD2C803@spliced.com>
Hello,
I am trying to use an HTML form to a perl script to pass an email
address in the form:
test@test.com
It shows up in the database and perl script as: test%40test.com
I am using the POST method - how do I get it to enter it correctly?
Thanks,
V
------------------------------
Date: Sun, 25 Mar 2001 22:16:03 -0500
From: "Matthew O. Persico" <persicom@acedsl.com>
Subject: Re: FAQ 8.24: Why can't I get the output of a command with system()?
Message-Id: <3ABEB473.29A33837@acedsl.com>
PerlFAQ Server wrote:
>
> This message is one of several periodic postings to comp.lang.perl.misc
> intended to make it easier for perl programmers to find answers to
> common questions. The core of this message represents an excerpt
> from the documentation provided with every Standard Distribution of
> Perl.
>
> +
> Why can't I get the output of a command with system()?
>
> You're confusing the purpose of system() and backticks (``). system()
> runs a command and returns exit status information (as a 16 bit value:
> the low 7 bits are the signal the process died from, if any, and the
> high 8 bits are the actual exit value). Backticks (``) run a command and
> return what it sent to STDOUT.
>
> $exit_status = system("mail-users");
> $output_string = `ls`;
>
Given this, how useful does anyone else feel about a module that could
call a 'command' with the following properties:
- Get the output (a 'la backticks)
- Get the exit info (a 'la system)
- Specify which exit values indicate success/warning/failure and text to
describe each status
- Specify a timeout maximum running time in seconds, after which the
command is killed, all output to that point is returned.
--
Matthew O. Persico
http://www.acecape.com/dsl
AceDSL:The best ADSL in Verizon area
------------------------------
Date: Mon, 26 Mar 2001 14:47:20 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Re: fetch back STDERR outputs
Message-Id: <99mr3c$rmq@netnews.hinet.net>
nobull writes
> "John Lin" writes:
> > > Get rid of the local().
> > Hmm... I thought it was a good habbit
> No using local() is not a good habit.
open TOUCH,"+>zero-length.file" or die $!;
# ... and implicitly close
Name "main::TOUCH" used only once: possible typo at line 1.
I remember I tried many ways to shut it up and finally found
local *TOUCH;
That's how I mis-got this habit of putting
local *FILEHANDLE;
before first using FILEHANDLE, just like the habbit of my();
Best regards.
John Lin
------------------------------
Date: Mon, 26 Mar 2001 05:12:13 GMT
From: "Nancy" <pigpen@easynews.com>
Subject: FOREACH little victory, I take a beating
Message-Id: <NcAv6.2677$dM.549831@news.easynews.com>
I have the following foreach statement that I can't beat into submission. It
reads @orders just fine and prints each line of the output properly, but I
also need to look at each line, and set a corresponding variable. The best
I can come up with only seems to be reading the last line of @orders to set
the variables, but otherwise processes each line properly. BTW, there will
never be more than 4 lines in @orders. What basic concept am I failing to
grasp here?
my ($i)=0;
foreach $line (@orders) {
($qty, $item, $desc, $price, $ship, $taxit, $ship_boxes, $page_title,
$plex, $originals) = split (/$delimit/, $line);
if ($item eq 'Cover Charges') {$msg_cov = 0; } else { $msg_cov =
1; }
if ($item eq 'Inserts') {$msg_ins = 0; } else { $msg_ins = 1; }
if ($item eq 'Finishing') {$msg_fin = 0; } else { $msg_fin =
; }
++$i;
print " A lot of the data in a pretty format. \n";
}
TIA!
nan-
------------------------------
Date: Mon, 26 Mar 2001 07:18:27 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: FOREACH little victory, I take a beating
Message-Id: <slrn9btr7m.cpa.bernard.el-hagin@gdndev32.lido-tech>
On Mon, 26 Mar 2001 05:12:13 GMT, Nancy <pigpen@easynews.com> wrote:
>I have the following foreach statement that I can't beat into submission. It
>reads @orders just fine and prints each line of the output properly, but I
>also need to look at each line, and set a corresponding variable. The best
>I can come up with only seems to be reading the last line of @orders to set
>the variables, but otherwise processes each line properly. BTW, there will
>never be more than 4 lines in @orders. What basic concept am I failing to
>grasp here?
>
>my ($i)=0;
>foreach $line (@orders) {
> ($qty, $item, $desc, $price, $ship, $taxit, $ship_boxes, $page_title,
>$plex, $originals) = split (/$delimit/, $line);
>
> if ($item eq 'Cover Charges') {$msg_cov = 0; } else { $msg_cov =
>1; }
> if ($item eq 'Inserts') {$msg_ins = 0; } else { $msg_ins = 1; }
> if ($item eq 'Finishing') {$msg_fin = 0; } else { $msg_fin =
>; }
> ++$i;
>print " A lot of the data in a pretty format. \n";
You didn't provide sample data which makes it very difficult for us to
help. If you decide to post your question again with sample data
included remember to also tell us what $delimit is.
Cheers,
Bernard
--
#requires 5.6.0
perl -le'* = =[[`JAPH`]=>[q[Just another Perl hacker,]]];print @ { @ = [$ ?] }'
------------------------------
Date: 26 Mar 2001 08:15:40 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: Help needed: simulating a browser to download web-based mail
Message-Id: <99mtrc$1u2s3$1@fu-berlin.de>
In comp.lang.perl.misc CSW <abc@def.ghi> wrote:
> Tina Mueller wrote:
>> In comp.lang.perl.misc CSW <abc@def.ghi> wrote:
>>
>> > What I'm looking for is a script/program for simulating a browser,
>> > including the password authentication and cookies bits, so that I can
>> > automate the download process.
>>
>> perldoc lwpcook
>
> Thanks. "lwpcook" is the cookbook; where can I find the reference
> documentation for LWP?
well, guess...
perldoc LWP
perldoc LWP::Simple
perldoc LWP::UserAgent
...
hth, tina
--
http://tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
please don't email unless offtopic or followup is set. thanx
------------------------------
Date: Mon, 26 Mar 2001 03:30:00 GMT
From: Patrick Martin <sheryle@mediaone.net>
Subject: Re: Hmmm... Which PERL Book Is Best Suited For This???
Message-Id: <3ABEBAEF.312A03BA@mediaone.net>
Programming Perl is the Perl bible. Buy whatever book you want, in
the end, you'll buy Programming Perl too. It's a great read, and
probably
a large part of the overall success of Perl in general. Larry's style
of
writing had me glued to the book. I read it twice and probably learned
even more the second time through. It works well as a reference too.
- Pat
---Pete--- wrote:
>
> On 25 Mar 2001 17:06:54 GMT, "Scott R. Godin"
> <webmaster@webdragon.unmunge.net> wrote:
>
> >"Programming Perl" by Larry Wall, Tom Christiansen, and Randal Schwartz
> >has been pretty much my 'bible' as far as that goes. I haven't picked up
> >too many others yet simply because I've been focusing my attentions on
> >specific aspects like DBI (for which I bought "Programming the Perl
> >DBI") and OO stuff (for which I picked up Damian Conway's excellent
> >"Object Oriented Perl")
> ------
> Upon reviewing all those books, it was a close race between
> "Programming Perl" and "Mastering PERL 5". I thought that
> "Mastering PERL 5" was well organized, indexed best and the
> type was larger making it easier on the eyes, but the
> "Programming Perl" book won out becasue it was more detailed
> and had more examples in the topics I was interested in.
>
> >I must have read through PP about 7 times now, and as my knowledge grows
> >(you know the drill: skim the parts you can't understand clearly, and
> >keep reading til you finish. then try some stuff, and look up what you
> >need to.. then re-read the book again, and you'll find that some things
> >are now clearer and you skim less and less as time goes on... :), I've
> >found the book to be incredibly useful.
> -------
> I agree 100% with your methods above -- yeah, I do that too <grin>.
> Something, I've always found to be true when learning just about
> anything new is that it's best to get 3 books on the same topic
> written by 3 different authors. No single author ever seems to
> explain things 100%. When you read the same topic covered in
> 3 different writing styles, it usually clears up any confusing issues.
>
> ---pete---
------------------------------
Date: Mon, 26 Mar 2001 05:01:10 -0000
From: blah@blah.blah.invalid
Subject: Re: How to post to a newsgroup from a script?
Message-Id: <tbtj8mmhlu7183@corp.supernews.com>
Chris Thompson <waverley2000@hotmail.com> wrote:
> Hi! I am currently trying to build a script which will post details of job
> vacancies to relevant jobs newsgroups. I have a suspicion a newsgroup
> posting could be done using the Net::NNTP module, but despite my best
> efforts I haven't been able to get this to work.
>
> Any advice or examples of similar scripts would be much appreciated.
Net::NNTP (or News::NNTPClient) is the right way to go. They both come
with fine documentation. Since you haven't said what you have done,
I'm not in any position to tell you what to do next. My general advice,
though, is to try harder.
Eric
------------------------------
Date: Mon, 26 Mar 2001 11:16:36 +0200
From: David Hiskiyahu <David.Hiskiyahu@alcatel.be>
Subject: Net::FTP
Message-Id: <3ABF08F4.CD590127@alcatel.be>
Can anyone please refer to an example using Net::FTP?
There is a good documentation at:
http://search.cpan.org/doc/GBARR/libnet-1.0703/Net/FTP.pm
However, I am running in some practical problems using
this stuff, an example would help.
--
Quote of the day:
Life is anything that dies when you stomp on it.
- Dave Barry
------------------------------
Date: Mon, 26 Mar 2001 11:36:47 +0200
From: Mona Wuerz <wuerz@yahoo.com>
Subject: Re: Net::FTP
Message-Id: <260320011136470979%wuerz@yahoo.com>
In article <3ABF08F4.CD590127@alcatel.be>, David Hiskiyahu
<David.Hiskiyahu@alcatel.be> wrote:
> Can anyone please refer to an example using Net::FTP?
>
> There is a good documentation at:
> http://search.cpan.org/doc/GBARR/libnet-1.0703/Net/FTP.pm
>
> However, I am running in some practical problems using
> this stuff, an example would help.
what problems exactly?
#!:perl -w
use strict;
use Net::FTP;
my $host = 'ftp.ruhr-uni-bochum.de';
my $ftp = Net::FTP->new($host, Timeout=>10) or
die "could not connect to $host : $!";
$ftp->login('anonymous', 'David.Hiskiyahu@alcatel.be');
$ftp->cwd('/pub/CPAN/modules/by-module/Net/');
$ftp->get('Net-FTP-Common-1.9.tar.gz');
$ftp->quit;
-mona
------------------------------
Date: Mon, 26 Mar 2001 11:43:53 +0200
From: Mona Wuerz <wuerz@yahoo.com>
Subject: Re: Net::FTP
Message-Id: <260320011143536630%wuerz@yahoo.com>
In article <260320011136470979%wuerz@yahoo.com>, Mona Wuerz
<wuerz@yahoo.com> wrote:
> In article <3ABF08F4.CD590127@alcatel.be>, David Hiskiyahu
> <David.Hiskiyahu@alcatel.be> wrote:
>
> > Can anyone please refer to an example using Net::FTP?
> #!:perl -w
> use strict;
> use Net::FTP;
>
> my $host = 'ftp.ruhr-uni-bochum.de';
>
> my $ftp = Net::FTP->new($host, Timeout=>10) or
> die "could not connect to $host : $!";
>
> $ftp->login('anonymous', 'David.Hiskiyahu@alcatel.be');
> $ftp->cwd('/pub/CPAN/modules/by-module/Net/');
uh, for the file in this example you might want to say
$ftp->binary;
at this point. (duh me)
> $ftp->get('Net-FTP-Common-1.9.tar.gz');
> $ftp->quit;
-mona
------------------------------
Date: Mon, 26 Mar 2001 01:33:56 -0500
From: Mo <chaga@hotmail.com>
Subject: Newbie help
Message-Id: <3ABEE2D4.ECBC49C2@hotmail.com>
Newbie Help.
I am having trouble getting the second option right.....I can't figure
out what I am doing wrong ...help. Thankx
#!/usr/bin/perl
print "content-type:text/html\n\n";
read (STDIN, $query_string, $ENV{'CONTENT_LENGTH'});
($junk, $option) = split (/=/, $query_string);
%capital = ("e", "E", "i", "I", "o", "O", "u", "U");
@ARGV = ("ass3.txt");
if ($option == 1)
{
printf " Convert Vowels to Upper Case(except a)</b><br><br>";
while (<>)
{
s/([eiou])/$capital{$1}/g;
printf $_;
printf "<br>";
}
}
#This is what I am having trouble with. How do I Reverse the order of
last two words of #each input line from the file ass3.txt(or any file
for that matter)?? Any help would br appreciated
elsif ($option == 2)
{
printf " Reverse the order of last two words of each input
line</b><br><br>";
while (<>)
{
chop;
@words = split;
$NumberOfWords = @words;
if ($NumberOfWords > 1)
{
for ($i = 1; $i >= 0; $i--)
{
printf $words[$i];
printf " ";
}
for ($i = 2; $i < $NumberOfWords; $i++)
{
printf $words[$i];
printf " ";
}
printf "<br>";
}
}
}
------------------------------
Date: Mon, 26 Mar 2001 08:00:07 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Newbie help
Message-Id: <3ABEF895.912B1BFA@acm.org>
Mo wrote:
>
> Newbie Help.
>
> I am having trouble getting the second option right.....I can't figure
> out what I am doing wrong ...help. Thankx
>
> #!/usr/bin/perl
#!/usr/bin/perl -w
use strict;
> print "content-type:text/html\n\n";
>
> read (STDIN, $query_string, $ENV{'CONTENT_LENGTH'});
>
> ($junk, $option) = split (/=/, $query_string);
my ( undef, $option ) = split( /=/, $query_string );
# or
my $option = (split( /=/, $query_string )[ 1 ];
> %capital = ("e", "E", "i", "I", "o", "O", "u", "U");
>
> @ARGV = ("ass3.txt");
>
> if ($option == 1)
> {
> printf " Convert Vowels to Upper Case(except a)</b><br><br>";
print " Convert Vowels to Upper Case(except a)</b><br><br>";
You don't need printf as you are not using format strings.
From perlfunc:
Don't fall into the trap of using a printf() when
a simple print() would do. The print() is more
efficient and less error prone.
> while (<>)
> {
> s/([eiou])/$capital{$1}/g;
s/([eiou])/uc($1)/eg;
# or
tr/eiou/EIOU/;
> printf $_;
> printf "<br>";
print "$_<br>";
> }
>
> }
>
> #This is what I am having trouble with. How do I Reverse the order of
> last two words of #each input line from the file ass3.txt(or any file
> for that matter)?? Any help would br appreciated
> elsif ($option == 2)
> {
> printf " Reverse the order of last two words of each input
> line</b><br><br>";
print " Reverse the order of last two words of each input
line</b><br><br>";
> while (<>)
> {
> chop;
chomp;
> @words = split;
my @words = reverse split;
if ( @words > 2 ) {
@words = ( reverse( splice( @words, 2, @words - 2 ) ), @words[ 0, 1
] );
}
print "@words<br>";
>
> [snip code]
>
> }
John
--
use Perl;
program
fulfillment
------------------------------
Date: 26 Mar 2001 03:23:14 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: passwd change from cgi-script
Message-Id: <985576972.578337@elaine.furryape.com>
In article <99lt6k$152$1@allnight.news.cais.net>,
ganesh <ganesh@gcol.com> wrote:
>We're trying to use a cgi-script to change passwords from the unix
>/etc/passwd file. However, the passwd command prompts the user
>and I need for it to recognize that the input is being "piped" to it
>rather
>than prompting for it. Does anyone have any suggestions.
If you don't already know, then don't do it, because you don't have
the knowledge required to make it secure.
------------------------------
Date: 25 Mar 2001 22:58:31 -0800
From: Patrick Flaherty <Patrick_member@newsguy.com>
Subject: Perl for ISAPI
Message-Id: <99mpan02h53@drn.newsguy.com>
Hello,
New to Perl but an experienced programmer.
Installed ActiveState 5.6 Build 623 on a W2000 box running IIS 5.0. Want to use
Perl in conjunction with IIS 5.0.
Configured .pl's to run perlIS.dll in the IIS snap-in; made a test script in
c:\inetpub\scripts and it runs successfully.
What I'd like to investigate is Perl for ISAPI. There's some HTML documentation
on it in the Perl install directory tree, but it doesn't give you an API,
object-model, whatever ...
How does one use Perl for ISAPI?
thanx.
pat
------------------------------
Date: Sun, 25 Mar 2001 23:46:17 -0600
From: James Meade <bones3d@charter.net>
Subject: Perl is much simpler than it looks!
Message-Id: <bones3d-50A432.23461725032001@corp.supernews.com>
Hey all,
I just got done putting together my first major perl script, with little
more than a few snippets of code to learn from! I'm truely amazed at
just how fast I picked up on it! It's only been 4 days since I started
and I'm already using it for my websites!
I only wish I would have known how easy it was long before now! :-)
Anyway, if anyone's interested, check out the script in action over at:
http://www.themarketspace.com/personal/base/
The script is a script generator for that "all your base are belong to
us" thing floating around on the internet. It's a project I ported from
shockwave to perl to get around some copying problems with the shockwave
playing in a browser.
8==8 Bones 8==8
------------------------------
Date: Mon, 26 Mar 2001 07:43:39 +0100
From: "Chris Eason" <chris@cake.clara.net>
Subject: Re: Perl public key encryption
Message-Id: <wyBv6.50241$g63.6757199@nnrp3.clara.net>
"Ross Younger" <news04@crazyscot.com> wrote in message
news:i+d*Qh5Ro@news.chiark.greenend.org.uk...
>
> (I presume you're talking about a managed web service arrangement, along
> the lines of you supplying HTML, CGIs, whatever to the ISP and they put
> your files (along with those of their other customers) on a single or
> load-balanced web server.)
>
Exactly.
> This doesn't answer your question, but...
>
> You quite rightly point out that anybody with the root password to the web
> server could read your data files. (I am presuming that customer data
> will be transmitted over SSL (https) so there's no problem of traffic
> sniffing en route.)
Your presumption is correct. I will be using SSL.
> I observe that anybody with the root password
> would surely be in a position to compromise the web server itself, or
> tamper with your CGIs -- the encrypted data from the remote browser has
> to be decrypted at some point, and it could plausibly be copied then by
> an evildoer. (Admittedly, that attack probably takes more effort than
> simply reading your data files.)
I suppose the encrypted data from the remote browser will be decrypted by
Apache HTTP server and passed on to the Perl program. The Perl program will
then encrypt it again before writing it to a file on the webserver. The
encrypted file will only be decrypted when it's on my desktop PC. Of course,
some might argue that a Windows PC is less secure than an ISP's UNIX
webserver, but in this context I'm sure the encrypted files will be safe on
my PC, for several reasons which I'm not going to go into here because it
would distract from the original question that I posted. But, incidentally,
getting the data to my PC is another reason why I want the data to be
encrypted, since my ISP doesn't support secure FTP.
>
> I don't think I'm trying to talk you out of this setup :-); what you
> describe *is* a difficult problem to solve. Recent literature touts
> security as being relative; if you're harder to attack than the next guy,
> certain classes of attacker will pass you over. There exists a point
> where it's probably more useful to perform a detailed risk assessment
> than spend (some might say waste) time reviewing every last technical
> detail in pursuit of potential security holes. Hey, if you're /that/
> paranoid, why are you listening to me? :-)
>
>
> Ross
>
------------------------------
Date: Mon, 26 Mar 2001 07:07:34 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: PERL
Message-Id: <slrn9btqgg.cpa.bernard.el-hagin@gdndev32.lido-tech>
[fixed jeopardy...sigh]
On Fri, 23 Mar 2001 18:02:45 -0500, David J. Marcus
<djmarcus@ex-pressnet.com> wrote:
[snip]
>'Marcus' would post something, except Marcus is a newbie to Perl and knows
>better.
Marcus may be a newbie to Perl, but the question "Is there a Perl
shopping cart available for download somewhere?" suggests that Marcus is
basically "new". It's a stupid question to ask here, because:
1. it has an obvious answer ("yes"),
2. suggests that the person posting such a question is, as Uri suggested,
a KLB,
and, to top it off,
3. really has little to do with Perl since this forum isn't for discussing
anything and everything that even remotely concerns Perl. If that
weren't the case we'd soon have questions such as "My dog's name is
Perl and she ran away. Has anyone seen him?" popping (or rather
'pooping') up.
>I am in the listen/learn mode until I get more Perl-ized. Currently I'm
>still thinking in C++/Java/VB mode.
So?
>My response was really to politely chastise the original responder for being
>so flippant about his 'response'... it is a waste of time to read through
>such messages.
Actually, I believe that such reponses tend to make people think twice
about posting such 'questions' in future which is reason enough for me
to keep answering stupid questions in this way.
>I suspect he was the type of person that when asked if he
>knows what time it is, would answer 'yes'.... a perfectly
>correct answer but totally useless.
And when do you suggest I was such a person?
>btw: I much prefer to be referred to as David... saying 'Marcus' without the
>'Mr.' is rude.
Yes it is, Marcus. So is asking stupid questions which waste the time of
many people who have better things to do than to wade through them.
Which is exactly the reason I'm adding a new entry to my killfile.
*plonk*
Cheers,
Bernard
--
#requires 5.6.0
perl -le'* = =[[`JAPH`]=>[q[Just another Perl hacker,]]];print @ { @ = [$ ?] }'
------------------------------
Date: Mon, 26 Mar 2001 00:11:04 -0600
From: "Charles K. Clarkson" <c_clarkson@hotmail.com>
Subject: Re: PLEASE HELP (0/1)
Message-Id: <05FCE229F2D3C3C8.3EEB3949A6CEB150.39476687ADC273E1@lp.airnews.net>
Michael Jenneson <michael1981@btinternet.com> wrote:
: I have to get this program working
: it is supposed to read in any number of unix commands
: and pipe them together and execute each command in
: separate processes.
: i cant get it to run
: PLEASE HELP
<http://www.perl.com/CPAN-local/authors/Dean_Roehrich/subjects.post>
<http://dfw.pm.org/clpmisc/clpmisc_guidelines.html>
------------------------------
Date: Mon, 26 Mar 2001 14:10:51 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Re: Problem running 'traceroute' command from perl script.
Message-Id: <99mmed$i3r@netnews.hinet.net>
"Abigail" wrote
>
> Abigail
> --
> @_=map{[$!++,$_^$/]}split$?"\@\x7Fy~*kde~box*Zoxf*Bkiaox";$\="\r";
> $|=++$*;do{($#,$=)=(rand@_,rand@_);@_[$#,$=]=@_[$=,$#]}for($*..@_);
> for$:($|..@_-$|){for($|..@_-$:){@_[$_-$|,$_]=@_[$_=>$_-$*]if$_[$_][
> $¼]<$_[$_-$*][$®];print+map{$_->[$|]}@_;select$?$?$?0.1}}print$/
No kidding. This program doesn't compile.
String found where operator expected at line 1,
near "$?"\@\x7Fy~*kde~box*Zoxf*Bkiaox""
(Missing operator before "\@\x7Fy~*kde~box*Zoxf*Bkiaox"?)
Use of $* is deprecated at line 2.
Use of $# is deprecated at line 2.
...
John Lin
------------------------------
Date: 26 Mar 2001 11:02:54 GMT
From: ndparker@gmx.net (Andre Malo)
Subject: Re: Problem running 'traceroute' command from perl script.
Message-Id: <Xns907084BE7C0F4ndparker@news.o3media.de>
John Lin schrieb in <99mmed$i3r@netnews.hinet.net>:
>X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
>"Abigail" wrote
>> @_=map{[$!++,$_^$/]}split$?"\@\x7Fy~*kde~box*Zoxf*Bkiaox";$\="\r";
^
>> $|=++$*;do{($#,$=)=(rand@_,rand@_);@_[$#,$=]=@_[$=,$#]}for($*..@_);
>> for$:($|..@_-$|){for($|..@_-$:){@_[$_-$|,$_]=@_[$_=>$_-$*]if$_[$_][
>> $¼]<$_[$_-$*][$®];print+map{$_->[$|]}@_;select$?$?$?0.1}}print$/
^ ^ ^
Your newsreader is broken, Abigails .sig doesn't contain any question
marks.
>No kidding. This program doesn't compile.
I tried it out, yes it does compile ;)
>Use of $* is deprecated at line 2.
>Use of $# is deprecated at line 2.
yes, it is, but it's a japh - so what?
n.d.p.
--
my @japh = (sub{q~Just~}, sub{q~Another~}, sub{q~Perl~}, sub{q~Hacker~});
my $japh = q[sub japh { }]; print join #########################
[ $japh =~ /{(.)}/] -> [0] => map $_ -> () # n.d. parker #
=> @japh; # http://www.o3media.de #
------------------------------
Date: Mon, 26 Mar 2001 04:54:00 GMT
From: "Tom" <tom@hotversion.com>
Subject: Reading Ms Word
Message-Id: <IXzv6.18600$BU4.30931@news1.blktn1.nsw.optushome.com.au>
Is it possible to use perl to access Ms Word documents at all ?
Thanks
Tom
------------------------------
Date: Mon, 26 Mar 2001 10:30:56 +0200
From: "Tobias Ruehle" <tobias.ruehle@de.bosch.com>
Subject: remove 'new line' from last element in array
Message-Id: <99muo0$cd6$1@proxy2.fe.internet.bosch.com>
I read in a file line by line and then use the following command:
@array = split(',', $_);
ok, let's assume taht @array[2] is the last array element.
My problem is that this last element contains a "\n" and i want to print
this element into the middle of a line without a linefeed.
Is there a way to remove that \n from the array element.
thanks in advance
Tobias
------------------------------
Date: Mon, 26 Mar 2001 10:32:33 +0200
From: Mona Wuerz <wuerz@yahoo.com>
Subject: Re: remove 'new line' from last element in array
Message-Id: <260320011032339004%wuerz@yahoo.com>
In article <99muo0$cd6$1@proxy2.fe.internet.bosch.com>, "Tobias Ruehle"
<tobias.ruehle@de.bosch.com> wrote:
> I read in a file line by line and then use the following command:
> @array = split(',', $_);
>
> ok, let's assume taht @array[2] is the last array element.
> My problem is that this last element contains a "\n" and i want to print
> this element into the middle of a line without a linefeed.
>
> Is there a way to remove that \n from the array element.
perldoc -f chomp
-mona
------------------------------
Date: Mon, 26 Mar 2001 18:17:06 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: remove 'new line' from last element in array
Message-Id: <KlDv6.2$pD1.536@vic.nntp.telstra.net>
"Tobias Ruehle" <tobias.ruehle@de.bosch.com> wrote in message
news:99muo0$cd6$1@proxy2.fe.internet.bosch.com...
> I read in a file line by line and then use the following command:
> @array = split(',', $_);
>
> ok, let's assume taht @array[2] is the last array element.
> My problem is that this last element contains a "\n" and i want to print
> this element into the middle of a line without a linefeed.
>
> Is there a way to remove that \n from the array element.
>
You want chomp. chomp the appropriate element, ie:
chomp $array[2];
if you are asking how to chomp the last array element when you don't
necessarily know what that element is, there are acouple of things you could
do.
1) chomp the line before you split it:
chomp; # assumes a chomp of $_ which you are later splitting on
2) chomp the array:
chomp @array; #removes \n from the end of every element in the array
3) chomp the last element in the array:
chomp $array[$#array]; # $#array is the index if the last element in the
array
Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';
------------------------------
Date: Mon, 26 Mar 2001 03:56:06 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: require'ing OO modules on the fly - any danger?
Message-Id: <x7n1a9yyi1.fsf@home.sysarch.com>
>>>>> "DB" == Daniel Berger <djberg96@hotmail.com> writes:
DB> "Eric Bohlman" <ebohlman@omsdev.com> wrote in message
DB> news:99lrkk$9lu$1@bob.news.rcn.net...
>> Daniel Berger <djberg96@hotmail.com> wrote:
>> > I'll need to look up the difference between eval "something" vs eval{
>> > something }. I honestly don't know the difference off the top of my
DB> head.
>> > Bad programmer....
>>
>> eval string is Perl's run-time compilation mechanism. eval block is
>> Perl's "try-catch" exception-handling mechanism.
DB> Ok, I knew the latter, but wasn't sure about the former. In this
DB> particular case, it appears to work either way.
DB> my $mod = "English";
DB> eval "require $mod";
DB> eval{ require $mod };
DB> I'm not sure which of the two is "better". Or is it merely preference?
no, you didn't read the explanation. they are not even close to
equivilent even though you get the same effect here. in fact for just
caling require, you don't even need eval (either form at all). the block
form is useful there only to catch the require failing. the string
version COMPILES that string and evaluates it which is overkill. it also
will catch a require error but not as efficiently as the block form.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 26 Mar 2001 08:39:50 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: require'ing OO modules on the fly - any danger?
Message-Id: <985595467.27835@itz.pp.sci.fi>
In article <p2xv6.5092$pS2.234096@typhoon.mn.mediaone.net>, Daniel Berger wrote:
>
>Sorry for the confustion - let me rephrase. I could easily append ".pm" to
>the string that is parsed. Given that, should I
>
>a) eval "require $mod"
Easier to code, but arguably eval STRING shouldn't be used unless run
time compilation really is necessary. OTOH, laziness _is_ a virtue.
>b) $mod .= ".pm"; eval { require $mod };
Generally you also need:
$mod =~ s!::|'!/!g;
though I think your specific application only allowed single component
names anyway.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla / Kira -- do not feed the troll.
------------------------------
Date: Mon, 26 Mar 2001 08:18:41 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Routine to Color-Code Java/C/C++ Code [OT]
Message-Id: <slrn9bturc.gid.rgarciasuarez@rafael.kazibao.net>
Benjamin Goldberg wrote in comp.lang.perl.misc:
> np wrote:
> >
> > I'm trying to develop a simple little script that color-codes program
> > listings in HTML so they look like they would in an editor/IDE.
>
[...]
>
> Another thing which occurs to me... doesn't the nedit text editor come
> with a bunch of colorizing things for various programming languages?
> Perhaps you could steal it's config file for parsing and coloring perl,
> or adapt and combine some of the others... Perl is like sed and awk and
> sh and lex and c and c++, put into a blender, with a dash of @spices.
The vim editor (http://www.vim.org/) has good syntax highlighting and is
able to generate HTML code from a syntax-highlighted file.
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/vim/
------------------------------
Date: Mon, 26 Mar 2001 07:41:11 +0200
From: "Jonas Nilsson" <jonni@ifm.liu.se>
Subject: Re: Statistics
Message-Id: <99mktl$ja2$1@newsy.ifm.liu.se>
> Start: Thu Dec 21 12:27:51 2000 GMT
> End: Sat Mar 24 13:25:39 2001 GMT
> Total: 15688
>
> By Month:
> 2000/12 : 1361
> 2001/01 : 5397
> 2001/02 : 4719
> 2001/03 : 4211
>
> By Week:
> 2000/51 : 521
> 2000/52 : 840
> 2001/01 : 1051
> 2001/02 : 1144
> 2001/03 : 1225
> 2001/04 : 1327
> 2001/05 : 1286
> 2001/06 : 1379
> 2001/07 : 1048
> 2001/08 : 1046
> 2001/09 : 1357
> 2001/10 : 1208
> 2001/11 : 1306
> 2001/12 : 950
OK Thanx!
/jN
--
_______________________________
Jonas Nilsson
------------------------------
Date: Mon, 26 Mar 2001 11:46:52 +0100
From: "Stephen Collyer" <scollyer@netspinner.dont-spam.co.uk>
Subject: String::Approx buggy ?
Message-Id: <985603697.11132.0.nnrp-12.9e98901a@news.demon.co.uk>
I'm having trouble seeing how String::Approx uses its modifiers.
Given the following code:
print "match\n" if amatch('fred', [ 2, 'D2', 'I0', 'S0'], 'frooooooood');
prints "match". As far as I can see there should be no amatch here,
as I have limited the total number of edits to 2, and restricted them
to deletions. I can't see how 'frooooooood' can amatch 'fred' with
those restrictions, even if we allow any kind of edit - surely there
is a greater edit distance than 2 between the two strings ?
I'm using version 3 of String::Approx (the C version) on a SuSe
6.2 installation.
Can anybody clarify what's going on here for me ? Is this a bug,
or a misunderstanding of Wu-Manber on my part ?
Steve Collyer
Netspinner Ltd.
------------------------------
Date: Sun, 25 Mar 2001 20:17:33 -0600
From: "kellyboy" <kellyboy@nospanner>
Subject: system() return value
Message-Id: <tbt9glm7hm9850@corp.supernews.com>
Based on doc, a return value from system() is either zero or nonzero....
so when the return value is "0 (zero)" it mean the system() calls went
successfully.
As for perl anything is 0 is considering false and anything not zero is
true as in
if ($num) {
do it here if $num is not zero
}
else {
do it here if $num is zero
}
but .........
if (system(something)) {
im here cuz system return error
}
else {
im here cuz system return 0 which mean success
}
Im asking this is because I need to write script to execute the command for
each file in directory...(lparse $somefile; mv output.pov $somefile.pov)
I could do that in bash but I want to learn in solution to this in perl
kellyboy
--
------------------------------
Date: Mon, 26 Mar 2001 04:24:28 GMT
From: "Philip Garrett" <philipg@atl.mediaone.net>
Subject: Re: system() return value
Message-Id: <0wzv6.192003$Z8.41186180@typhoon.southeast.rr.com>
kellyboy <kellyboy@nospanner> wrote in message
news:tbt9glm7hm9850@corp.supernews.com...
> Based on doc, a return value from system() is either zero or nonzero....
>
> so when the return value is "0 (zero)" it mean the system() calls went
> successfully.
>
> As for perl anything is 0 is considering false and anything not zero is
> true as in
>
> if ($num) {
> do it here if $num is not zero
> }
> else {
> do it here if $num is zero
> }
>
> but .........
>
> if (system(something)) {
> im here cuz system return error
> }
> else {
> im here cuz system return 0 which mean success
> }
>
> Im asking this is because I need to write script to execute the command
for
> each file in directory...(lparse $somefile; mv output.pov $somefile.pov)
>
> I could do that in bash but I want to learn in solution to this in perl
So what's your question?
p
------------------------------
Date: Mon, 26 Mar 2001 02:34:49 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: the space
Message-Id: <slrn9btam9.jrg.mgjv@verbruggen.comdyn.com.au>
On Sun, 25 Mar 2001 13:22:07 +0000 (UTC),
Abigail <abigail@foad.org> wrote:
> Martien Verbruggen (mgjv@tradingpost.com.au) wrote on MMDCCLXIII
> September MCMXCIII in <URL:news:slrn9bqo1o.ugg.mgjv@martien.heliotrope.home>:
> ``
> `` split ' ', $line;
> ``
> `` and whitespace includes tabs and such. The above is more or less
> `` equivalent to
> ``
> `` split /\s+/, $line;
> ``
> `` The single space will remove leading and trailing empty fields, while
> `` the /\s+/ will not.
>
> /\s+/ will remove trailing empty fields. That is, after all, the default
> behaviour of split.
Euhmm, yes, you are right. The only difference is in leading
whitespace producing an empty first field for /\s+/.
Martien
--
Martien Verbruggen |
Interactive Media Division |
Commercial Dynamics Pty. Ltd. | What's another word for Thesaurus?
NSW, Australia |
------------------------------
Date: Sun, 25 Mar 2001 22:36:24 -0500
From: "Matthew O. Persico" <persicom@acedsl.com>
Subject: Re: Writing a script to install Perl modules automatically
Message-Id: <3ABEB938.5149FC7D@acedsl.com>
Makhno wrote:
>
> Hi, I'm writing a bash script to install a large set of Perl modules
> automatically, and the trouble is that the Makefile.PL and all the other
> stuff that's needed to install them are at different levels, eg:
> I might have one module called MyModule
> and another called MyModule::Somefink::Else
> and yet another called MyModule::YetMore
>
> My problem is that the hierarchical package names translate into directories
> like eg:
>
> MyModule
> MyModule/Somefink/Else
> MyModule/YetMore
>
> with the Makefile.PL at the end of this chain. Is there a 'nice' way of
> installing the modules separately with a script without
>
> a) Combining all the modules into one big module (not an option)
> b) Making my bash script search around the hierarchy for the Makefile.PL
>
> (eg: is there a way to get Perl to do the hard work?)
> Thank you.
What's the big deal about (b)? (UNTESTED CODE, but should work, modulo
any typos)
#!/bin/bash
## install_all_mods
## install all modules, unconditionally:
cd /where_ever_it_is/MyModule
make realclean
perl Makefile.PL
make test install
#!/bin/bash
## install_some_mods
## install some modules
## usage:
## install_some_mods /root_dir_of_modules MyModule MyModule::SubModule
...
## must be at the root of where MyModule lives
r=$1
shift
cd $r
for mod in $*
do
d=$(echo $mod | sed 's/::/\//g');
(
## The parens start another subshell. The cd takes place in that shell.
## when it dies, you are back where you started. No need to remember
## pwd and then cd back when you are done
cd $d
make realclean
perl Makefile.PL
make test install
)
done
--
Matthew O. Persico
http://www.acecape.com/dsl
AceDSL:The best ADSL in Verizon area
------------------------------
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 V10 Issue 566
**************************************