[15789] in Perl-Users-Digest
Perl-Users Digest, Issue: 3202 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 30 03:05:59 2000
Date: Tue, 30 May 2000 00:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <959670311-v9-i3202@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 30 May 2000 Volume: 9 Number: 3202
Today's topics:
Re: adding values to an anonymous array <tony_curtis32@yahoo.com>
casting? (Neil Macneale)
couple of beginner questions ldkramer@my-deja.com
Re: directory permissions in NT <scumjr@deja.com>
Re: File Array <tina@streetmail.com>
Re: File Array (Steven Smolinski)
Re: HALL OF SHAME :-) <elaine@chaos.wustl.edu>
Re: HALL OF SHAME :-) <brian@bluecoat93.org>
Re: HALL OF SHAME :-) <Tbone@pimpdaddy.com>
Re: HALL OF SHAME :-) (Craig Berry)
Re: Help - I've been spammed with PERL (Mark P.)
Re: how do you create scalar vars from a hash? (Malcolm Dew-Jones)
LWP::UserAgent, Cookies, and ASP pages snakedjip@yahoo.com
Re: MySQL problem: $DBI::errstr always null jlamport@calarts.edu
Re: Newbie: Pattern Match Question <godzilla@stomp.stomp.tokyo>
Perl forking question (multiple times) <j-hernandez2@nwu.edu>
Re: Perl forking question (multiple times) (Steve Leibel)
Re: Perl forking question (multiple times) <someone@cs.nwu.edu>
Re: Perl related humor? <elaine@chaos.wustl.edu>
Perl Tabular -> XML <garstangd@news.com.au>
Re: Perl Tabular -> XML <randy@theory.uwinnipeg.ca>
Re: Perl Tabular -> XML <garstangd@news.com.au>
Re: scoping trouble with nested structures <mariska@excite.nl>
Re: seeking method to encode email addresses in web pag (brian d foy)
Re: seeking method to encode email addresses in web pag <Tbone@pimpdaddy.com>
Re: thank yon Philip,but.... <huxh@990.net>
Re: Translate foreign characters to English (Philip 'Yes, that's my address' Newton)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 29 May 2000 20:14:20 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: adding values to an anonymous array
Message-Id: <87bt1o6dqr.fsf@limey.hpcc.uh.edu>
>> On Mon, 29 May 2000 20:04:25 -0500,
>> Paul Phillips <paul@partitura.com> said:
> $table_ref = [ [1,2,3], [4,5,6], [7,8,9], ];
> Conway.) Now, how do I go about adding another row to
> this table? The only way I can think of is to
use strict;
my $table_ref = [[1,2,3],
[4,5,6],
[7,8,9],
];
# use Data::Dumper;
# print Dumper($table_ref);
push @$table_ref, [10,11,12];
# print Dumper($table_ref);
All you need to do is to dereference and push().
hth
t
--
"Trying is the first step towards failure"
Homer Simpson
------------------------------
Date: Tue, 30 May 2000 00:05:47 -0700
From: mac4@operamail.com (Neil Macneale)
Subject: casting?
Message-Id: <mac4-3005000005480001@user-33qtgtv.dialup.mindspring.com>
Hi all!
I am new to the world of PERL, and I seem to have missed something in the
Camel book. How do I cast something? I want to read in a character from
a file, then print the decimal value of the byte written. I know how to
do it in C, so I figured I would just cast the scalar as an (int) but
PERL didn't like that at all. I tryed printf with no luck, and I tryed
the int() function which didn't work either. What am I missing?
The problem I am trying to solve is this: When I read MacOS text files on
a Linux machine the new line characters are not recognized. I want to use
perl to modify the file so it works like a standard text file in linux. I
could do it in C, but I figured this would be an easy way to start
putting perl to use.
Anyway, thanks in advance for the help.
Neil Macneale
------------------------------
Date: Tue, 30 May 2000 04:26:41 GMT
From: ldkramer@my-deja.com
Subject: couple of beginner questions
Message-Id: <8gvftp$hf4$1@nnrp1.deja.com>
Hello, I have two questions that I haven't been able to find the
answers to. Hope someone can help!
1. Is it possible to write a CGI script that doesn't make the browser
display any new HTML when it's done running? I keep seeing references
to CGI scripts that either spit out some HTML (that wipes out what was
in the browser window) or that redirect the browser to some other
page. I can't figure out how to just "do nothing" when the CGI script
is done.
The reason why I need to do this is because I have a form (written as
an HTML page, not created by CGI) where I would like to have a few
buttons that run a CGI script but then leave the HTML page exactly like
it was. Reloading the same HTML page again won't work because I have
JavaScript arrays in memory whose values would be wiped out.
2. On Macintosh using Internet Explorer, when you use the file upload
form element, the file that is sent up to the server has all of this
additional information at the beginning and end. I don't know alot
about the Macintosh OS but I think that it is being sent up in
MacBinary format where the file's resource fork information gets
embedded into the file.(?) This is a problem if you want to use this
uploaded file in a web page because this extra info makes the file
unreadable by the browser. How to people deal with this? Do I write
Perl code that will strip this extra information out of the file? If
so, anyone happen to have such code?
Thanks!!
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 30 May 2000 02:36:34 GMT
From: "scumjr" <scumjr@deja.com>
Subject: Re: directory permissions in NT
Message-Id: <SOFY4.8343$WV.471164@news20.bellglobal.com>
> > report on directories that I do not have access to and I've tried all
> ^^^^^^^^^^^^^^^^^^^^^^^
> I wouldn't expect that to work on any system.
After re-reading that segment, it didn't sound quite like I had intended. I
want to collect statistics on files and subdirectories. The ones I can't
access I was just intending to state that it the permissions were
insufficient.
> > using the full path name and just the directory name itself, but the
> ^^^^^^^^^^^^^^^^^^^^^^^^
> You must use the full path name unless the directory is the current
> directory.
I've tried both....using the full path. And trying a directory name by
itself (which was in the current directory).
> > tests always come back "true".
> Even the ones that are complementary (-z and -s)?
I hadn't tried those yet (I hadn't really needed them). Basically all my
code does up till now is scan through directories recursively and report on
the total space used, total files, and largest file (like I said, I was just
playing :). I store the contents of the directory in an array after making
a system 'dir' call. I use the -d test to check for directories. In my
test directories I've set up there is one directory that I have no
permissions to. In my "final report" I want to mention that the folder was
inaccessible. My first try was with -R test, thinking that was all I
needed (checking for read access), but I've also tried all of the r,w,x,o
(upper and lower case) tests but with no luck. Maybe I'm way out in left
field with my thinking (it wouldn't surprise me!).
> Why not post a short self-sufficient segment of code that fails. Though
> not able to run it on your system, maybe we can see what you may have
> overlooked.
OK.....I don't have the code here (it's at work), so I'll post it tomorrow,
unless I can figure out my mistake.
Thanks for your help,
Greg
------------------------------
Date: 30 May 2000 01:08:41 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: File Array
Message-Id: <8gv4ao$22f04$17@fu-berlin.de>
hi,
the dEAthMaKEr <hoho110@gmx.de> wrote:
> i need to do a file array coz i want to do a small database which searches
> in all base.* for entries
> @FILES = ('blabla/base.*');
that's exactly what the shell would do for you (if you work
on UNIX, i don't know how it works on win).
just type
yourperl.pl base.* /just/an/example/of/another/directory/*.c
and the shell will give perl all the filenames as
arguments which you will find in the array @ARGV.
tina
--
_____ http://www.tinita.de/ ____| _ enter the
| __| |___ ___ _ _ ___
______tina's moviedatabase______| / _` / _ \/ _ \ '_(_-< of
search & add comments or reviews| \__,_\___/\___/_| /__/ perception
------------------------------
Date: Tue, 30 May 2000 01:43:56 GMT
From: sjs@yorku.ca (Steven Smolinski)
Subject: Re: File Array
Message-Id: <slrn8j6774.ueu.sjs@john.sympatico.ca>
the dEAthMaKEr <hoho110@gmx.de> wrote:
>i need to do a file array coz i want to do a small database which searches
>in all base.* for entries
>
>so i need something like this:
>
>@FILES = ('blabla/base.*');
>
>foreach $file (@FILES) {
> print "File: $file <BR>";
>}
Try the glob operator (perldoc -f glob). Usage is either
glob("base.*"), or <base.*> .
foreach my $file ( <base.*> ) {
print "File: $file <BR>\n";
}
... or ...
foreach my $file ( glob("base.*") ) {
print "File: $file <BR>\n";
}
Steve
P.S.: Why is it that some people feel the need to choose usernames
like "dEAthMaKEr"? Are you trying to scare someone? Make up
for hooliganism unspent in one's real life? Hrmph.
------------------------------
Date: Tue, 30 May 2000 01:10:15 GMT
From: Elaine Ashton <elaine@chaos.wustl.edu>
Subject: Re: HALL OF SHAME :-)
Message-Id: <B5588D36.5056%elaine@chaos.wustl.edu>
in article sj5lr2635pj43@corp.supernews.com, Craig Berry at
cberry@cinenet.net quoth:
> Resisting the bait is an option when you merely disagree with an
> *opinion*. But what about the (more common, here) case of a factually
> incorrect post? If it goes unchallenged, it becomes part of the public
> record, there to mislead countless newbies for all time.
Usenet is no longer a quiet place of valued information. You prospect and
sometimes you get lucky. It's not a classroom and you cannot save lemmings
in search of an ocean.
e.
------------------------------
Date: Mon, 29 May 2000 23:47:35 -0400
From: "Brian Landers" <brian@bluecoat93.org>
Subject: Re: HALL OF SHAME :-)
Message-Id: <_QGY4.5704$O.159090@news1.atl>
You have committed malice intent harassment of me by your posting of my name
and email address in a slandarous fashion. You are committing a criminal act
against my family and I intend to report you to your ISP, your employer,
your pastor, the Usenet cabal, and the drive-thru clerk at your local
Starbucks. Kneel before the power of the almighty troll.
</sarcasm>
"Intergalactic Denizen of Mystery" <Tbone@pimpdaddy.com> wrote in message
news:8guk0v$28fl$1@news.enteract.com...
> I made a quick survey of "troll" posts. The good news: a large number were
> bleak, fast-drying leaves. The bad news: many have been responded to, and
> by people who IMO should know better. I notice regretfully that I am one
> of them. I will change.
>
> Note: "Hall of Shame" is a facetious title; I know it's very hard to
resist
> posting, especially when something dear to your heart is being
misrepresented,
> especially when you can make a witty retort. I sympathize. But please,
just
> say no. This means you:
>
> Andrew N. McGuire <anmcguire@ce.mediaone.net>
> bart.lateur@skynet.be (Bart Lateur)
> Ben Kennedy <bkennedy99@home.com>
> bmetcalf@baynetworks.com (Brandon Metcalf)
> Brian Landers <brian@bluecoat93.org>
> brian@smithrenaud.com (brian d foy)
> Chris Allen <chris@cjx.com>
> Christian Winter <thepoet1@arcormail.de>
> coke@cokesque.com (Coke Harrington)
> Dan Sugalski <dan@tuatha.sidhe.org>
> Dave Cross <dave@dave.org.uk>
> dha@panix.com (David H. Adler)
> Elaine Ashton <elaine@chaos.wustl.edu>
> elephant@squirrelgroup.com (jason)
> Intergalactic Denizen of Mystery <Tbone@pimpdaddy.com>
> Jeff Zucker <jeff@vpservices.com>
> jerome@activeindexing.com (Jerome O'Neil)
> Larry Rosler <lr@hpl.hp.com>
> mbadolato@quepasa.com (Mark Badolato)
> merlyn@stonehenge.com (Randal L. Schwartz)
> Mur <jboesNOjbSPAM@qtm.net.invalid>
> nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar)
> Paul Eckert <peckert@epicrealm.com>
> pdf@morgan.ucs.mun.ca (Paul David Fardy)
> perl_phreak@yahoo.com (Gordon Clemmons)
> samurai@metallicafan.com
> Scratchie <AgitatorsBand@yahoo.com>
> sjs@yorku.ca (Steven Smolinski)
> Sue Spence <sue@pennine.com>
> tadmc@metronet.com (Tad McClellan)
> Thorbj=F8rn Ravn Andersen <thunderbear@bigfoot.com>
> Thoren Johne <thoren@southern-division.com>
> tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
> Tk Soh <r28629@email.sps.mot.com>
> Uri Guttman <uri@sysarch.com>
>
------------------------------
Date: 30 May 2000 04:33:25 GMT
From: Intergalactic Denizen of Mystery <Tbone@pimpdaddy.com>
Subject: Re: HALL OF SHAME :-)
Message-Id: <8gvgal$bfo$1@news.enteract.com>
Not the drive-thru clerk at my local Starbucks!
(I mean, !(the => 'clerk', @my, local(*bucks));)
------------------------------
Date: Tue, 30 May 2000 06:19:01 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: HALL OF SHAME :-)
Message-Id: <sj6nalcu5pj110@corp.supernews.com>
Elaine Ashton (elaine@chaos.wustl.edu) wrote:
: in article sj5lr2635pj43@corp.supernews.com, Craig Berry at
: cberry@cinenet.net quoth:
: > Resisting the bait is an option when you merely disagree with an
: > *opinion*. But what about the (more common, here) case of a factually
: > incorrect post? If it goes unchallenged, it becomes part of the public
: > record, there to mislead countless newbies for all time.
:
: Usenet is no longer a quiet place of valued information. You prospect and
: sometimes you get lucky. It's not a classroom and you cannot save lemmings
: in search of an ocean.
(sigh) Not merely true, but a brilliant sigfile, if I may have your
permission to use it.
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "The road of Excess leads to the Palace
of Wisdom" - William Blake
------------------------------
Date: Tue, 30 May 2000 02:46:27 GMT
From: perl@imchat.com (Mark P.)
Subject: Re: Help - I've been spammed with PERL
Message-Id: <39332969.553433645@news.ionet.net>
On Mon, 29 May 2000 15:43:06 -0400, "new"
<booksellersunion@booksellersunion.org> wrote:
>some crazy people started adding dozens of links at a time to my free for
>all links page.
Get rid of it! No one even looks at FFA scripts anymore. This
is a known problem. You got listed on a program that adds pages to FFA
sites. For some reason people think these actually generate hits to
their site. More than anything it just makes a program look good to
newbies when it says it can add your page to over 600 search engines.
>
>I sent nice messages to the webmasters at the links asking them not to post
>so many links.
>
Won't do any good. Your FFA has been totally compromised. You
might move it into another directory though. That will throw off the
program when it can't find your script.
Anyway this is off topic even if the offending program uses a
perl module.
MP
------------------------------
Date: 29 May 2000 22:51:43 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: how do you create scalar vars from a hash?
Message-Id: <393356ef@news.victoria.tc.ca>
Larry Rosler (lr@hpl.hp.com) wrote:
: You have all the variable names safely in a namespace of their own (the
: keys of the hash). What impels you to pollute the global namespace with
: all those new names? Why not just pass around a reference to the hash,
: and dereference it where needed?
: $parms = \%PARMS;
: ...
: print $parms->{ParamOne};
They don't have to pollute the global name space, they could be set into a
package specifically used for the purpose.
e.g. package MyTempVars;
# variables are set in the MyTempVars package.
A reason to do this is so the variables can be referenced with
minimal extra syntax in places such as a template.
e.g, trivial "template" system.
package MyTempVars;
print "
Hello Mr. $last_name
We last communicated on $previous_date about the (etc.)
";
The above text is very easy to read and modify, which is a prime reason
for using a template.
------------------------------
Date: Tue, 30 May 2000 01:55:53 GMT
From: snakedjip@yahoo.com
Subject: LWP::UserAgent, Cookies, and ASP pages
Message-Id: <8gv733$bmj$1@nnrp1.deja.com>
I am trying to write a script that will obtain my usage statistics for
a particular pay-to-surf company, namely ValuePay. Note that this
question applies to DesktopDollars as well, and I imagine to any ASP-
based company.
ValuePay's login page requires 2 fields : memberid and password, and
it's action tag is set to "login/CheckLogin.asp".
Here's the code that I use to log in, and then call
the "login/showacdetails.asp" page to obtain my stats :
my $ua = new LWP::UserAgent;
my $req = new
HTTP::Request 'GET','http://www.valuepay.com/login/CheckLogin.asp?
memberid=' . $login . '&password=' . $pw;
$req->content_type('application/x-www-form-urlencoded');
my $res = $ua->request($req);
my $cookie_jar = new HTTP::Cookies;
$cookie_jar->extract_cookies($res);
print header;
if ($res->is_success) {
my $req = new HTTP::Request 'GET'
=> 'http://www.valuepay.com/login/showacdetails.asp';
$cookie_jar->add_cookie_header($req);
$res = $ua->request($req);
if ($res->is_success){
$response = $res->as_string;
print $response;
}
} else {
print $res->status_line;
}
If anyone can explain why this code doesn't work, PLEASE answer
publicly... It works fine so far for any other Unix site requiring
cookies for session IDs...
Thanks in advance...
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 30 May 2000 06:29:33 GMT
From: jlamport@calarts.edu
Subject: Re: MySQL problem: $DBI::errstr always null
Message-Id: <8gvn43$ltg$1@nnrp1.deja.com>
In article <8grtp2$4ho$1@nnrp1.deja.com>,
jsunden@my-deja.com wrote:
> Try omitting the $-sign and write DBI->errstr instead. Then it should
> work -- it does for me when I use it like this:
>
> $sth->execute or die "Something went wrong: ", DBI->errstr;
>
> /Joakim Sundén
Nope. Attempting to evaluate DBI->errstr causes my program to die with
"Can't locate auto/DBI/errstr.al in @INC"
Which makes sense to me, since as I understand it, I'm trying to access a
variable, not call a function...
Any other suggestions?
-jason
>
> In article <8go533$mq8$1@nnrp1.deja.com>,
> jlamport@calarts.edu wrote:
> > So I'm using the DBI module to access a MySQL database. Everything
> seems
> > to work fine, EXCEPT, contrary to the documentation, $DBI::err and
> > $DBI::errstr are always undefined, even immediately after executing a
> bad
> > SQL query. This is true whether I access these values as
> $DBI::errstr or
> > as $db_handle->errstr. Setting
> >
> > $db_handle->{PrintError} = 1;
> >
> > causes the errors to get printed to STDERR as expected -- they're just
> > not showing up in $DBI::errstr or $DBI::err.
> >
> > I suppose as a workaround I could wrap my $statement_handle->execute()
> > calls in an eval block, and capture the errors that way, but that
> seems
> > like a rather inelegant solution, when simply checking $DBI::errstr *
> > ought* to do what needs to be done.
> >
> > Any ideas what could be going wrong? Or is my documentation faulty,
> and
> > $DBI::errstr doesn't really do what I expect it to? (I'm going by the
> > O'Reilly book "MySQL & mSQL".)
> >
> > -jason
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 29 May 2000 19:42:04 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Newbie: Pattern Match Question
Message-Id: <39332A7C.6847662D@stomp.stomp.tokyo>
Julian Cook/Sherab Gyatso wrote:
> It's a pattern matching question of keeping
> only certain URLs extracted from a page.
(snipped here and there)
> The code looks like this.....
> 2 $htmlmatch = ($foundurl =~ tr/html//);
> 3 $yearmatch = ($tagline =~ tr/2000//);
> This results in this....(question below each)
> FoundURL equals http://fullcoverage.yahoo.com/fc/World/Fiji/
^^^ ^^ ^ ^ ^
> HTMLmatch equals 8
> http://yahoo.com/dailynews/npr/?http://ramfiles/news.01.ram
^^^ ^ ^ ^ ^^^ ^ ^ ^
> HTMLmatch equals 12
Hi Julian,
Use of transliteration (tr/) doesn't do quite
what you think! Transliteration replaces instances
of "single" letters or other characters on an
individual one-at-a-time basis. For your "html"
transliteration looks for the letter h, the
letter t, the letter m and the letter l, then
replaces every instance of those, individually.
Count the ^ I have added below your lines. You
will understand what is happening. Don't panic.
I have shortened your second line (yahoo) to
keep it from word wrapping for clarity.
Down below you will find a test script and
some printed results. This method uses
simple match operators to find your URLs.
There are other ways to do this. However,
this will give you a basic introduction
on how you might do this. I created a bunch
of fake URLs with an intent to fool this
script. You can see it works pretty good.
No one script is perfect but this style
should give you decent reliability.
This is the line of interest to you:
if (($line =~ /2000/) & ($line =~ /\.html/))
Basic bugs I can think of... if your
string has 012320000789, a match would
take place. See the 2000 in there? Use
a period in front of html (.html) to
help increase your odds for a good
match. Shouldn't be a problem there.
Backslashing a metacharacter, such as
a period (\.), is not always required
but is a good safe habit to develop. Sure
doesn't hurt anything for this context.
"If you didn't sing it in Kindergarten,
backslash it."
Here is a site with easy reading info
just right for your needs:
http://wdvl.com/Authoring/Languages/Perl/PerlfortheWeb/pattern_matching.html
Careful, that URL might word wrap on you. It
should be one long line with no spaces. This
is a great site, well written, easy to read,
perfect for beginners and experts alike!
Please visit there and look over all pages
available. Lots of basic information on
quite a variety of topics.
After looking over my code and after looking
at this site up there, I believe you will
have all the information you need to make
you a well armed and dangerous programmer!
Teasing. Have fun with this. Fun is most
important, above all!
Godzilla!
PRINTED RESULTS
_______________
Use Of Double Match:
Match found: any.net/matchthis/2000/catchthis.html
Match found: here.org/matchthis/catchthis/2000.html
TEST SCRIPT
___________
#!/usr/local/bin/perl
print "Content-Type: text/plain\n\n";
$input = "
abc.com/whomever/~homepage
jack-jill.net/hill/2000/fetch/bucket.mid
humpydumpy.org/fragile/egg/cracked.html
any.net/matchthis/2000/catchthis.html
flubber.mil/2000/professor/html.htm
here.org/matchthis/catchthis/2000.html
peter.rabbit.org/brier/bush/ohno.ram";
@Array = split (/\n/, $input);
## Double Match Method
print "Use Of Double Match:\n\n";
foreach $line (@Array)
{
if (($line =~ /2000/) & ($line =~ /\.html/))
{
print " Match found: $line\n";
}
}
exit;
------------------------------
Date: Mon, 29 May 2000 21:21:10 -0500
From: "Juan M. Hernandez" <j-hernandez2@nwu.edu>
Subject: Perl forking question (multiple times)
Message-Id: <39332596.C60A305D@nwu.edu>
Hello,
Right now my program is forking once, so that it runs 2 processes at the
same time. I was wondering if I could then have those two processes fork
themselves so that then there are 4 processes running (2^2) ? Is this
possible? If so, is it wise, would it be too much server load for one
task?
Also, I am calling $SIG{CHLD} = 'IGNORE';
at the top of my scipt as well as right before I fork. It's all
inherited right, so I don't have to call it again when I fork a second
time (within the first fork), right?
Ok, thank you for your help!
ps. I am using perl, version 5.005_03 built for i386-linux.
Juan
--
Juan M. Hernandez
Northwestern University, Evanston, IL. USA
j-hernandez2@nwu.edu
------------------------------
Date: Mon, 29 May 2000 21:14:29 -0700
From: stevel@coastside.net (Steve Leibel)
Subject: Re: Perl forking question (multiple times)
Message-Id: <stevel-2905002114580001@192.168.100.2>
In article <39332596.C60A305D@nwu.edu>, j-hernandez2@nwu.edu wrote:
> Hello,
>
> Right now my program is forking once, so that it runs 2 processes at the
> same time. I was wondering if I could then have those two processes fork
> themselves so that then there are 4 processes running (2^2) ? Is this
> possible? If so, is it wise, would it be too much server load for one
> task?
>
Keep on doing it till fork() fails. From then on do it less. For a
typical FreeBSD or Linux installation you should be able to fork lots of
times.
> Also, I am calling $SIG{CHLD} = 'IGNORE';
> at the top of my scipt as well as right before I fork. It's all
> inherited right, so I don't have to call it again when I fork a second
> time (within the first fork), right?
>
Right, although processes that fork should have a CHLD handler so they can
call wait() to clean up zombies.
Steve L
------------------------------
Date: Tue, 30 May 2000 00:28:07 -0500
From: Lab User <someone@cs.nwu.edu>
Subject: Re: Perl forking question (multiple times)
Message-Id: <39335167.74858118@cs.nwu.edu>
I am calling wait at the top order, so will it then wait for all the
processes (on the way down), or should each forked process call wait and
then return, because children are not inherited upward (does that make
sense?) I think I got it, I'll just play it safe, don't want too many
dead kiddies piling up.
Juan
ps thanks
> > Also, I am calling $SIG{CHLD} = 'IGNORE';
> > at the top of my scipt as well as right before I fork. It's all
> > inherited right, so I don't have to call it again when I fork a second
> > time (within the first fork), right?
> >
>
> Right, although processes that fork should have a CHLD handler so they can
> call wait() to clean up zombies.
>
> Steve L
------------------------------
Date: Tue, 30 May 2000 01:08:40 GMT
From: Elaine Ashton <elaine@chaos.wustl.edu>
Subject: Re: Perl related humor?
Message-Id: <B5588CD9.5055%elaine@chaos.wustl.edu>
in article 8guio2$tq9$1@towncrier.cc.monash.edu.au, Damian Conway at
damian@cs.monash.edu.au quoth:
> s/Carp/Coy/
Oh dear...guess I've been Carp-ing a bit too much lately. Thanks for the
correction. :)
e.
------------------------------
Date: Tue, 30 May 2000 05:30:08 GMT
From: "Dougas Garstang" <garstangd@news.com.au>
Subject: Perl Tabular -> XML
Message-Id: <AlIY4.1394$Il2.563560@news0.optus.net.au>
Has anyone seen on CPAN a perl module which can:
- Take tabular data (such as may be retrieved from a database) in plain text
output, and based upon a DTD create an XML file?
There seem to be quite a few event driven XML parsers that go the other way.
I haven't seen anything which actually creates XML from tabular data
however.
Regards
Douglas Garstang
garstangd@news.com.au
------------------------------
Date: Tue, 30 May 2000 01:17:25 -0500
From: "Randy Kobes" <randy@theory.uwinnipeg.ca>
Subject: Re: Perl Tabular -> XML
Message-Id: <8gvmh9$ddu$1@canopus.cc.umanitoba.ca>
Dougas Garstang <garstangd@news.com.au> wrote
in message news:AlIY4.1394$Il2.563560@news0.optus.net.au...
> Has anyone seen on CPAN a perl module which can:
>
> - Take tabular data (such as may be retrieved from a database) in plain
text
> output, and based upon a DTD create an XML file?
>
> There seem to be quite a few event driven XML parsers that go the other
way.
> I haven't seen anything which actually creates XML from tabular data
> however.
Hi,
Perhaps the DBIx-XML_RDB package may be useful; documentation
may be found, for example, at
http://theoryx5.uwinnipeg.ca/CPAN/data/DBIx-XML_RDB/XML_RDB.html
best regards,
randy kobes
------------------------------
Date: Tue, 30 May 2000 06:36:13 GMT
From: "Dougas Garstang" <garstangd@news.com.au>
Subject: Re: Perl Tabular -> XML
Message-Id: <xjJY4.2549$Il2.593715@news0.optus.net.au>
Randy,
Thanks for that. I had tried that one a few days ago. It generates very
simple XML in the form:
<ROW>
<FIELD1>Data1</FIELD1>
</ROW>
The docs that come with it mention using XML::Parser to further enhance the
output.I can't quite seem to fathom though how XML::Parser will allow me to
make the XML adhere to a certain DTD.
Regards
Douglas.
Randy Kobes wrote in message <8gvmh9$ddu$1@canopus.cc.umanitoba.ca>...
>
>Dougas Garstang <garstangd@news.com.au> wrote
> in message news:AlIY4.1394$Il2.563560@news0.optus.net.au...
>> Has anyone seen on CPAN a perl module which can:
>>
>> - Take tabular data (such as may be retrieved from a database) in plain
>text
>> output, and based upon a DTD create an XML file?
>>
>> There seem to be quite a few event driven XML parsers that go the other
>way.
>> I haven't seen anything which actually creates XML from tabular data
>> however.
>
>Hi,
> Perhaps the DBIx-XML_RDB package may be useful; documentation
>may be found, for example, at
>http://theoryx5.uwinnipeg.ca/CPAN/data/DBIx-XML_RDB/XML_RDB.html
>
>best regards,
>randy kobes
>
>
>
------------------------------
Date: Tue, 30 May 2000 07:50:53 +0200
From: "Mariska" <mariska@excite.nl>
Subject: Re: scoping trouble with nested structures
Message-Id: <39335775$0$14411@reader3>
Yes i know that.
But i have a foo in a subroutine which i will use in a nested block in the
same sub.
And in that case i get a new foo. I know how to pass vars between subs.
i do it with $new=&sub($foo). But how do i dop this with a if then block?
$new=if ($foo ne "") {
do something
} will not get the results from the code in this block into $new.
Mariska
Bob Walton <bwalton@rochester.rr.com> schreef in berichtnieuws
3932F120.EE89B605@rochester.rr.com...
> The $foo defined by the first "my" will remain in scope until the
> closing bracket of sub routine. The $foo defined by the second "my"
> will remain in scope until the closing bracket of the if. The $foo in
> package main will be completely unaffected by what goes on in sub
> routine (because the first reference to $foo in sub routine is a "my"
> definition), and the $foo in tha base block of sub routine is unaffected
> by the third $foo defined in the if block. Does that differ from the
> behavior you were expecting? If so, read perlsub.
> --
> Bob Walton
------------------------------
Date: Tue, 30 May 2000 01:08:50 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: seeking method to encode email addresses in web page forms
Message-Id: <brian-ya02408000R3005000108500001@news.panix.com>
In article <8gup22$2d98$1@news.enteract.com>, Tbone@pimpdaddy.com posted:
> brian@smithrenaud.com writes:
> >> A review of internet statistics and Bell curved
> >> statistical averages for stereotypical average
> >> internet sites, show my stats to be quite right.
> >statistics mean nothing. it's the behaviour of the individual
> >site at peak capacity that counts, not the average. just ask
> >Toys-R-Us if their average traffic meant anything to the Federal
> >Trade Commission last Christmas.
> >however, feel free to cite the relevant resources. i contend that
> >you are lying, especially since you can't make proper sentences
> >with the buzzwords.
> You have posted an unnecessary follow-up to a known troll.
irony. i suppose you think challenges unfounded assertions is
unnecessary. learn to live with it.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: 30 May 2000 05:26:32 GMT
From: Intergalactic Denizen of Mystery <Tbone@pimpdaddy.com>
Subject: Re: seeking method to encode email addresses in web page forms
Message-Id: <8gvje8$hne$1@news.enteract.com>
brian@smithrenaud.com writes:
>irony. i suppose you think challenges unfounded assertions is
>unnecessary.
Indeed. Especially vague assertions unrelated to Perl.
------------------------------
Date: Tue, 30 May 2000 09:38:04 +0800
From: "´ô´ô¹Ï" <huxh@990.net>
Subject: Re: thank yon Philip,but....
Message-Id: <8gv6i5$gdh$1@news.cz.js.cn>
thanks a lot
I solved the question yesterday, I add ^D at teh end of the last
line.
Jonathan Stowe <gellyfish@gellyfish.com> wrote in message
news:8gtvm5$r5r$1@orpheus.gellyfish.com...
> On Mon, 29 May 2000 22:46:05 +0800 "´ô´ô¹Ï" wrote:
> > thank you philip:
> > that format is the last thing in the file,I run the file in Redhat
> > 6.1+perl5.0,use perl scriptname,I put a blank lint after the final
'.',but
> > the error massage still exist.please give me more advive ,thanks a lot .
>
> You appear to have started a new thread for something is infact a
> followup to a previous post.
>
> Are you sure that the '.' that terminates the format is on the extreme
> left hand side ?
>
> /J\
> --
> There's a New Mexico?
> --
> fortune oscar homer
------------------------------
Date: Tue, 30 May 2000 05:45:08 GMT
From: nospam.newton@gmx.li (Philip 'Yes, that's my address' Newton)
Subject: Re: Translate foreign characters to English
Message-Id: <39334b90.131630909@news.nikoma.de>
On Mon, 29 May 2000 09:12:36 GMT, lou@visca.com (Lou Hevly) wrote:
> $ascii =~ s/æ|Æ/ae/g;
> $ascii =~ s/Á|Â|À|Å|Ã|Ä|á|â|à|å|ã|ä/a/g;
> $ascii =~ s/Ç|ç/c/g;
> $ascii =~ s/Ð|ð/d/g;
> $ascii =~ s/É|Ê|È|Ë|é|ê|è|ë/e/g;
> $ascii =~ s/Í|Î|Ì|Ï|í|î|ì|ï/i/g;
[etc.]
Why don't you use character classes?
$ascii =~ s/[ÁÂÀ...ä]/a/g;
and so on.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
If you're not part of the solution, you're part of the precipitate.
------------------------------
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 3202
**************************************