[16441] in Perl-Users-Digest
Perl-Users Digest, Issue: 3853 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 31 03:10:31 2000
Date: Mon, 31 Jul 2000 00:10:21 -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: <965027421-v9-i3853@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 31 Jul 2000 Volume: 9 Number: 3853
Today's topics:
Re: I Am An Idiot <bkennedy@hmsonline.com>
Re: I Am An Idiot <godzilla@stomp.stomp.tokyo>
Re: I Am An Idiot <bkennedy@hmsonline.com>
Re: I Am An Idiot (Gwyn Judd)
Re: I Am An Idiot <godzilla@stomp.stomp.tokyo>
Re: I Am An Idiot <godzilla@stomp.stomp.tokyo>
Re: I Am An Idiot <lr@hpl.hp.com>
Re: IP spoofing for search engine <gellyfish@gellyfish.com>
Re: Is "exit()" really necessary? (Gwyn Judd)
Re: Moving and renaming files <gellyfish@gellyfish.com>
Re: New Site: www.perlmodules.com <elaine@chaos.wustl.edu>
Re: New Site: www.perlmodules.com <elaine@chaos.wustl.edu>
Passing File Handler <glodalec@yahoo.com>
Re: Perl 5 worth learning??? (Homer Simpson)
Re: Perl and MySQL <debjit@oyeindia.com>
Please help in solving this mysterious prob <joydip_chaklader@my-deja.com>
Re: Please help in solving this mysterious prob <debjit@oyeindia.com>
Re: plotting graph (Martien Verbruggen)
Re: Quotes in regex? <gellyfish@gellyfish.com>
Re: Quotes in regex? (Christian Kaufhold)
Re: Quotes in regex? (Eric Kuritzky)
Re: Quotes in regex? (Abigail)
Re: Quotes in regex? (Abigail)
Re: Quotes in regex? (Abigail)
Re: Running other programs in background ericr@yankthechain.com
Re: Shell commands <s1sims@home.com>
Re: Shell commands (Gwyn Judd)
simple script, please help! <penguinknight@yahoo.com>
Re: simple script, please help! <dslusarc@blizzardgames.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 30 Jul 2000 22:16:16 GMT
From: "Ben Kennedy" <bkennedy@hmsonline.com>
Subject: Re: I Am An Idiot
Message-Id: <QO1h5.73225$A%3.990800@news1.rdc2.pa.home.com>
"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message
news:39846196.6E83151B@stomp.stomp.tokyo...
> Both kill your program. Reality dictates there is no difference.
>
> * waves a white flag in sarcastic jest *
using "or die" as opposed to "|| die" is preferable if you choose not to use
parenthesis:
open HANDLE, "not_a_file" or die "Cannot open: $!";
open HANDLE, "not_a_file" || die "Cannot open: $!";
Its an advanced technicality, but an important one nevertheless. Now to
refresh everyone's memory, here is your code and my code:
> open (POKERLOG, "+<$poker_log");
> $read_poker = <POKERLOG>;
> close (POKERLOG);
>
> if (!($read_poker))
> {
> open (POKERLOG2, ">$poker_log");
> print POKERLOG2 "500";
> close (POKERLOG2);
> $player_cash = "500";
> }
> if ($read_poker)
> { $player_cash = $read_poker; }
and
if (-e $poker_log) { # now you know the file exists
open(LOG,$poker_log) or die "Uh oh, why can't I a read a file that
already exists! $!";
chomp($player_cash = <LOG>);
close(LOG);
} else { # this file does not exist
print "I don't have a log file for you!\n";
open(LOG,">$poker_log) or die "Uh oh, why can't a write to a file?? $!";
print LOG "500\n";
$player_cash = 500;
close(LOG);
}
You call this code "Cargo Cultist Code Cop Mule Manure". I find this
insulting. Please explain to me what is wrong with this code - what do you
think your code does that my code doesn't. Under what circumstances will
your code run that mine doesn't? And please don't talk in vague
generalities. My program will die only when it is unable to read from or
write the disk. I think these are errors worth halting the program for.
Perhaps the permissions are set incorrectly. Perhaps you are over your
quota. My code will tell you when these conditions occur. Don't you think
it would make sense for a program to at least let you know when these things
happen? Unless you specifically check the value of open and $!, you will
not know. Your code uses a roundabout way to tell if the logfile exists.
It also will fail of the contents of the file are 0. Mine explitly tests
for the files existance, and it will detect 0 as a valid number.
> Rest of your comments are fluff, flitter and filler
> sprinkled upon fresh mule manure for appearance sake.
> Why do you Cargo Cultist Perl 5 boys insist on killing
> your program, insist on waving a white flag and instantly
> surrendering when an elephant down at the San Diego Zoo
> passes gas?
Instead of insulting my code, insulting my comments, and insulting me, why
not try having a discussion.
--Ben Kennedy
------------------------------
Date: Sun, 30 Jul 2000 17:17:44 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: I Am An Idiot
Message-Id: <3984C5A8.7320CFAF@stomp.stomp.tokyo>
Ben Kennedy wrote:
> Godzilla!
> > Both kill your program. Reality dictates there is no difference.
> > * waves a white flag in sarcastic jest *
> using "or die" as opposed to "|| die" is preferable if you choose
> not to use parenthesis:
> open HANDLE, "not_a_file" or die "Cannot open: $!";
> open HANDLE, "not_a_file" || die "Cannot open: $!";
Both kill your program. Reality dictates there is no difference.
* waves another white flag in sarcastic jest *
> Its an advanced technicality, but an important one nevertheless.
> Now to refresh everyone's memory, here is your code and my code:
(snipped my absolutely amazing nobody ever thought of this before code)
(graciously shoveled out his mule manure, again, to keep it clean here)
> You call this code "Cargo Cultist Code Cop Mule Manure".
I didn't call it Cargo Cultist Code Cop Mule Manure.
I said it is Cargo Cultist Code Cop Mule Manure. Call
what you like, it's still mule manure.
> I find this insulting.
I wouldn't be insulted. I would be embarrassed to write
code like yours which whimpers and dies with the sight
of a mosquito.
Of course, had you been born and raised on a rural Oklahoma
farm like me, sans money, electricity and other modern
inconveniences, you would shudder with the word mosquito.
As a young girl, stubbing her toes on black snakes and
cotton mouths, headed to Grassy Lake about Oh' Dark Thirty,
to set out taut lines to catch catfish, a darn Oklahoma
mosquito swooped down upon me out of darkness and pine
trees. Good thing I came to learn the sound of a mosquito
swooping down near mach 1. I duck. This blood sucking monster
misses me by a hair and, in fact, took a beak full of my hair
with him before slamming into one of our pine trees.
Well tarnation, if that mosquito didn't drive his needle
sharp titanium steel beak clean through this poor ol' pine
tree. So, right quick I run over and bend his beak over
'fore he gets loose, then impales me only to suck me dry
of Life's blood. This is a close call.
Month later, Granddaddy and me went out to our pine forest
edge and collected the dried bones of this Oklahoma mosquito.
Dern if his rib bones didn't make enough fence posts for
five acres of land and, we used his wings for a new roof
on our chicken house. If this mosquito had been a full
grown Oklahoma mosquito, we could have fence post a good
ten acres of land and roofed our farmhouse as well.
> ... what do you think your code does that my code doesn't.
My code compensates for errors and continues to successfully
run and entertain a visitor with a wild game of poker!
Your code craps its pants and dies.
> And please don't talk in vague generalities.
Like my Oklahoma mosquito story? I should tell you
about our three hundred pound catfish which eat kids.
However, those catfish are not as dangerous as toe hogs.
True. I have an uncle missing a toe. Hog bit it off.
> My program will die only when it is unable to read....
My program ignores the error, adjusts itself and goes
on to provide a lot of fun!
Your code craps its pants and dies.
> I think these are errors worth halting the program for.
I believe a good programmer will write code which
can handle errors effectively and efficiently,
like my code!
Sho nuff better than writing code which craps
its pants and dies with the sight of a mosquito.
> Perhaps the permissions are set incorrectly.
Well don't set your permissions incorrectly. Duh!
> Perhaps you are over your quota.
Roberta always loans me more money when I hit zero.
> My code will tell you when these conditions occur.
My code moves right along as if no error took place!
> It also will fail of the contents of the file are 0.
Baloney! I already posted proof my code handles a
zero condition quite admirably! Besides, if you
truly knew Perl, were truly a programmer, one
quick glance at my code reveals it does a lot
more than just take care of a zero condition.
> Mine explitly tests for the files existance
My code creates a file if it doesn't exist!
> and it will detect 0 as a valid number.
Roberta, The Remarkable Robot, hands you five-hundred
bucks if you hit zero! She is a sweetheart, just like
me, her Dr. Victoria Frankie Einstein creator!
Godzilla!
--
Alturus 5, Gamma Sector, Perl Manglers:
http://la.znet.com/~callgirl/webchat/nph-chahta.cgi
------------------------------
Date: Mon, 31 Jul 2000 04:41:05 GMT
From: "Ben Kennedy" <bkennedy@hmsonline.com>
Subject: Re: I Am An Idiot
Message-Id: <Br7h5.73618$A%3.1002105@news1.rdc2.pa.home.com>
If you don't want to have an open minded discussion, then don't even bother
reading this post. I have not insulted you. I think you are operating
under some misconceptions about diagnostic tools and error codes, and
misunderstanding what most people are saying. Rather than hand out blanket
statements, why not discuss things to try to get other peoples point of
view.
Once again, lets recap the code segments
> open (POKERLOG, "+<$poker_log");
> $read_poker = <POKERLOG>;
> close (POKERLOG);
>
> if (!($read_poker))
> {
> open (POKERLOG2, ">$poker_log");
> print POKERLOG2 "500";
> close (POKERLOG2);
> $player_cash = "500";
> }
> if ($read_poker)
> { $player_cash = $read_poker; }
and
if (-e $poker_log) { # now you know the file exists
open(LOG,$poker_log) or die "Uh oh, why can't I a read a file that
already exists! $!";
chomp($player_cash = <LOG>);
close(LOG);
} else { # this file does not exist
print "I don't have a log file for you!\n";
open(LOG,">$poker_log) or die "Uh oh, why can't a write to a file?? $!";
print LOG "500\n";
$player_cash = 500;
close(LOG);
}
> > ... what do you think your code does that my code doesn't.
>
> My code compensates for errors and continues to successfully
> run and entertain a visitor with a wild game of poker!
>
> Your code craps its pants and dies.
>
> My program ignores the error, adjusts itself and goes
> on to provide a lot of fun!
>
> Your code craps its pants and dies.
My code is designed to respond to a error condition, notably when there is a
disk access error. I could ignore this of I choose to, but I consider it a
serious enough condition to warrant halting the script. Perhaps you don't.
Personally, I like to know when I try to write to a disk and it fails. I
don't think it would be a lot of fun for the user if no money ever got saved
or lost. I think I also asked you to talk in specifics, not generalities.
Under what circumstances does my code fail that you think it shouldn't? I
think this is an important question.
I think you have a different definition of the word 'error' than I do. You
seem to limit the definition of error to simply when the file does not
exist. However, there are more errors than this. It is true that if you
open a file for reading that does not exist, open() returns false. Why not
then check for this potential error condition beforehand? This is what
the -e file test does. That when you get to open(), adding "or die" will
detect more important errors that deserve a fatal error.
> > I think these are errors worth halting the program for.
>
> I believe a good programmer will write code which
> can handle errors effectively and efficiently,
> like my code!
>
> Sho nuff better than writing code which craps
> its pants and dies with the sight of a mosquito.
>
> > My code will tell you when these conditions occur.
>
> My code moves right along as if no error took place!
I agree. But this does not change the fact that an error did take place.
Your code may continue, but the user may not be able to save the poker
scores. You did successfully account for the case where the file does not
exist, but not when you are unable to create the score file in the first
place. There are many kinds of errors, and your code does not distinguish
between them. How can you efficiently deal with every possible open() error
without checking the error code?
> > Mine explitly tests for the files existance
>
> My code creates a file if it doesn't exist!
Yes it does, and so does mine. I think you should take a closer look at it.
But your code also tries to create a file even if it couldn't read the file
for some other reason. Try looking at my code again, and actually try to
figure out what it does.
--Ben Kennedy
------------------------------
Date: Mon, 31 Jul 2000 05:25:54 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: I Am An Idiot
Message-Id: <slrn8oa3eu.fp6.tjla@thislove.dyndns.org>
I was shocked! How could Ben Kennedy <bkennedy@hmsonline.com>
say such a terrible thing:
>If you don't want to have an open minded discussion, then don't even bother
>reading this post. I have not insulted you. I think you are operating
>under some misconceptions about diagnostic tools and error codes, and
>misunderstanding what most people are saying. Rather than hand out blanket
>statements, why not discuss things to try to get other peoples point of
>view.
YHBT. HTH. HAND :)
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
The only real argument for marriage is that it remains the best method
for getting acquainted.
-- Heywood Broun
------------------------------
Date: Sun, 30 Jul 2000 22:34:54 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: I Am An Idiot
Message-Id: <39850FFE.BCC192E0@stomp.stomp.tokyo>
Ben Kennedy wrote:
(carefully steps over and around more mule manure)
Well gosh darn if you ain't as stubborn as a green
Missouri Mule. Pile up your mule manure much more,
you will have your own private pile upon which to
play King Of The Mountain.
> Try looking at my code again, and actually try to
> figure out what it does.
I figured out your code first time I shoveled my
way through it. Your code craps it pants and dies
with the slightest hint of challenging circumstances,
such as a mule braying.
Brass tacks, Bud. Your techniques display numerous
earmarks of a person who holds very little experience
in writing both realistic and real life application
programs which can withstand the rigors of actual use.
Thumb tacks, Buster. Your notions and thoughts within
this article and prior articles, are those of a most
stereotypical Perl 5 Cargo Cultist Code Cop, a wanna
be cabal member, a groupie, a copy and paste parrot.
Mule tack, Francis. You are full of mule manure.
Incidently, do you know Father Burntureally?
Godzilla!
--
if (${\index ($ENV{REMOTE_USER_AGENT}, "98")} gt -1)
{ print "file:///%43|%2f%77indo%77s/%6dedi%61/%64in%67.wav"; }
else { print "Ding!"; } exit;
------------------------------
Date: Sun, 30 Jul 2000 22:52:23 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: I Am An Idiot
Message-Id: <39851417.90970F38@stomp.stomp.tokyo>
Gwyn Judd wrote:
> Ben Kennedy wrote:
> YHBT. HTH. HAND :)
Well, at least you well picked a correct
subject title for your post. You are doing
a bit better in selecting a topic suitable
for your relative, hmm... skill level.
Godzilla!
--
I will unmask and rock you.
http://la.znet.com/~callgirl3/masq.mid
------------------------------
Date: Sun, 30 Jul 2000 23:49:17 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: I Am An Idiot
Message-Id: <MPG.13eec14a61bca66298ac0f@nntp.hpl.hp.com>
In article <3984C5A8.7320CFAF@stomp.stomp.tokyo>,
godzilla@stomp.stomp.tokyo says...
...
> > open HANDLE, "not_a_file" or die "Cannot open: $!";
> > open HANDLE, "not_a_file" || die "Cannot open: $!";
>
> Both kill your program. Reality dictates there is no difference.
The second of the two lines cannot kill the program, because the string
literal is always TRUE. Failure to open the file will be ignored.
> * waves another white flag in sarcastic jest *
Is that an advance acknowledgment of your outright error?
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 31 Jul 2000 01:39:03 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: IP spoofing for search engine
Message-Id: <8m2hr7$pkq$1@orpheus.gellyfish.com>
On Sun, 30 Jul 2000 19:44:42 +0800 DT wrote:
> I have dedicated servers which provide virtual webhosting service and
> offer search engines submission for free with a script. The problem is if
> I use :
>
> $sock = new IO::Socket::INET ( PeerAddr => $host,
> PeerPort => 80,
> Proto => 'tcp',
> Type => SOCK_STREAM ) or retur
> undef, $@;
>
> All the submission is done based on the IP of the main server, can you
> tell me how to make it submit through the IP of virtual server?
>
Check out the IO::Socket::INET manpage how you might give the local
address of the connection.
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: Mon, 31 Jul 2000 04:57:25 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Is "exit()" really necessary?
Message-Id: <slrn8oa1ph.fp6.tjla@thislove.dyndns.org>
I was shocked! How could Abigail <abigail@foad.org>
say such a terrible thing:
>Gwyn Judd (tjla@guvfybir.qlaqaf.bet) wrote on MMDXXV September MCMXCIII
>in <URL:news:slrn8o74tg.7h1.tjla@thislove.dyndns.org>:
>)) And in that spirit:
>))
>)) sub _ {$_ = shift and $_ = chr ( $_ eq " " ? ord() : ord() - 1)
>)) xor !@ _? exit print :
>)) print and push @_ => shift and &{(caller (0)) [3]}}
>)) split // => "KsvQtbuf fbsodpmu\ni flsI " xor & _
>
>
>Well, you removed the transliteration and goto, but you left in the
>only regex.
In my defense I didn't see it. Actually I was thinking the "tr" operator
was a regex. My bad. I did manage to keep the original formatting more
or less. My mind isn't working :)
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Does Microsoft mean small and limp? (contributed by Frank v Waveren)
------------------------------
Date: 31 Jul 2000 01:02:56 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Moving and renaming files
Message-Id: <8m2fng$ioi$1@orpheus.gellyfish.com>
On Sun, 30 Jul 2000 12:38:54 -0700 Dan Alexander wrote:
> Perl newbie question:
>
> I'm running Perl on NT 4.0.
>
> I'd like to find some example scripts that show how to rename files and then
> move the files to another directory.
>
perldoc -f rename
perhaps ?
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: Mon, 31 Jul 2000 02:13:28 GMT
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: New Site: www.perlmodules.com
Message-Id: <3984E0C5.D14361D5@chaos.wustl.edu>
nobull@mail.com wrote:
> "James" <jthomson110@home.com> writes:
> I'd like to see an apology for trying to confuse the issue and a
> redirect to CPAN.
I would too considering this person emailed us at CPAN the other day
wondering how he could go about getting a mirror of CPAN for his newly
registered site.
Redirecting on a site with banner ads is in very poor taste and I've
included the offenders email address in this reply should anyone else
feel moved to express their distaste privately.
Remove the redirects. You may have your own mirror if you wish but
redirecting traffic is not acceptable nor is having the CPAN index.html
as the top level of your site without clearly distinguishing it as CPAN.
e.
------------------------------
Date: Mon, 31 Jul 2000 02:13:55 GMT
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: New Site: www.perlmodules.com
Message-Id: <3984E0E2.1A6C4503@chaos.wustl.edu>
nobull@mail.com wrote:
> "James" <jthomson110@home.com> writes:
> I'd like to see an apology for trying to confuse the issue and a
> redirect to CPAN.
I would too considering this person emailed us at CPAN the other day
wondering how he could go about getting a mirror of CPAN for his newly
registered site.
Redirecting on a site with banner ads is in very poor taste and I've
included the offenders email address in this reply should anyone else
feel moved to express their distaste privately.
Remove the redirects. You may have your own mirror if you wish but
redirecting traffic is not acceptable nor is having the CPAN index.html
as the top level of your site without clearly distinguishing it as CPAN.
e.
------------------------------
Date: Mon, 31 Jul 2000 08:52:46 +0200
From: Mouse <glodalec@yahoo.com>
Subject: Passing File Handler
Message-Id: <3985223E.5F8A@yahoo.com>
Hi !
Does anyone know, how to pass file handler into subroutine ?
open (FH, "myfile.dat");
..
..
$rec = &readrecord( FH ); ???
------------------------------
Date: 31 Jul 2000 04:37:01 GMT
From: homer.simpson@springfield.nul (Homer Simpson)
Subject: Re: Perl 5 worth learning???
Message-Id: <8m2vpd$cfe$0@216.39.131.162>
In article <39840910.D6018B2F@worldnet.att.net>, Peter Bishop <Peter.Bishop@worldnet.att.net> wrote:
>Hi,
>
>I was planning on starting to learn Perl, when I stumbled across
>something saying that Perl 6 will be a complete re-write of the
>language. Does anyone know how different the syntax/interface to the
>language will be. Is it worth learning Perl now? or should I wait until
>early next year when the new Perl emerges?
As others have stated perl will continue to be perl so learning version 5 will
at the very least shorten the learning curve for Perl 6...
And as someone new to Perl let me say that I've never found a language that
has made me so productive so quickly. The first week I played with Perl I had
three useable utilities.
The great thing is that you can start out calling external programs like ping
to do some of the work (and parse their output) and as your skills progress
you can replace the external programs with Perl code with only minor
modifications.
# "What is the sound of Perl?
# Is it not the sound of a wall that people
# have stopped banging their heads against?"
# -- Larry Wall
------------------------------
Date: Mon, 31 Jul 2000 12:27:34 +0530
From: "Debjit" <debjit@oyeindia.com>
Subject: Re: Perl and MySQL
Message-Id: <8m4cr8$j58$1@news.vsnl.net.in>
Robert wrote in message <16bc5578.31ee94cd@usw-ex0101-008.remarq.com>...
>Hello,
>Unfortunately, I do not have shell access to my web host, but I
>have heard there is a Perl equivalent of phpMyAdmin so I can
>create a database via the web browser. Does anyone know what this
>is called, and where I can download it from?
WEBMIN is one such but ur server people have to install that
>
>Also, can anyone recommend any good tutorial sites, or books,
>that can help me learn this strange new language?
>
www.mysql.com documentation page has quite a few good tutorial links for
perl DBI/DBD, I learnt from there
------------------------------
Date: Mon, 31 Jul 2000 05:00:04 GMT
From: Joydip Chakladar <joydip_chaklader@my-deja.com>
Subject: Please help in solving this mysterious prob
Message-Id: <8m314j$5qf$1@nnrp1.deja.com>
Hi everybody !!
just doing an perl programme for user registration and login. The
programme is running fine in my localhost in Apache for Win32.
But when I upload the prog in my webserver linux-Apache it is unable
to create the directory whose name would be dynamically generated from
the form field login name.And at the time of login this directory name
should be checked and then the login should be given. So if the
directory is not created the total module doesnot function.
This is the prog--
$Rec=$pwd."|".$lname."|".$ul."|".$stl."|".$em."|".$nm."|".$d."|".$cn."|"
.$ques."|".$ans."\n";
mkdir($lname, 0777)|| print ("\n Could not make Directory: $lname \n");
open(F,$lname."/"."reg_info.db");
syswrite(F,$Rec,length($Rec));
close(F);
I have make simple experiments and seen that if i declare an variable
and enter an value to it then the directory is created and its working
fine. Just like this (in webserver)
$iname="joydip";
mkdir($iname, 0777);
open(F,">$iname"."/"."reg_info.db");
syswrite(F,$iname,length($iname));
close(F);
Now I have displayed the value of the variable $lname thinking that
there might be no value in the variable . But there is an definite
value which is getting in everytime and also been displayed.
http://www.upahaar.com/vouchreg.htm
So if there is a value and if mkdir is taking value from the variable
then why it is not creating the directory. I am really not getting any
logical base for it. Can anybody help me to solve this !!!. Thank in
advance.
--
Joydip Chakladar
http://www.allindialive.com
http://www.upahaar.com
From India to world
A meeting place of surfers and webmasters
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 31 Jul 2000 12:14:12 +0530
From: "Debjit" <debjit@oyeindia.com>
Subject: Re: Please help in solving this mysterious prob
Message-Id: <8m4c1v$iu3$1@news.vsnl.net.in>
Try this
use CGI::Carp qw(fatalsToBrowser);
mkdir($lname, 0777) or die "Could not make Directory $lname: $!";
You may get more useful message
------------------------------
Date: Mon, 31 Jul 2000 03:20:38 GMT
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Subject: Re: plotting graph
Message-Id: <slrn8o9s40.vi5.mgjv@verbruggen.comdyn.com.au>
On 27 Jul 2000 18:04:55 EDT,
Abigail <abigail@foad.org> wrote:
> Eric Smith (eric@fruitcom.com) wrote on MMDXXII September MCMXCIII in
> <URL:news:slrn8o16h0.7ov.eric@plum.fruitcom.com>:
>>
>> install GD::Graph from CPAN. The latest version outputs png -
>> there are a number of example acripts each making a specific type
>> of graph -its great.
>
> Or one could use gnuplot, that has a gazillion drivers for different
> formats, PNG being one of them.
and has a different application domain. But that's not that
important.
Martien
--
Martien Verbruggen |
Interactive Media Division | I'm just very selective about what I
Commercial Dynamics Pty. Ltd. | accept as reality - Calvin
NSW, Australia |
------------------------------
Date: 31 Jul 2000 01:33:41 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Quotes in regex?
Message-Id: <8m2hh5$ojm$1@orpheus.gellyfish.com>
On Sun, 30 Jul 2000 12:28:53 -0700 Kevin Foust wrote:
> Hi:
>
> I'm kind of new to Perl, but have been able to figure out most things. I am
> stumped on this one. I wish to remove the following expression from a
> string:
> <font face="Arial" size="2">
> I've tried all kinds of patterns with no success. I really expected
> something like:
> $string =~ s/<f.*?\".*?\".*?\".*?\">//ig;
Forget the regex use HTML::Parser - I've posted on the matter already
today so I wont give an example. Try it out and come back if you have a
problem.
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: Mon, 31 Jul 2000 01:45:16 +0200
From: ch-kaufhold@gmx.de (Christian Kaufhold)
Subject: Re: Quotes in regex?
Message-Id: <8m2epg$dv0$2@f40-3.zfn.uni-bremen.de>
Colin Keith <ckeith@clara.net> wrote:
[...]
> use Benchmark;
> timethese(10000, {
> 1 => sub { my($x) = '<font face="Arial" size="2">sdkfslkdsflkdsflk <font
> face="Arial" size="2">sdfklsdlkfklf sksf<font face="Arial" size="2">sfflk';
> $x =~ s/<font\s+face="arial"\s+size=(2|"2")\s+>//ig;
^^^
This does not match at all!
Other random thoughts at 1:35 AM:
Why does it allow for "2" being unquoted?
It has to do more case-insensitive comparisons.
Christian
--
package rekcaH__lreP__rehtona__tsuJ__tnirp_;
sub AUTOLOAD { $_ = $AUTOLOAD ; s ;(.*)(_)\2; \\\n$1\\ q ;sig
and y dw_:dl dsd and eval scalar reverse }
__PACKAGE__ -> wave
------------------------------
Date: 31 Jul 2000 04:05:37 GMT
From: kuritzky@math.berkeley.edu (Eric Kuritzky)
Subject: Re: Quotes in regex?
Message-Id: <8m2tuh$dc2$1@agate.berkeley.edu>
In article <3q0h5.39$DT4.2034686@nnrp2.clara.net>,
Colin Keith <ckeith@clara.net> wrote:
>In article <39848CB8.FF20F373@stomp.stomp.tokyo>, "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
>>Have you considered a simple straightforth approach
>>such as deleting precisely what you want?
>
>I was going to suggest that too. But then curiousity overcame me and I ran
>the two approaches under Benchmark. I was mildly surprised to see that
>
>$x =~ s/<font\s+face="arial"\s+size=(2|"2")\s+>//ig;
>
>Takes longer than
>
>$x =~ s/<f.*?\".*?\".*?\".*?\">//ig;
Probably because you are using parentheses (see perlre for an
explanation). Try replacing (2|"2") with (?:2|"2") and see what
happens.
------------------------------
Date: 31 Jul 2000 00:18:36 EDT
From: abigail@foad.org (Abigail)
Subject: Re: Quotes in regex?
Message-Id: <slrn8o9vgf.vcg.abigail@alexandra.foad.org>
Kevin Foust (kdfoust@fea.net) wrote on MMDXXV September MCMXCIII in
<URL:news:so904i6po0b126@corp.supernews.com>:
&& Hi:
&&
&& I'm kind of new to Perl, but have been able to figure out most things. I am
&& stumped on this one. I wish to remove the following expression from a
&& string:
&& <font face="Arial" size="2">
$str = join "" => split /<font face="Arial" size="2">/ => $str;
&& I've tried all kinds of patterns with no success. I really expected
&& something like:
&& $string =~ s/<f.*?\".*?\".*?\".*?\">//ig;
&& to work but alas I am thwarted.
That will remove the required substring - and a whole lot of more things.
&& I've also tried all kinds of other methods
&& of matching to no avail. I suspect that the quotes are screwing up the
&& match, however, I'm unable to find, in the 4 frigg'n O'Reilly Perl books
I don't think the quotes are screwing up anything.
&& I've got, a way to work this out.
&&
&& Any solutions?
See code above.
Abigail
--
perl -wlne '}{print$.' file # Count the number of lines.
------------------------------
Date: 31 Jul 2000 00:29:06 EDT
From: abigail@foad.org (Abigail)
Subject: Re: Quotes in regex?
Message-Id: <slrn8oa046.vcg.abigail@alexandra.foad.org>
Colin Keith (ckeith@clara.net) wrote on MMDXXV September MCMXCIII in
<URL:news:3q0h5.39$DT4.2034686@nnrp2.clara.net>:
~~ In article <39848CB8.FF20F373@stomp.stomp.tokyo>, "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
~~ >Have you considered a simple straightforth approach
~~ >such as deleting precisely what you want?
~~
~~ I was going to suggest that too. But then curiousity overcame me and I ran
~~ the two approaches under Benchmark. I was mildly surprised to see that
~~
~~ $x =~ s/<font\s+face="arial"\s+size=(2|"2")\s+>//ig;
~~
~~ Takes longer than
~~
~~ $x =~ s/<f.*?\".*?\".*?\".*?\">//ig;
Of course, the "faster" regex will completely wipe out something like:
<form action = "http://www.foo.bar">Text.<input type = text></form>
<a href = "http://www.bar.foo" tabindex = 4>click here</a>
<hr size = "3">
(Newlines only added for readability; . doesn't match a newline)
And it's doubtful that that is acceptable behaviour.
Abigail
--
perl -wlpe '}$_=$.;{' file # Count the number of lines.
------------------------------
Date: 31 Jul 2000 01:25:01 EDT
From: abigail@foad.org (Abigail)
Subject: Re: Quotes in regex?
Message-Id: <slrn8oa3d1.vcg.abigail@alexandra.foad.org>
Eric Kuritzky (kuritzky@math.berkeley.edu) wrote on MMDXXVI September
MCMXCIII in <URL:news:8m2tuh$dc2$1@agate.berkeley.edu>:
,, In article <3q0h5.39$DT4.2034686@nnrp2.clara.net>,
,, Colin Keith <ckeith@clara.net> wrote:
,, >In article <39848CB8.FF20F373@stomp.stomp.tokyo>, "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
,, >>Have you considered a simple straightforth approach
,, >>such as deleting precisely what you want?
,, >
,, >I was going to suggest that too. But then curiousity overcame me and I ran
,, >the two approaches under Benchmark. I was mildly surprised to see that
,, >
,, >$x =~ s/<font\s+face="arial"\s+size=(2|"2")\s+>//ig;
,, >
,, >Takes longer than
,, >
,, >$x =~ s/<f.*?\".*?\".*?\".*?\">//ig;
,,
,, Probably because you are using parentheses (see perlre for an
,, explanation). Try replacing (2|"2") with (?:2|"2") and see what
,, happens.
Rubbish. That doesn't change the fact something matches or not. It just
chances what's in $1.
Abigail
--
perl -Mstrict -we '$_ = "goto K.print chop;\n=rekcaH lreP rehtona tsuJ";K1:eval'
------------------------------
Date: Sun, 30 Jul 2000 23:20:35 GMT
From: ericr@yankthechain.com
Subject: Re: Running other programs in background
Message-Id: <8m2d80$onr$1@nnrp1.deja.com>
In article <sh49osgtcajv2ntkfpdvrtmac634ouvc24@4ax.com>,
Bart Lateur <bart.lateur@skynet.be> wrote:
> ericr@yankthechain.com wrote:
>
> >> system('start', 'programname');
>
> >This worked perfectly, no dos window at all, thanks!
> >
> >Now if only I could make the child program stay in the background of
> >the parent program or even be invisble (minimized would be fine)
>
> I'd nnormally point you to the Win32::Process module, but that only
> exists precompiled for ActiveState Perl 5.005. That is not binary
> compatible with Perl 5.6.
>
> I've looked through the WIN32API help file, and I found the WinExec
API
> call. You can call it through the Win32::API module. The
specifications
> are:
>
> file: kernel32
> parameters: pointer to string = command line
> long = window style number
> SW_HIDE = 0
> SW_SHOWMINIMIZED = 2
> SW_MINIMIZE = 6
> return value: long = error code if < 32
>
> The docs say you ought to use CreateProcess instead, but this looks
good
> enough for me.
>
> use Win32::API;
> $WinExec = new Win32::API('kernel32','WinExec',
[ 'P', 'N' ], 'N');
> my $return = $WinExec->Call('notepad', 0);
>
> Gee, it works.
>
> --
> Bart.
When I tried it with your 'notepad' example, it didn't open up notepad,
but it did open up a hidden MS-DOS window with nothing in it... but
when I put 'mplayer2' (Windows Media Player), it opens up WMP fine but
it's still in front of the window, just like with the "system" call.
My playsound function looks like this now:
sub playsound {
my $sndfile = shift;
$WinExec = new Win32::API('kernel32','WinExec',
[ 'P', 'N' ], 'N');
my $return = $WinExec->Call("data/mplayer2 data/$sndfile", 0);
}
Any ideas? I'm running Windows 98.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 31 Jul 2000 01:44:50 GMT
From: "Stephen L. Sims" <s1sims@home.com>
Subject: Re: Shell commands
Message-Id: <3984CE81.5D0953E4@home.com>
This is a multi-part message in MIME format.
--------------75DE23F78E50DA12A414DF29
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
So let me see if I'm reading from your sheet of music. I should be using the && to
replace what would be a pipe symbol at the command line? I'm trying to emulate what I
would type at the command line which is: "rmdtopvf file.rmd | pvfspeed -s 8000 |
pvftoau >file.au". Thanks for responding,
Steve
Colin Keith wrote:
> In article <39838E3F.D599A25C@home.com>, "Stephen L. Sims" <s1sims@home.com> wrote:
> ># Now lets convert them thar' audio files
> > rmdtopvf("$msg") | pvfspeed ("-s 8000") | pvftoau (">$myjoin");
>
> Ooh, line 33.
> They'd want to be logical OR's (||) rather than bitwise OR's (|) I assume.
> It's complaining because its taking the return code of each sub routine
> (that happens to call an external program cos of the magic of Shell.pm) and
> bitwise OR'ing them together ... and then not assigning it to anything -
> hence the context is void.
>
> Thus:
>
> rmdtopvf("$msg") || pvfspeed("-s 8000") || pvftoau(">$myjoin");
>
> Shouldn't that be && anyway? So if one fails it doesn't continue to try and
> process them.
>
> Better still would be to check if each worked and log it to a file if one
> fails ... maybe even using "or die" if it doesn't. But that'll only get
> *someone* coming along and posting about how you don't need to check the
> return values of code and how people should stop advocating the use of "or
> die" again :-)
>
> [ HTML/VCF/Othercrap snipped ]
>
> ---
> Colin Keith
> Systems Administrator
> Network Operations Team
> ClaraNET (UK) Ltd. NOC
--------------75DE23F78E50DA12A414DF29
Content-Type: text/x-vcard; charset=us-ascii;
name="s1sims.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Stephen L. Sims
Content-Disposition: attachment;
filename="s1sims.vcf"
begin:vcard
n:Sims;Stephen
tel;fax:402-682-0904
tel;home:402-682-0904
tel;work:402-232-3622
x-mozilla-html:TRUE
org:DFAS-OM/ARA;Offutt AFB, NE
adr:;;12125 So 28th St ;Omaha;NE;68123;
version:2.1
email;internet:s1sims@home.com
title:SSgt./USAF
note:work email: stephen.sims@dfas.mil
x-mozilla-cpt:;22496
fn:Steve Sims
end:vcard
--------------75DE23F78E50DA12A414DF29--
------------------------------
Date: Mon, 31 Jul 2000 05:40:19 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Shell commands
Message-Id: <slrn8oa49v.fp6.tjla@thislove.dyndns.org>
I was shocked! How could Stephen L. Sims <s1sims@home.com>
say such a terrible thing:
>This is a multi-part message in MIME format.
Don't do that, thanks all the same :)
>I get this error when I exec the script: Useless use of bitwise or in
>void context at convert.pl line 33.
>
>Here is the script:
>
>#!/usr/bin/perl -w
>
># Use the Shell module so we can use Unix commands and utilities
>
>use Shell qw(rmdtopvf pvfspeed pvftoau |);
^
This doesn't do what you want :)
># loop through the /var/spool/voice/incoming and convert
>
>$ext = ".au";
>$msg ="";
>$myjoin = "";
>
>foreach $msg (<*.rmd>) { # step through the list of *.rmd files
> $myjoin = "$msg"."$ext"; # concatenate to put an .au ext on the
>file
> #print "$myjoin\n";
>
># Now lets convert them thar' audio files
> rmdtopvf("$msg") | pvfspeed ("-s 8000") | pvftoau (">$myjoin");
I don't think you want to do that. Have a look at "perldoc perlop" to
see what you are *really* doing. Then have a look at:
perldoc -f system
and the section on backticks in the perlop page which will give you a
good idea. Hint: I don't think you want to "use Shell".
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
We all have ability. The difference is how we use it.
-Stevie Wonder
------------------------------
Date: Mon, 31 Jul 2000 00:29:03 GMT
From: Penguin Knight <penguinknight@yahoo.com>
Subject: simple script, please help!
Message-Id: <8m2h8d$r5u$1@nnrp1.deja.com>
Hello,
How would one find out if a user is logged on from within a perl script?
Is there a functions that does that?
TIA,
PK
--
W2K, now approaching 23x6 availability
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 30 Jul 2000 21:43:14 -0400
From: "Dominik Slusarczyk" <dslusarc@blizzardgames.com>
Subject: Re: simple script, please help!
Message-Id: <3984d940_2@nntp2.nac.net>
I aske da question a few posts down about a module that might give this kind
of information.
If you're on a UNIX system, though, you can always perse the output of `w`.
Dominik
Penguin Knight <penguinknight@yahoo.com> wrote in message
news:8m2h8d$r5u$1@nnrp1.deja.com...
> Hello,
> How would one find out if a user is logged on from within a perl script?
> Is there a functions that does that?
>
> TIA,
> PK
>
> --
> W2K, now approaching 23x6 availability
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
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 3853
**************************************