[16434] in Perl-Users-Digest
Perl-Users Digest, Issue: 3846 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jul 30 00:05:25 2000
Date: Sat, 29 Jul 2000 21:05:10 -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: <964929910-v9-i3846@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 29 Jul 2000 Volume: 9 Number: 3846
Today's topics:
Re: Apology to perl newsgroup <gee308@mediaone.net>
Re: Better way to do this pattern match? <mauldin@netstorm.net>
Re: Data Editing <godzilla@stomp.stomp.tokyo>
Re: day_of_week() and age() without using Date::Calc ? <dennis_marti@yahoo.com>
Forking question <templar318@earthlink.net>
Re: Forking question (Abigail)
Re: Forking question <templar318@earthlink.net>
Re: Forking question <tony_curtis32@yahoo.com>
hash questions jliu34740@my-deja.com
Re: hash questions <uri@sysarch.com>
Re: how to query oracle database and send output to scr <galenboyer@yahoo.com>
Re: I Am An Idiot <flavell@mail.cern.ch>
Re: I Am An Idiot <godzilla@stomp.stomp.tokyo>
Re: I Am An Idiot (Gwyn Judd)
Re: Is "exit()" really necessary? (Abigail)
Re: Is "exit()" really necessary? (Gwyn Judd)
Re: Is "exit()" really necessary? (Abigail)
Listening for activity on a port 7brankin9@my-deja.com
Re: Listening for activity on a port (NP)
Re: newb Q, Our perl guy left!! <anmcguire@ce.mediaone.net>
Re: newb Q, Our perl guy left!! <kuchler@ajubasolutions.com>
Online RPG using SQL? <jarcher@gmx.net>
Re:Shell commands <s1sims@home.com>
Re: Removing all HTML tags from a String <templar318@earthlink.net>
Running other programs in background ericr@yankthechain.com
Re: Running other programs in background <tina@streetmail.com>
Re: Running other programs in background ericr@yankthechain.com
Re: Running other programs in background (Tim Hammerquist)
Re: Running other programs in background ericr@yankthechain.com
Re: Sockets <sturman@hate.midsouth.rr.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 30 Jul 2000 01:01:03 GMT
From: Toy <gee308@mediaone.net>
Subject: Re: Apology to perl newsgroup
Message-Id: <39838367.B003F98F@mediaone.net>
I don't like killing trees and it costs money too. online references are
a plus!!
Andrew Johnson wrote:
> In article <3981FE3A.D2807E3B@toy.eyep.net>,
> jtoy <toyboy@toy.eyep.net> wrote:
>
> ! I recently posted an article callled "help newb Q perl guy just left"
> ! . The thread got out of hand because of the way I asked my question
> ! and then after people answered, I talked back rudely. I am sorry for
> ! causing trouble in here. If possible, I would like to join this
> ! newsgroup in hopes of learning and understanding perl and its
> ! community. If I am not welcome, I understand. Once again sorry, and
>
> It is not that you are not welcome -- but I'd suggest just hanging
> out for a while (lurking) ... after all, if you want to participate
> in a community, the least you can do is watch the community for a
> while and learn.
>
> ! I won't make any trouble anymore. Also, could anyone please tell me
> ! what a killfile is? I heard the name many times in hear, but have
>
> If I killfile you (as in *plonk*) it means I will no longer see your
> posts. You are probably not being read by many of the ones who can
> help you if you have a question -- but take heart, some set expiry
> dates on their killfile entries, so you still have a chance.
>
> ! never heard of it before. And finally, what specific material would
> ! you recommend for me to read to get a dip into perl? Thanks.
>
> I can't give an unbiased recommendation for dead trees but,
>
> perldoc perl
> perldoc perltoc
> perldoc perlfaq
>
> those are a useful start to see what the perl distribution already
> gives you for free.
>
> andrew
>
> --
> Andrew L. Johnson http://members.home.net/perl-epwp/
> It may be that your sole purpose in life is simply to
> serve as a warning to others.
>
------------------------------
Date: Sun, 30 Jul 2000 00:26:55 GMT
From: Jim Mauldin <mauldin@netstorm.net>
Subject: Re: Better way to do this pattern match?
Message-Id: <398375D4.E3AFE02E@netstorm.net>
Bart Lateur wrote:
> @maybe = /(?<![\w\+\-])(\w+)/g;
This is where I was stumped, so thanks, but now the issue is this:
> my $sub = " sub { local \$_ = shift; @{[
> join ' && ', @regex, @or?qq'/@or/':() ]} }";
> my $search = eval $sub or die "Cannot build search code: $@";
$search contains a reference to an anonymous CODE(0x87615e4) {! news to
me !) which I assume contains Perl byte-code and has the advantage -
here's the question - that the pattern is compiled only once and then
evalauted over (0..zillion) lines, hence very efficient?
Very nice, anyway, and yet more food for thought.
-- Jim
------------------------------
Date: Sat, 29 Jul 2000 17:36:01 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Data Editing
Message-Id: <39837871.9AA56983@stomp.stomp.tokyo>
psycho wrote:
>
> i've posted something like this before i need to be able to open
> a file and edit the data thats in the file i've found some
> source code it's from cgi101.com.
(snipped)
Would you mind posting a cgi101.com link to this script?
Godzilla!
--
print "http://mailto:%63%61ll%67i%72l@3483852801/%7e%63%61ll%67i%72l";
------------------------------
Date: Sat, 29 Jul 2000 22:53:35 -0400
From: Dennis Marti <dennis_marti@yahoo.com>
Subject: Re: day_of_week() and age() without using Date::Calc ?
Message-Id: <dennis_marti-10F9E7.22533529072000@news.starpower.net>
In article <8lugnm$78s$1@nnrp1.deja.com>, madsere@my-deja.com wrote:
> In article <8lj1d0$pmp$1@nnrp1.deja.com>,
> madsere@my-deja.com wrote:
> > I am frantically looking for two functions:
> >
> > 1) One that can return the day-of-week for a given date
> > 2) one that can return the age for a given date (birthday)
> >
> > Yeah I know - Date::Calc can do it.
> >
> > Unfortunately my web hosting service doesn't have it installed and is
> > not very quick in installing new modules - to say the least.
>
> Hmm, nobody knows? really?
use lib 'Macintosh HD:Desktop Folder:DateManip-5.39';
use Manip;
$TZ = "UTC";
$now = Date::Manip::ParseDate( "today" );
$born = Date::Manip::ParseDate( "10/25/1995" );
$err = "";
$delta = Date::Manip::DateCalc( $born, $now, \$err, 1 );
print "$now - $born == $delta\n";
__END__
prints out
2000072922:41:13 - 1995102500:00:00 == +4:9:0:4:22:41:13
The Date::Manip module by Sullivan Beck (on CPAN) can be used from
whatever directory you feel like putting it in. You don't need to wait
for the admin to install it.
It also has a function named 'Date_DayOfWeek', and support for English,
French, Swedish, German, Dutch, Polish, Spanish, Portuguese, Romanian,
and Italian.
Dennis
------------------------------
Date: Sun, 30 Jul 2000 02:28:08 GMT
From: David Tsai <templar318@earthlink.net>
Subject: Forking question
Message-Id: <39839295.93E6EB49@earthlink.net>
I am trying to program a SMTP relay script and I am using fork to spawn
child processes to make it faster. However, for some reason after I
spawn 47 childs it gives me a fork error. I am currently using an
"exit" command to exit each child. I am even using the "sleep" command
to wait for some of the childs to end before spawning new ones so that
it won't take up too many system resources. However, it still gives me
an error. Anybody got any ideas?
Best Regards,
David Tsai
------------------------------
Date: 29 Jul 2000 22:42:08 EDT
From: abigail@foad.org (Abigail)
Subject: Re: Forking question
Message-Id: <slrn8o75fl.vcg.abigail@alexandra.foad.org>
David Tsai (templar318@earthlink.net) wrote on MMDXXV September MCMXCIII
in <URL:news:39839295.93E6EB49@earthlink.net>:
:: I am trying to program a SMTP relay script and I am using fork to spawn
:: child processes to make it faster. However, for some reason after I
:: spawn 47 childs it gives me a fork error. I am currently using an
:: "exit" command to exit each child. I am even using the "sleep" command
:: to wait for some of the childs to end before spawning new ones so that
:: it won't take up too many system resources. However, it still gives me
:: an error. Anybody got any ideas?
What is a "fork error"? What is $! when your fork fails?
Abigail
--
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
------------------------------
Date: Sun, 30 Jul 2000 02:57:20 GMT
From: David Tsai <templar318@earthlink.net>
Subject: Re: Forking question
Message-Id: <39839968.2AD1B2BF@earthlink.net>
A fork error is when an error occurs while trying to spawn a new child. The
$! variable contains a string that describes the error.
> David Tsai (templar318@earthlink.net) wrote on MMDXXV September MCMXCIII
> in <URL:news:39839295.93E6EB49@earthlink.net>:
> :: I am trying to program a SMTP relay script and I am using fork to spawn
> :: child processes to make it faster. However, for some reason after I
> :: spawn 47 childs it gives me a fork error. I am currently using an
> :: "exit" command to exit each child. I am even using the "sleep" command
> :: to wait for some of the childs to end before spawning new ones so that
> :: it won't take up too many system resources. However, it still gives me
> :: an error. Anybody got any ideas?
>
> What is a "fork error"? What is $! when your fork fails?
>
> Abigail
> --
> perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
------------------------------
Date: 29 Jul 2000 22:08:23 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Forking question
Message-Id: <873dkse2mw.fsf@limey.hpcc.uh.edu>
[ dejeopardised, original relevant text first, added text
afterward ]
>> On Sun, 30 Jul 2000 02:57:20 GMT,
>> David Tsai <templar318@earthlink.net> said:
>> David Tsai (templar318@earthlink.net) wrote on MMDXXV
>> September MCMXCIII in
>> <URL:news:39839295.93E6EB49@earthlink.net>: :: I am
>> trying to program a SMTP relay script and I am using
>> fork to spawn :: child processes to make it faster.
>> However, for some reason after I :: spawn 47 childs it
>> gives me a fork error. I am currently using an ::
>> "exit" command to exit each child. I am even using the
>> "sleep" command :: to wait for some of the childs to
>> end before spawning new ones so that :: it won't take
>> up too many system resources. However, it still gives
>> me :: an error. Anybody got any ideas?
>>
>> What is a "fork error"? What is $! when your fork
>> fails?
> A fork error is when an error occurs while trying to
> spawn a new child. The $! variable contains a string
> that describes the error.
I think Abigail knows that. She was trying to get you to
elucidate somewhat further on the particulars of your
problem and to put in code to show the errors that
actually occur, rather than your interpretation of the
situation.
Rhetorical questions don't work in this newsgroup, do
they?
>> Abigail -- perl -wle 'print "Prime" if (1 x shift) !~
>> /^1?$|^(11+?)\1+$/'
Abigail -- do you keep an archive of these gems?
hth
t
--
"With $10,000, we'd be millionaires!"
Homer Simpson
------------------------------
Date: Sun, 30 Jul 2000 00:24:34 GMT
From: jliu34740@my-deja.com
Subject: hash questions
Message-Id: <8lvsk0$45e$1@nnrp1.deja.com>
I am new in the perl language. What I tried to do here is to access a
associative array(hash).
It looks like it all works fine in my while loop, but when I tried to
print out a result after the loop is done. I am getting weird result.
Not all the records are printed out. why is that? The following is the
part of the code.
while ( ($id, $wage) = each%List)
{
if ($wage >5)
{
$wage = $wage *2;
$List{id}=$wage;
}
print ("\n id = $id, wage = $wage);
}
while ( ($id, $wage) = each%List ){
print ("\n id = $id, wage = $wage);
}
...
Another question I have is:
Let's assume that I have an associative array, the key and value are
assigned through <STDIN>. How do I assign a new value to the key?
Any suggestions and help are very much appreciated.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 30 Jul 2000 00:44:26 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: hash questions
Message-Id: <x7punw4fbo.fsf@home.sysarch.com>
>>>>> "j" == jliu34740 <jliu34740@my-deja.com> writes:
j> while ( ($id, $wage) = each%List)
j> {
j> if ($wage >5)
j> {
j> $wage = $wage *2;
j> $List{id}=$wage;
^^
that should be $id.
and combine those 2 lines as:
$List{$id} *= 2 ;
j> Let's assume that I have an associative array, the key and value
j> are assigned through <STDIN>. How do I assign a new value to the
j> key?
thay are called hashes like you say in the subject.
and your question here is not clear? assigning through <STDIN> make no
sense. <STDIN> reads a line of text (normally). you have to process it
in some way to get a key/value pair.
and to assign to a hash just do what you did above:
$List{ $key } = $value ;
and use lower case names for perl variabled.
and put a space after each, makes it much more readable.
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: 29 Jul 2000 20:55:50 -0400
From: Galen Boyer <galenboyer@yahoo.com>
Subject: Re: how to query oracle database and send output to screen
Message-Id: <u7la48mi1.fsf@yahoo.com>
,----
| Hi,
| I need to query my oracle database 8.1.6 on solaris 7 and send the
| results to the screen. I might also need to send the output to a
| file. I've looked into DBD and DBI but there are some modifications
| that need to be done to some java oracle binaries to get it to work.
| I'd rather not modify these files on my production server. I've done
| this with informix:
|
| #!/usr/local/bin/perl
| $ENV{INFORMIXSERVER} = "n_shm";
| open DBACCESS, "| /u/informix/bin/dbaccess";
| print DBACCESS qq{
| database mydatabase\@n_shm;
| UNLOAD TO '/u/myfile'
| SELECT *
| FROM a_table;
| };
| close DBACCESS;
`----
#!/bin/sh
#THIS WILL SEND TO SCREEN
sqlplus login/password@instance << EOF
select ....
;
EOF
#!/bin/sh
#THIS WILL SEND TO file
sqlplus login/password@instance << EOF > file
select ....
;
EOF
This is unix specific, not Oracle. Substitute dbaccess and this
will work as well.
I think Perl has this. I would be surprised if it didn't.
--
Galen Boyer
Database Architect
Primix Solutions, www.primix.com
------------------------------
Date: Sat, 29 Jul 2000 23:59:17 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: I Am An Idiot
Message-Id: <Pine.GHP.4.21.0007292358251.9706-100000@hpplus03.cern.ch>
On Sat, 29 Jul 2000, Dave Cross wrote:
> Who's lying now Kira?
In order to lie it's necessary to comprehend the meaning of truth.
------------------------------
Date: Sat, 29 Jul 2000 15:44:28 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: I Am An Idiot
Message-Id: <39835E4C.A537F300@stomp.stomp.tokyo>
Dave Cross wrote:
> Godzilla! chortled:
> >Dave Cross wrote:
> >> Larry Rosler wrote:
> > This statement is in direct contradiction of your
> > previous statement, paraphrased, "... _always_ use die."
> This is what I said (not paraphrased, cut and pasted directly from my
> post).
> "You should _always_ check the return value from a call to open."
> How is that in cntradiction with what you quoted me saying above?
> Who's lying now Kira?
Why you of course. This is obvious. I did not quote
you nor indicate I am quoting you. Quite the opposite,
I carefully and fairly indicated, paraphrasing. This
is a courtesy you do not and did not afford me.
Continuing to tell lies like this, will only garnish
from me, a back hand slap to your delicate male ego.
However, it is my experience, a wise woman will allow
men diplomatic face saving room as men cannot cope with
a bruised ego, unlike women with instinctive inner
personal strength and no fear of acknowledgement of
making a mistake nor any fear of simply being wrong.
Otherwords, leave you boys a way to worm out of your
wrong doing with a false sense of macho pride. You
didn't use the term "die" in your article.
Wiggle enough, you may worm your way out of responsibility
for these lies you told about me, but you won't shirk
consequences, when this involves me. Men are adept at
forgetting. Women, like elephants, never forget, current
indiscretions nor past indiscretions.
Godzilla!
--
$godzilla = "godzilla rocks!";
srand(time() ^ ($$ + ($$ << 15)));
sub randcase
{ rand(40) < 20 ? "\u$1" : "\l$1" ; }
$godzilla =~ s/([a-z])/randcase($1)/gie;
print $godzilla; exit;
------------------------------
Date: Sat, 29 Jul 2000 23:28:22 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: I Am An Idiot
Message-Id: <slrn8o6q4k.6ki.tjla@thislove.dyndns.org>
I was shocked! How could Godzilla! <godzilla!@stomp.stomp.tokyo>
say such a terrible thing:
>As a clear example,
>
> 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; }
>
Consider what happens if the file contains the number "0". A valid sum
of money to be sure.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Can anyone remember when the times were not hard, and money not scarce?
------------------------------
Date: 29 Jul 2000 19:00:21 EDT
From: abigail@foad.org (Abigail)
Subject: Re: Is "exit()" really necessary?
Message-Id: <slrn8o6ofr.vcg.abigail@alexandra.foad.org>
Bart Lateur (bart.lateur@skynet.be) wrote on MMDXXIV September MCMXCIII
in <URL:news:m4h6os0h03n856au86luuqoidjuat44v77@4ax.com>:
..
.. I try to avoid exit() as much as possible. If I ever need it inside a
.. sub, I tend to consider this a defeat. So I'll try to get rid of it.
To me, that falls in the same category as not using return, goto, regexes,
addition, or semicolons.
Abigail
--
sub _ {$_ = shift and y/b-yB-Y/a-yB-Y/ xor !@ _?
exit print :
print and push @_ => shift and goto &{(caller (0)) [3]}}
split // => "KsvQtbuf fbsodpmu\ni flsI " xor & _
------------------------------
Date: Sun, 30 Jul 2000 02:32:19 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Is "exit()" really necessary?
Message-Id: <slrn8o74tg.7h1.tjla@thislove.dyndns.org>
I was shocked! How could Abigail <abigail@foad.org>
say such a terrible thing:
>Bart Lateur (bart.lateur@skynet.be) wrote on MMDXXIV September MCMXCIII
>in <URL:news:m4h6os0h03n856au86luuqoidjuat44v77@4ax.com>:
>..
>.. I try to avoid exit() as much as possible. If I ever need it inside a
>.. sub, I tend to consider this a defeat. So I'll try to get rid of it.
>
>To me, that falls in the same category as not using return, goto, regexes,
>addition, or semicolons.
>
>
>Abigail
>--
>sub _ {$_ = shift and y/b-yB-Y/a-yB-Y/ xor !@ _?
> exit print :
> print and push @_ => shift and goto &{(caller (0)) [3]}}
> split // => "KsvQtbuf fbsodpmu\ni flsI " xor & _
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 & _
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
American society is a sort of flat, fresh-water pond which absorbs
silently, without reaction, anything which is thrown into it.
-Henry Brooks Adams
------------------------------
Date: 29 Jul 2000 22:40:30 EDT
From: abigail@foad.org (Abigail)
Subject: Re: Is "exit()" really necessary?
Message-Id: <slrn8o75cj.vcg.abigail@alexandra.foad.org>
Gwyn Judd (tjla@guvfybir.qlaqaf.bet) wrote on MMDXXV September MCMXCIII
in <URL:news:slrn8o74tg.7h1.tjla@thislove.dyndns.org>:
)) I was shocked! How could Abigail <abigail@foad.org>
)) say such a terrible thing:
)) >Bart Lateur (bart.lateur@skynet.be) wrote on MMDXXIV September MCMXCIII
)) >in <URL:news:m4h6os0h03n856au86luuqoidjuat44v77@4ax.com>:
)) >..
)) >.. I try to avoid exit() as much as possible. If I ever need it inside a
)) >.. sub, I tend to consider this a defeat. So I'll try to get rid of it.
)) >
)) >To me, that falls in the same category as not using return, goto, regexes,
)) >addition, or semicolons.
)) >
)) >
)) >Abigail
)) >--
)) >sub _ {$_ = shift and y/b-yB-Y/a-yB-Y/ xor !@ _?
)) > exit print :
)) > print and push @_ => shift and goto &{(caller (0)) [3]}}
)) > split // => "KsvQtbuf fbsodpmu\ni flsI " xor & _
))
)) 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.
Abigail
--
perl -le 's[$,][join$,,(split$,,($!=85))[(q[0006143730380126152532042307].
q[41342211132019313505])=~m[..]g]]e and y[yIbp][HJkP] and print'
------------------------------
Date: Sun, 30 Jul 2000 02:16:58 GMT
From: 7brankin9@my-deja.com
Subject: Listening for activity on a port
Message-Id: <8m036o$8l1$1@nnrp1.deja.com>
Hello,
I need to write a Perl script that will listen for activity on a port.
If it senses packets, it will execute a shell script.
My question: what's the simplest way to listen for activity w/o
actually opening a socket on that port? I know I could tail the output
of tcpdump, but that's a bit clunky.
Any advice appreciated. Thanks!
Sincerely,
Brian Rankin
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 30 Jul 2000 03:36:49 GMT
From: nvp@spamnothanks.speakeasy.org (NP)
Subject: Re: Listening for activity on a port
Message-Id: <lpNg5.164273$t91.1415945@news4.giganews.com>
30 Jul 2000 02:16:58 GMT, 7brankin9@my-deja.com <7brankin9@my-deja.com> wrote:
:
: My question: what's the simplest way to listen for activity w/o
: actually opening a socket on that port? I know I could tail the output
: of tcpdump, but that's a bit clunky.
If I understand your question correctly, I'd suggest executing your
script out of inetd.
--
Nate II
------------------------------
Date: Sat, 29 Jul 2000 20:15:07 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: newb Q, Our perl guy left!!
Message-Id: <Pine.LNX.4.21.0007292011030.19898-100000@hawk.ce.mediaone.net>
On Fri, 28 Jul 2000, jtoy asked:
][ what is a killfile?(I really don't know)
It is something that people who behave badly get put into. Are you good
with *nix? If so it is the equivalent of this.
cat jtoy > /dev/null 2>&1
Basically, anything you say will not be heard by those who killfile you.
"*plonk*", and "They can't hear you scream in /dev/null!" are good
indicators that you have just been killfiled! :-)
anm
--
/*------------------------------------------------------------------------.
| Andrew N. McGuire |
| anmcguire@ce.mediaone.net |
| perl -le'print map?"(.*)"?&&($_=$1)&&s](\w+)]\u$1]g&&$_=>`perldoc -qj`' |
`------------------------------------------------------------------------*/
------------------------------
Date: Sat, 29 Jul 2000 11:42:56 -0700
From: Dan Kuchler <kuchler@ajubasolutions.com>
Subject: Re: newb Q, Our perl guy left!!
Message-Id: <398325B0.5A21BC54@ajubasolutions.com>
jtoy wrote:
>
> I don't know any perl and our perl guy just left so I need a little
> help.We have a script at work for email that collects from a form and
> sends the data via email. We need to make it so the email that is sent
> to us in the form shows the variable and then 21 spaces dont the line,
> shows the user input:(example below)
>
> name1: variable:
> name2: variable:
> name3: variable:
>
> Here is the code that I think needs to be fixed.
>
> $name =~ tr/+/ /;
> $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
>
> $value =~ tr/+/ /;
> $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
>
> $value =~ s/<!--(.|\n)*-->//g;
>
> if (defined($Config{$name})) {
> $Config{$name} = $value;
> }
> else {
> if ($Form{$name} && $value) {
> $Form{$name} = "$Form{$name}, $value";
> }
> elsif ($value) {
> push(@Field_Order,$name);
> $Form{$name} = $value;
> }
> }
> }
>
> $Config{'required'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
> $Config{'required'} =~ s/(\s+)?\n+(\s+)?//g;
> $Config{'env_report'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
> $Config{'env_report'} =~ s/(\s+)?\n+(\s+)?//g;
> $Config{'print_config'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
> $Config{'print_config'} =~ s/(\s+)?\n+(\s+)?//g;
>
> @Required = split(/,/,$Config{'required'});
> @Env_Report = split(/,/,$Config{'env_report'});
> @Print_Config = split(/,/,$Config{'print_config'});
> }
>
> If you need more of the code, please ask me and I'll post the whole
> thing. This is what are emails currently look like:
>
> firstname: John
>
> lastname: SMith
>
> adr1: 100 Hell
>
> city: Mexico
>
> state: MA
>
> zip: 02324
>
> phone: 6134234
>
> fax: 614354354
If the only problem you are having is that the e-mail
isn't formatted the way you want it to be (you want the
values aligned in a column) take a look at formatting
the text. Typically you can do this with something
like 'printf' or 'sprintf' with the right format
specifiers. For more information about these functions
look at the docs at:
http://www.perl.com/pub/v/documentation/
------------------------------
Date: Sat, 29 Jul 2000 18:36:52 -0400
From: James Archer <jarcher@gmx.net>
Subject: Online RPG using SQL?
Message-Id: <39835C84.CB79607F@gmx.net>
I've been in the process of deveoping plans for an web-based
role-playing game, and I'm looking at different ways to implement it.
Several people have told me that the best way to go would probably be to
write it in Perl using a SQL database (for character stats, dynamic
information, etc.) I'd appreciate any thoughts on this matter. Do you
think the Perl/SQL combination would work, or are there better ways to
implement such a project? Also, since my Perl skills are still pretty
rough, if anyone could point me toward some online info about how to use
SQL from Perl I'd be very grateful.
Thanks!
James
------------------------------
Date: Sun, 30 Jul 2000 02:58:24 GMT
From: "Stephen L. Sims" <s1sims@home.com>
Subject: Re:Shell commands
Message-Id: <39838E3F.D599A25C@home.com>
This is a multi-part message in MIME format.
--------------8BA5D5E038163AC051949D57
Content-Type: multipart/alternative;
boundary="------------E96AF52EAAC4CAFB856E9550"
--------------E96AF52EAAC4CAFB856E9550
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I just set up my Linux box to act as an answering machine, only problem
vgetty saves the messages with a *.rmd format that you have to use vm to
play through your modem speaker. Have to use the pvf utilities to
convert file to *.au format at the command line, and this all works
great. Here's what I want to do, want to put a Perl script in
cron/hourly that will cycle through the messages and convert them to
*.au format. Then I want to have the system email the messages to me and
my wife. I've written a short little Perl script(below) that is giving
me trouble with executing the shell commands to conver the files. Using
the Shell.pm module and just can't seem to get it right. Could someone
take a look and point out my errors? Also want to have the converted
files emailed automatically, if someone has done this what module should
I use?
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
##################################
# This program is used to convert#
# phone messages in *.rmd format #
# to *.au format for playing #
# back. Files can then be played #
# using programs like RealAudio #
# or Windows Media Player so #
# you can listen to your phone #
# messages. #
# Program design by: #
# Steve Sims #
# 28 Jul 00 #
##################################
# Use the Shell module so we can use Unix commands and utilities
use Shell qw(rmdtopvf pvfspeed pvftoau |);
# 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");
}
Thanks in advance,
Steve Sims
--------------E96AF52EAAC4CAFB856E9550
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
I just set up my Linux box to act as an answering machine, only problem
vgetty saves the messages with a *.rmd format that you have to use vm to
play through your modem speaker. Have to use the pvf utilities to convert
file to *.au format at the command line, and this all works great. Here's
what I want to do, want to put a Perl script in cron/hourly that will cycle
through the messages and convert them to *.au format. Then I want to have
the system email the messages to me and my wife. I've written a short little
Perl script(below) that is giving me trouble with executing the shell commands
to conver the files. Using the Shell.pm module and just can't seem to get
it right. Could someone take a look and point out my errors? Also want
to have the converted files emailed automatically, if someone has done
this what module should I use?
<p>I get this error when I exec the script: <b>Useless use of bitwise or
in void context at convert.pl line 33.</b>
<br><b></b>
<p>Here is the script:
<p>#!/usr/bin/perl -w
<p>##################################
<br># This program is used to convert#
<br># phone messages in *.rmd format #
<br># to *.au format for playing #
<br># back. Files can then be played #
<br># using programs like RealAudio #
<br># or Windows Media Player so #
<br># you can listen to your phone #
<br># messages.
#
<br># Program design by:
#
<br># Steve Sims
#
<br># 28 Jul 00
#
<br>##################################
<p># Use the Shell module so we can use Unix commands and utilities
<p>use Shell qw(rmdtopvf pvfspeed pvftoau |);
<p># loop through the /var/spool/voice/incoming and convert
<p>$ext = ".au";
<br>$msg ="";
<br>$myjoin = "";
<p>foreach $msg (<*.rmd>) { # step through the list of *.rmd files
<br> $myjoin = "$msg"."$ext";
# concatenate to put an .au ext on the file
<br> #print "$myjoin\n";
<p># Now lets convert them thar' audio files
<br> rmdtopvf("$msg") | pvfspeed
("-s 8000") | pvftoau (">$myjoin");
<br>}
<p>Thanks in advance,
<p>Steve Sims </html>
--------------E96AF52EAAC4CAFB856E9550--
--------------8BA5D5E038163AC051949D57
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;FPT
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:;17664
fn:Steve Sims
end:vcard
--------------8BA5D5E038163AC051949D57--
------------------------------
Date: Sun, 30 Jul 2000 02:32:27 GMT
From: David Tsai <templar318@earthlink.net>
Subject: Re: Removing all HTML tags from a String
Message-Id: <39839393.7581C1A8@earthlink.net>
Aaron,
Try something like this...
$desc =~ s/<([^>])*>//g;
The [^>] means any character that isn't the closing bracket for a HTML tag.
And the star asterisk means any number of characters that isn't a '>'. The
? does not mean any character. You would use a dot (.)
Best Regards,
David Tsai
CGI Paradise
http://www.web-consult.com/scripts/
> I am attempting to remove every HTML tag from a large string which is
> made up of all the lines of an HTML page. My goal is to create plain
> text which I can put into a sort of search engine page as a
> representation of the content of that page for a PERL site search
> engine.
>
> I have been trying to use Regex code to deal with this problem by
> something like this:
>
> $desc =~ s/(<?*>)//g;
>
> Yet I don't have a good understanding of regex and I understand that the
> code I am using above is not valid. It was my understanding that the ?
> would take any character, and the * would allow for as many of them as
> needed until it finds the > to end the match. But this doesn't work. Can
> anyone advise what I should do, where can I find this code. I tryed the
> PERLFAQ many times but can't find it anywhere.
>
> Also, although I put in this line of code ($desc =~ s/\n//g;) to the
> string with all of the page code in it, I still end up with carriage
> returns when I print the string to a simple text file. Why won't this
> get rid of those line returns?
>
> Thanks for any advice you can provide to these frustrating problems.
> Aaron H.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Sat, 29 Jul 2000 22:37:51 GMT
From: ericr@yankthechain.com
Subject: Running other programs in background
Message-Id: <8lvmc0$8u$1@nnrp1.deja.com>
How can I make a Perl program run another program in the background?
When I try `programname` it freezes the perl program until the called
upon program has quit. Is there any way to do this?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 29 Jul 2000 23:01:03 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: Running other programs in background
Message-Id: <8lvnnf$5abb4$2@ID-24002.news.cis.dfn.de>
hi,
ericr@yankthechain.com wrote:
> How can I make a Perl program run another program in the background?
> When I try `programname` it freezes the perl program until the called
> upon program has quit. Is there any way to do this?
yes, you have to fork a new process.
perldoc -f fork
HTH
tina
--
http://tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
"The Software required Win98 or better, so I installed Linux."
------------------------------
Date: Sat, 29 Jul 2000 23:45:40 GMT
From: ericr@yankthechain.com
Subject: Re: Running other programs in background
Message-Id: <8lvqb4$2tg$1@nnrp1.deja.com>
In article <8lvnnf$5abb4$2@ID-24002.news.cis.dfn.de>,
news@tinita.de wrote:
> hi,
> ericr@yankthechain.com wrote:
> > How can I make a Perl program run another program in the background?
> > When I try `programname` it freezes the perl program until the
called
> > upon program has quit. Is there any way to do this?
>
> yes, you have to fork a new process.
> perldoc -f fork
>
> HTH
> tina
I looked it up in the Camel book and tried FORK: { `programname`; }
which didn't work. The Camel book says this may only work on POSIX
compliant OS's and I'm running Perl for Win32 - might that be it? If
so, is there a way to do this on a Win32 system?
> --
> http://tinita.de \ enter__| |__the___ _ _ ___
> tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
> search & add comments \ \ _,_\ __/\ __/_| /__/ perception
> "The Software required Win98 or better, so I installed Linux."
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 30 Jul 2000 00:07:42 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: Running other programs in background
Message-Id: <slrn8o6t05.1du.tim@degree.ath.cx>
On Sat, 29 Jul 2000 23:45:40 GMT, ericr@yankthechain.com
<ericr@yankthechain.com> wrote:
> In article <8lvnnf$5abb4$2@ID-24002.news.cis.dfn.de>,
> news@tinita.de wrote:
> > hi,
> > ericr@yankthechain.com wrote:
> > > How can I make a Perl program run another program in the background?
> > > When I try `programname` it freezes the perl program until the
> called
> > > upon program has quit. Is there any way to do this?
> >
> > yes, you have to fork a new process.
> > perldoc -f fork
>
> I looked it up in the Camel book and tried FORK: { `programname`; }
> which didn't work. The Camel book says this may only work on POSIX
> compliant OS's and I'm running Perl for Win32 - might that be it? If
> so, is there a way to do this on a Win32 system?
Win32 OS's don't natively support process forking. Perl 5.6 for Win32
(experimentally) implements a workaround for this, but don't count on it
working. btw, I'm not familiar with the FORK: { ... } structure. Last
I checked, fork() was a function. :)
--
-Tim Hammerquist <timmy@cpan.org>
A liar should have a good memory.
-- Quintilian
------------------------------
Date: Sun, 30 Jul 2000 01:10:19 GMT
From: ericr@yankthechain.com
Subject: Re: Running other programs in background
Message-Id: <8lvv9q$607$1@nnrp1.deja.com>
In article <slrn8o6t05.1du.tim@degree.ath.cx>,
tim@degree.ath.cx (Tim Hammerquist) wrote:
> On Sat, 29 Jul 2000 23:45:40 GMT, ericr@yankthechain.com
> <ericr@yankthechain.com> wrote:
> > In article <8lvnnf$5abb4$2@ID-24002.news.cis.dfn.de>,
> > news@tinita.de wrote:
> > > hi,
> > > ericr@yankthechain.com wrote:
> > > > How can I make a Perl program run another program in the
background?
> > > > When I try `programname` it freezes the perl program until the
> > called
> > > > upon program has quit. Is there any way to do this?
> > >
> > > yes, you have to fork a new process.
> > > perldoc -f fork
> >
> > I looked it up in the Camel book and tried FORK: { `programname`; }
> > which didn't work. The Camel book says this may only work on POSIX
> > compliant OS's and I'm running Perl for Win32 - might that be it? If
> > so, is there a way to do this on a Win32 system?
>
> Win32 OS's don't natively support process forking. Perl 5.6 for Win32
> (experimentally) implements a workaround for this, but don't count on
it
> working. btw, I'm not familiar with the FORK: { ... } structure.
Last
> I checked, fork() was a function. :)
>
> --
> -Tim Hammerquist <timmy@cpan.org>
I'm not sure if my last post went through correctly -
The only code example of fork I can find in the Camel book is on page
167, where it says FORK: { }
Do you know another way to fork `programname`?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 30 Jul 2000 01:30:00 GMT
From: sturman <sturman@hate.midsouth.rr.com>
Subject: Re: Sockets
Message-Id: <39838629.27946CF8@hate.midsouth.rr.com>
Johan wrote:
>
<snip>
> If you tell me to include modules to fix it, then _please please_ also give
> me an example which shows how to read from the sockets.
> Please, please help me!
I recommend the Perl Cookbook. It has some good, simple examples for
UDP and TCP/IP client/server. Of course it is somewhere around $35-40.
www.bookpool.com would probably have under $30. You can always look
over it in a bookstore...
sturman
------------------------------
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 3846
**************************************