[10337] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3930 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 8 17:07:23 1998

Date: Thu, 8 Oct 98 14:00:22 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 8 Oct 1998     Volume: 8 Number: 3930

Today's topics:
    Re: *quick q:* how to escape a query string? (Larry Rosler)
    Re: *quick q:* how to escape a query string? (Sean McAfee)
    Re: Are there any "perl.newbie" group or forum? <jdporter@min.net>
    Re: Are there any "perl.newbie" group or forum? <jdporter@min.net>
    Re: Are there any "perl.newbie" group or forum? (Bart Lateur)
    Re: Are there any "perl.newbie" group or forum? <eashton@bbnplanet.com>
    Re: Are there any "perl.newbie" group or forum? <eashton@bbnplanet.com>
    Re: Are there any "perl.newbie" group or forum? <merlyn@stonehenge.com>
    Re: Are there any "perl.newbie" group or forum? (John Moreno)
    Re: Back button in Perl? <rootbeer@teleport.com>
    Re: cgi REMOTE_USER variable question (Abigail)
    Re: Difficulty with HTML & Perl & CGI droby@copyright.com
    Re: HELP <jdporter@min.net>
    Re: high level (UNIX) system summary <eashton@bbnplanet.com>
    Re: How to continue execution after alarm() timeout? <alexis@danae.demon.co.uk>
    Re: How to disable signals to fork processes (Matt Knecht)
        I/O problem <gil_brown@hp.com>
    Re: Looking for a shopping cart <rootbeer@teleport.com>
        Navigating in a tab seperatet text file <eagle@kurir.net>
    Re: Navigating in a tab seperatet text file <rootbeer@teleport.com>
        OEM850 to ISO/ANSI Data Conversion <ebeyer@jetform.com>
    Re: Perl Robots srenner@lycosmail.com
        print bug/feature? ((Gordon Wilson))
    Re: print bug/feature? (Larry Rosler)
    Re: print bug/feature? ((Gordon Wilson))
    Re: Problems Using a Compare Subroutine with Sort <jdporter@min.net>
    Re: Problems with substr (re- posted) <jja@inforonics.com>
    Re: Problems with substr (re- posted) <uri@camel.fastserv.com>
    Re: Problems with substr (re-posted) <jja@inforonics.com>
    Re: Problems with substr <evonzee@tritechnet.com>
    Re: references becoming null pointers? <rootbeer@teleport.com>
        Sys::Syslog Problems <Ian_Lowe@fanniemae.com>
        using File::lockf <ff@otis.arraycomm.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Thu, 8 Oct 1998 13:03:56 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: *quick q:* how to escape a query string?
Message-Id: <MPG.1086ba86544514799897fb@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <yiLS1.575$fS.1380704@news.itd.umich.edu> on Wed, 07 Oct 1998 
14:56:30 GMT, Sean McAfee <mcafee@waits.facilities.med.umich.edu> says...
> In article <361B7A92.7AA296E4@ncsa.uiuc.edu>,
> Marty Blase  <mblase@yahoo.com> wrote:
> >Stupid question time, but I'm stumped: what's the easiest way to escape the
> >characters of a string in perl so that they can be placed in a URL query
> >string?
> 
> Use the URI::Escape module, part of the libwww distribution, found at a
> fine CPAN site near you.
> 
> Or, do it yourself:
> 
> $data =~ s/ ([^\x20-\x7e]) / sprintf "%%%02X", $1 /gsx;
> 
> (URI::Escape should be faster than this.)

I don't see why it would be faster, but at least it would probably be 
correct.  You obviously didn't test this statement before posting it.  
Here are some of the problems (from right to left):

'/gsx' is wrong;  it should be 'gex'.  (Probably a finger slip, but you
should cut and paste working code, not type it in, in any case.)

'$1' is wrong.  It should be 'ord $1'.  (The argument for '%X' conversion 
must be a number, not a character.  Testing would have revealed this bug, 
and testing with '-w' would have identified it.)

The space character "\x20" is not converted by this regex, but should be 
(either to '+' or to '%20').  (This is an HTTP/CGI bug, not a Perl bug.)

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Thu, 08 Oct 1998 20:32:08 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: *quick q:* how to escape a query string?
Message-Id: <cj9T1.806$fS.2065833@news.itd.umich.edu>

In article <MPG.1086ba86544514799897fb@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>[Posted to comp.lang.perl.misc and a copy mailed.]
>In article <yiLS1.575$fS.1380704@news.itd.umich.edu> on Wed, 07 Oct 1998 
>14:56:30 GMT, Sean McAfee <mcafee@waits.facilities.med.umich.edu> says...
>> In article <361B7A92.7AA296E4@ncsa.uiuc.edu>,
>> Marty Blase  <mblase@yahoo.com> wrote:
>> >Stupid question time, but I'm stumped: what's the easiest way to escape the
>> >characters of a string in perl so that they can be placed in a URL query
>> >string?

>> Use the URI::Escape module, part of the libwww distribution, found at a
>> fine CPAN site near you.
>> Or, do it yourself:
>> $data =~ s/ ([^\x20-\x7e]) / sprintf "%%%02X", $1 /gsx;
>> (URI::Escape should be faster than this.)

>I don't see why it would be faster,

(It's because the module prebuilds a hash matching characters to escape
sequences.)

>but at least it would probably be 
>correct.  You obviously didn't test this statement before posting it.  

Argh...  Usually I follow this rule scrupulously, but this time I screwed
up.

>'/gsx' is wrong;  it should be 'gex'.

Almost; what I meant to type was 'gesx' (although now I see that the 's' is
unnecessary--it's a habit that kicks in when matching newlines).

>'$1' is wrong.  It should be 'ord $1'.

>The space character "\x20" is not converted by this regex, but should be 
>(either to '+' or to '%20').  (This is an HTTP/CGI bug, not a Perl bug.)

I downloaded RFC 1738 while composing my article (ironic that I should go
to such trouble and then get the details wrong, eh?), and I could find no
mention of '+' being an acceptable escape for ' '.  Where is this
convention documented?  I was about to add a line "$data =~ tr/ /+/;", but
after checking the RFC to make sure it was legal, and finding that it
apparently isn't, I desisted, and neglected to change \x20 to \x21 in the
original substitution.

As penance for my transgression, I'll share a script I use to check the
source for Perl modules (I used it just now to check URI::Escape).  I call
it "perlmod".

----------------------------------------------------------------------
$DEFAULT_EDITOR = "vim";  # or whatever

$module = shift or die "No module specified\n";
$module =~ s#::#/#g;
$EDITOR = $ENV{EDITOR} || $DEFAULT_EDITOR;

foreach (@INC) {
	if (-r "$_/$module.pm") {
		exec "$EDITOR $_/$module.pm";
	}
}

die "Not found\n";
----------------------------------------------------------------------

-- 
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
            | K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
            | tv+ b++ DI++ D+ G e++>++++ h- r y+>++**          | umich.edu


------------------------------

Date: Thu, 08 Oct 1998 14:05:47 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Are there any "perl.newbie" group or forum?
Message-Id: <361CFEFB.E27E2230@min.net>

Patrick Timmins wrote:
> 
> (Almost) no question will be totally ignored. If one of the true
> experts does not respond, the Siren call of the naked question in
> tens of thousands of news readers around the world will be too
> seductive for one or more "up and coming" Perl types to resist.

This, sadly, is not true -- at least not for all types of questions.

I track many questions that go unanswered.  Not newbie questions,
interesting ones; such as --

"Perl on the AS/400" 
	<35F8023A.1F168289@copart.com>
	This question has been asked many times in the last year or
	so; but apparently no AS/400 Perl experts inhabit clpm.
"Class as Datatypes?" 
	<3606A5A0.ACB9AEC2@us.oracle.com>
"Perl, SWIG, CORBA?" 
	<36091B75.13E6F080@uni-paderborn.de>
"OO: How to make "dual" natured package" 
	<ptru31wp9gh.fsf@olkikukka.uta.fi>
"anyone using gtk/perl???"
	<36186329.39B0306F@earthlink.net>

And many others.
I keep waiting for some knowledgeable person to post an answer;
but some questions just seem to get lost in the noise.

-- 
John "Many Jars" Porter
baby mother hospital scissors creature judgment butcher engineer


------------------------------

Date: Thu, 08 Oct 1998 14:17:23 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Are there any "perl.newbie" group or forum?
Message-Id: <361D01B3.CE0765B4@min.net>

madame philosophe wrote:
> 
> John Porter wrote:
> 
> > madame philosophe wrote:
> > > If the people at this group are tired of hearing the same questions.
> > > why doesn't someone start a newbie perl newsgroup?
> >
> > This question has already been discussed, and answered.
> > Many times.
> > But you wouldn't know that, would you?
> 
> Ha Ha.

What other conclusion could I draw?  You have obviously not
read any of the many kilobytes this newsgroup has generated
in the past on this subject.


> > "People are going to come and deposit bodily excretions in your
> > sandbox.  Get used to it."  No, I'm sorry.  There are trends which
> > must be resisted, however futile it turns out to be.
> 
> Oh, come ON!!!  Are you telling me nebie questions are likened to excrement?
> Shame on you.

Shame on you for thinking that it couldn't be.
This is a cooperative community; we have standards of conduct.
Asking FAQs is like dumping garbage in our playground.

> Paris is a wonderful sandbox and the poo is there to stay.

Not sure what else I can say except clpm isn't Paris.
Maybe clpm is New York City.
They have dog poo laws in New York City.


> I think if Perl could be Paris and I were an expert rather than a just
> a pert, I too would be used to poo.

Hopefully some day soon you *will* be an expert.  If so,
don't be surprised to find that your tolerance of litter 
has waned a little.

-- 
John "Many Jars" Porter
baby mother hospital scissors creature judgment butcher engineer


------------------------------

Date: Thu, 08 Oct 1998 20:05:49 GMT
From: bart.mediamind@ping.be (Bart Lateur)
Subject: Re: Are there any "perl.newbie" group or forum?
Message-Id: <361f1a5c.2724719@news.ping.be>

Randal Schwartz wrote:

>Oh, and Uri, you have "stealth cc's".  I've killfiled people for that.
>Please don't do that.  (Your mail copy to me wasn't marked as "also
>posted", so I replied to you privately before seeing it in the
>newsgroup.  Evil.)

I think that in that case, the e-mail has a "Newsgroups" header. Well,
in a post/e-mail-that-bounced, by me, I could see it in the bounced
message. I can see it in an cc-ed post/e-mail I got from you, too. Dare
I say that it is the general case?

"If in doubt, check the headers!"

	Bart.


------------------------------

Date: Thu, 08 Oct 1998 19:40:25 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: Are there any "perl.newbie" group or forum?
Message-Id: <361D12AF.34ECD82F@bbnplanet.com>

John Porter wrote:

> What other conclusion could I draw?  You have obviously not
> read any of the many kilobytes this newsgroup has generated
> in the past on this subject.

The only conclusion I can draw is that this person simply must be a
troll.

> Not sure what else I can say except clpm isn't Paris.

The law of the commons could apply here. Scoopers are handy things.

e.


------------------------------

Date: Thu, 08 Oct 1998 19:42:38 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: Are there any "perl.newbie" group or forum?
Message-Id: <361D1333.43C947E6@bbnplanet.com>

Bart Lateur wrote:

> "If in doubt, check the headers!"

It's a common courtesy. Who has time to scrutinise the headers for every
bit of mail. Geesh.

e.


------------------------------

Date: Thu, 08 Oct 1998 20:19:44 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: Are there any "perl.newbie" group or forum?
Message-Id: <8c67duu7qa.fsf@gadget.cscaper.com>

>>>>> "Bart" == Bart Lateur <bart.mediamind@ping.be> writes:

Bart> I think that in that case, the e-mail has a "Newsgroups" header. Well,
Bart> in a post/e-mail-that-bounced, by me, I could see it in the bounced
Bart> message. I can see it in an cc-ed post/e-mail I got from you, too. Dare
Bart> I say that it is the general case?

Bart> "If in doubt, check the headers!"

There's no such thing as "Newsgroups" in RFC822... it's quite possible
that I could send mail to you that has "newsgroups:" but does *not* get
posted.  Therefore, there's still no clue that "newsgroups" is exactly
equal to "this got posted in news".

If in doubt, get a clue. :)

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


------------------------------

Date: Thu, 8 Oct 1998 16:57:15 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: Are there any "perl.newbie" group or forum?
Message-Id: <1dglaui.1fu5lju1s31r6kN@roxboro0-037.dyn.interpath.net>

Bart Lateur <bart.mediamind@ping.be> wrote:

> Randal Schwartz wrote:
> 
> >Oh, and Uri, you have "stealth cc's".  I've killfiled people for that.
> >Please don't do that.  (Your mail copy to me wasn't marked as "also
> >posted", so I replied to you privately before seeing it in the
> >newsgroup.  Evil.)

That's weird - I thought Gnus was configured to do the right thing (i.e.
add the message).

> I think that in that case, the e-mail has a "Newsgroups" header. Well,
> in a post/e-mail-that-bounced, by me, I could see it in the bounced
> message. I can see it in an cc-ed post/e-mail I got from you, too. Dare
> I say that it is the general case?
> 
> "If in doubt, check the headers!"

Headers are irrelevant - some newsreaders include "Newsgroups" when they
mean "this is a reply to a message that was posted", others include it
when they mean "this message was also posted".  Unless you happen to
know which is which (and that someone hasn't changed the behavior of
their copy), the "Newsgroups" header by itself is of null value (if it's
included along side a Posted-And-Mailed header it has meaning, but then
again in that case you don't have to rely upon the header to tell you
whether it was posted or not do you?).

-- 
John Moreno


------------------------------

Date: Thu, 08 Oct 1998 18:14:32 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Back button in Perl?
Message-Id: <Pine.GSO.4.02A.9810081106220.4710-100000@user2.teleport.com>

On 8 Oct 1998, Marc Bissonnette wrote:

> What I was trying to say was that if Perl was spitting out the pages,
> it is possible to control the "back" feature via a link in the page.

1. No, it is not. You can pretend to do it, but you can't make it work
properly.

2. This has already been discussed to death. Please check the archives
to avoid making the mistakes of the past.

3. This has nothing to do with Perl; it's really a browser issue. If you
do have something new to say, please take it to an appropriate newsgroup.

Thanks!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: 8 Oct 1998 18:44:48 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: cgi REMOTE_USER variable question
Message-Id: <6vj170$569$1@client3.news.psi.net>

sherman@cdg.stsv.seagate.com (sherman@cdg.stsv.seagate.com) wrote on
MDCCCLXIV September MCMXCIII in <URL:news:6vin6c$jo$1@nnrp1.dejanews.com>:
++ 
++ 
++ i've tried $ENV{$REMOTE_USER}, $ENV{REMOTE_USER}, $<, and even $>, and all
++ the permutations of escaping characters.  at best, i get "webuser", the
++ special user that apache httpd runs as, but not the name of the real user.

To get environment variables, use %ENV. If you need an environment
variable that isn't there, don't blame Perl, blame the context, as the
context is setting the environment - not Perl.

As for REMOTE_USER, half a decade ago your fellow CGI programmers abused
this variable. No modern browser [1] seems to send this information anymore.


Followups set.


[1] Not sending this information predates Netscape.



Abigail
-- 
perl -we '$_ = q ?4a75737420616e6f74686572205065726c204861636b65720as?;??;
          for (??;(??)x??;??)
              {??;s;(..)s?;qq ?print chr 0x$1 and \161 ss?;excess;??}'


------------------------------

Date: Thu, 08 Oct 1998 18:24:03 GMT
From: droby@copyright.com
Subject: Re: Difficulty with HTML & Perl & CGI
Message-Id: <6vj003$dh3$1@nnrp1.dejanews.com>

In article <361C3750.C238AA7F@ns.net>,
  "John A. Miller" <patheon@ns.net> wrote:
> Greetings:
>
> I have written several HTML pages using Perl. But I have had to spell
> everytkhing out.  I would like to be able to use some of the short cuts
> like query->header() but I can't figure out how to do it correctly.  (I
> am using Omni HTTPD v2.0 as my web server on an NT machine)
>
> I have been having a lot of trouble trying to get the following to work:
>
> ---------------------------------- Begin
> Script----------------------------------
> #!/usr/bin/perl
>
> use CGI qw(:standard);
> use CGI::Carp qw(fatalsToBrowser);
> $query = new CGI;
> print $query->header();
> print $query->start_html(-TITLE=>'No Title',-BGCOLOR=>'white');
> print "<H4><CENTER>Testing 4...</CENTER></H4>";
> print $query->end_html;
> ---------------------------------- End
> Script----------------------------------
>
> It gives me the infamous "Document Contains No Data" error. I can
> however write the same thing by spelling everything out and the page
> works.

There are several things you can do to try to debug this.

First off, try to run the program from the command line, and see if it
produces the expected html output or a useful error message.

Examine your server's logs if you have access to them.  Frequently the real
error can be seen there.

Since you do have the ability to do some perl cgi scripts, and since that is
working code (works on my machine),  I suspect one of these methods will
reveal a problem with locating the CGI.pm module.  If you don't in fact have
CGI.pm, get it from CPAN. If you do, it may be in an odd place, and there is
help in perlfaq8 for dealing with that.

There are also some very good references for learning how to do this stuff
available on the web.

>From perlfaq3:


Where can I learn about CGI or Web programming in Perl?

For modules, get the CGI or LWP modules from CPAN. For textbooks, see the two
especially dedicated to web stuff in the question on books. For problems and
questions related to the web, like ``Why do I get 500 Errors'' or ``Why
doesn't it run from the browser right when it runs fine on the command
line'', see these sources:

    The Idiot's Guide to Solving Perl/CGI Problems, by Tom Christiansen
        http://www.perl.com/perl/faq/idiots-guide.html

    Frequently Asked Questions about CGI Programming, by Nick Kew
        ftp://rtfm.mit.edu/pub/usenet/news.answers/www/cgi-faq
        http://www3.pair.com/webthing/docs/cgi/faqs/cgifaq.shtml

    Perl/CGI programming FAQ, by Shishir Gundavaram and Tom Christiansen
        http://www.perl.com/perl/faq/perl-cgi-faq.html

    The WWW Security FAQ, by Lincoln Stein
        http://www-genome.wi.mit.edu/WWW/faqs/www-security-faq.html

    World Wide Web FAQ, by Thomas Boutell
        http://www.boutell.com/faq/

Hope this helps.

--
Don Roby

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Thu, 08 Oct 1998 16:55:09 -0400
From: John Porter <jdporter@min.net>
Subject: Re: HELP
Message-Id: <361D26AD.7CCF7983@min.net>

Jane Vermont wrote:
> 
> How to use perl to remove <!-- html  comment -->  and  <tags>

You probably want to use the HTML::Parser or HTML::Filter module.

-- 
John "Many Jars" Porter
baby mother hospital scissors creature judgment butcher engineer


------------------------------

Date: Thu, 08 Oct 1998 19:50:48 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: high level (UNIX) system summary
Message-Id: <361D151D.CC5F7315@bbnplanet.com>

Russ Allbery wrote:

> > Has anyone written a Perl script to perform a high level system summary:
> > hardware (vendor, model, amount of memory, disks, CD-ROMs, tapes, etc.),
> > software (OS version, patches installed, common utilities installed,
> > NFS?, NIS?, DNS?, etc.), general configuration (survey of syslog,
> > password/group files, local printers configured, backups, etc.).
> 
> <URL:http://www.magnicomp.com/sysinfo/sysinfo.shtml>


Sysinfo has never thrilled me and I have often resorted to Perl to get
the info then format it for me. I've often thought of doing a
multi-platform version of my system 'squirrel', but haven't gotten
around to it. So, yes, to the poster, I have done this with great
satisfaction with Perl.

e.


------------------------------

Date: 08 Oct 1998 10:43:59 GMT
From: Alexis Huxley <alexis@danae.demon.co.uk>
Subject: Re: How to continue execution after alarm() timeout?
Message-Id: <f0i8hb.tk@danae.demon.co.uk>

In <6vgmms$sde$1@nnrp1.dejanews.com> mtokugaw@lsil.com writes:

> Hi.  Could someone tell me how to continue with the perl
> program execution after alarm() has timed out, i.e.

This is what you want:

---------- cut here ---------

#!/usr/bin/perl

#  Set these to whatever - I used cat because it's easy to control the runtime
$my_program = "cat";
$timeout = 20;

#  Catch zombies (a la documentation)
$SIG{CHLD} = sub { wait; $child_exited = 1 };
$SIG{ALRM} = sub { $timed_out = 1 };

#  fork a new process
defined($pid = fork) || die "fork failed";
#  Child goes off to run program
($pid == 0) && exec $my_program;

#  Only the parent gets to here - set alarm and wait
alarm($timeout);
while (!$timed_out && !$child_exited) {
    #  There's nothing for the parent to do but wait for the child to
    #  exit or the alarm to go off; but a loop with nothing in it
    #  would whizz round using CPU. sleep() is interrupted by signals so
    #  it's a nice thing to do while waiting. Period is irrelevent.
    sleep(3600);
}

print "this line gets executed when $my_program exits or after $timeout secs -
whichever is sooner\n";

#  If the child program hasn't finished yet do you want to kill it?
(!$child_exited) && kill 2, $pid;

--------- end ---------
-- 
Alexis Huxley
alexis@danae.demon.co.uk
email key: 549812


------------------------------

Date: Thu, 08 Oct 1998 18:09:33 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: How to disable signals to fork processes
Message-Id: <xd7T1.347$wV1.1886039@news2.voicenet.com>

Chris Mihaly <cmihaly@fa.disney.com> wrote:
>I have lots of scripts that fork and pipe information between these
>processes.  Most of them are one way fork/pipe invoked by open -| calls,
>but some are two way pipes opened by IPC::open2 or IPC::open3.  My
>problem is that ^C or ^Z break these pipes.  How can I fork processes so
>that only my main app gets the signals (I can catch and deal with them
>there) and not my forked processes?  I tried to find it in the FAQ,
>maybe its there but I couldn't find it, I  did see the stuff on the
>signals (although some of the links couldn't be found from my machine
>for some reason).

There are many different ways.  Use IPC::open3 to talk to all your
processes.  Have children catch whatever signals you need, then write
back to the parent on STDERR that the child received signal X.

If you don't care what child is getting the signal, just have the
children catch the signal, and signal the parent.

If you don't like either of these, then you can catch the signal in the
child, and have it send a UDP packet off to the parent with all the
relevant info (Of course, the parent needs to check for UDP packets
now).

I'm sure there are many other ways to do this as well.

-- 
Matt Knecht - <hex@voicenet.com>


------------------------------

Date: Thu, 8 Oct 1998 15:57:50 -0400
From: "Gil Brown" <gil_brown@hp.com>
Subject: I/O problem
Message-Id: <6vj5g8$1u8$1@ocean.cup.hp.com>

Hi;

I am looking for a way to do direct I/O (not buffered) I know there is a way
to specify that but I can't remember it.

Thanks a lot




------------------------------

Date: Thu, 08 Oct 1998 18:00:55 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Looking for a shopping cart
Message-Id: <Pine.GSO.4.02A.9810081100300.4710-100000@user2.teleport.com>

On Wed, 7 Oct 1998, Kerry J. Cox wrote:

> Subject: Looking for a shopping cart

If you're wishing merely to _find_ (as opposed to write) programs,
this newsgroup may not be the best resource for you. There are many
freeware and shareware archives which you can find by searching Yahoo
or a similar service. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: Thu, 08 Oct 1998 21:44:33 +0200
From: Eagle <eagle@kurir.net>
Subject: Navigating in a tab seperatet text file
Message-Id: <361D1621.7C7E1A6@kurir.net>

After opening a tabseperated text file I'm trying to make a while loop
in which i would like to navigate up and down between different lines.
I've tried to change the $. operator but this docent actually seem to
affect what line the program is reading. Is there a simple way to
accomplish this without opening the same file several times?

Any suggestions?

--------------------------------
Christian Beer
cb@austria-travelservice.com





------------------------------

Date: Thu, 08 Oct 1998 20:36:44 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Navigating in a tab seperatet text file
Message-Id: <Pine.GSO.4.02A.9810081335580.4710-100000@user2.teleport.com>

On Thu, 8 Oct 1998, Eagle wrote:

> After opening a tabseperated text file I'm trying to make a while loop
> in which i would like to navigate up and down between different lines.

The FAQ talks about working with line-oriented files. Also see seek and
tell in the perlfunc manpage. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: Thu, 8 Oct 1998 16:17:01 -0400
From: "Eric" <ebeyer@jetform.com>
Subject: OEM850 to ISO/ANSI Data Conversion
Message-Id: <6vj79v$qg4$1@nr1.ottawa.istar.net>

Please help me to solve this Character Set dilemma.

I have a CodePage 850 data file that I am running through a Perl script on
an NT4.0 box.  The Perl script updates a SQL 6.5 db but it kicks the
extended characters!!

If I look at the flat file through DOS 'Edit' it looks fine, if I look at
the flat file through Notepad the extended characters are kicked.  The ODBC
inserts the kicked characters.

My OEM->ANSI converter is not checked in the ODBC DSN.  If I turn it on I
insert other equally incorrect characters.

Can somebody explain what may be going on with these files and suggest a
solution to my DB insert dilemma?


Thanks;

EwB





------------------------------

Date: Thu, 08 Oct 1998 19:34:32 GMT
From: srenner@lycosmail.com
Subject: Re: Perl Robots
Message-Id: <6vj448$khi$1@nnrp1.dejanews.com>

Python would be better. sr


PS This idiotic editor will not post my response unless I add this line. One
line is not enough -- it says "no original text in reply". Please ignore this
PS














-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: 8 Oct 1998 18:18:13 GMT
From: gw@dtc.hp.com ((Gordon Wilson))
Subject: print bug/feature?
Message-Id: <6vivl5$rht@news.dtc.hp.com>
Keywords: print format

  The following:
printf"%1.0f %1.0f %1d %1d\n",9.5,10.5,9.5,10.5;

prints:
10 10 9 10

  This seem rather inconsistent.  Shouldn't it be:
9 10 9 10

  I am running:
This is perl, version 5.004_01
hpux 10.20

gordon


------------------------------

Date: Thu, 8 Oct 1998 11:58:47 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: print bug/feature?
Message-Id: <MPG.1086ab40db2adf0d9897fa@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <6vivl5$rht@news.dtc.hp.com> on 8 Oct 1998 18:18:13 GMT, 
(Gordon Wilson) <gw@dtc.hp.com> says...
>   The following:
> printf"%1.0f %1.0f %1d %1d\n",9.5,10.5,9.5,10.5;
> 
> prints:
> 10 10 9 10
> 
>   This seem rather inconsistent.  Shouldn't it be:
> 9 10 9 10

No.

'%.0f' rounds to the nearest integer, as if you had written
    int($x + ($x >= 0 ? 0.5 : -0.5)).

'%d' truncates to the integer nearest to zero, as if you had written
    int($x).

I'm not sure what you are trying to accomplish with those '%1's.  They 
specify a minimum field width of one character, which is the default, as 
you can't get fewer. :-)

`perldoc -f sprintf` for details, and `man 3 printf` for even more 
details.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: 8 Oct 1998 20:40:52 GMT
From: gw@dtc.hp.com ((Gordon Wilson))
Subject: Re: print bug/feature?
Message-Id: <6vj80k$rht@news.dtc.hp.com>

Hello Larry,

  Thanks for the reply.

  Your explanation makes sense:
9.5 becomes 10
10.5 becomes 11

  However, in my example:
9.5 becomes 10
10.5 becomes 10

  I just ran a test case in C, and I see the same behavior
(as my example).

  I looked in `perldoc -f sprintf` and `man 3 printf` and did
not find any explanation on this subject.

gordon

Larry Rosler (lr@hpl.hp.com) wrote:
: '%.0f' rounds to the nearest integer, as if you had written
:     int($x + ($x >= 0 ? 0.5 : -0.5)).
: `perldoc -f sprintf` for details, and `man 3 printf` for even more 
: details.


------------------------------

Date: Thu, 08 Oct 1998 13:42:24 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Problems Using a Compare Subroutine with Sort
Message-Id: <361CF980.4D27293D@min.net>

droby@copyright.com wrote:
> 
> John Porter <jdporter@min.net> wrote:
> >       1. characters are the same size as octets;
> 
> Which of course isn't quite true anymore.

Exactly.  It's a dangerous assumption.


> Perhaps we need to look at something bigger than octets in IPv7.  ;-)

Hey, yeah; if we amend the address spec to be four *characters*,
and four *Unicode* characters at that, then the resulting address
space is blessedly huge.

All IPv7 addresses are four-letter words.   Neat!


> >       2. characters are unsigned.
> 
> I think that one's reasonably safe. 

Yeah, probably.

> What would we mean by a signed character?

Well since a character isn't a number, sign has no meaning.
But the real issue is the possibility of brain-dead compilers
doing the wrong thing for character comparisons.
As you said, probably safe.

-- 
John "Many Jars" Porter
baby mother hospital scissors creature judgment butcher engineer


------------------------------

Date: Thu, 8 Oct 1998 19:00:24 GMT
From: "John J. Alesse" <jja@inforonics.com>
Subject: Re: Problems with substr (re- posted)
Message-Id: <361D0BC8.40C2@inforonics.com>

Perl folk:
 
 I'm having a problem with substr in version 5.00550 of Perl. It seems
 that the substr function has a hard time extracting strings that
contain
 non-printable (binary) data at or above \xC0 but only when used in a
 subroutine. This becomes a problem in packages like CGI.pm since substr
 is used to extract binary multipart form/data from the header.
 
I have included the test code below.  Please try to reproduce the
problem and
 let me know what you think is wrong.
 
 Thanks,
 John

#!/usr/local/bin/perl -w
#
# This command line test will determine if the Perl substr function is
working properly.  It seems that the substr function
# has a hard time extracting strings that contain non-printable (binary)
data at or above \xC0 but only when used in 
# a subroutine. This becomes a problem in packages like CGI.pm since
substr is used to extract binary
# multipart form/data from the header.
#
# I have received a failure running this on our build of Perl version
5.00550
#
# Please e-mail me your results, and include the OS you are on and what
version of Perl you are running.
# (I print the Perl version as part of the test)
#
# Thanks for your help.
#
# John J. Alesse	
# jja@inforonics.com
#
#######

sub test_substr
{
	# Extract a portion of the buffer (must include non-printable char \xC0
and above to fail)
	$got = substr($buff, 0, $wannaGet);
}
sub check_it
{
	$gotlen=length($got);
	if ($wannaGet != $gotlen)
		{ print  "ERROR: read=$bufflen wanted=$wannaGet got=$gotlen\n\n"; }
	else
		{ print  "OK: read=$bufflen wanted=$wannaGet got=$gotlen\n\n"; }
}
print "\nPERL_VERSION=$]\n";

# Buffer must contain non-printable char \xC0 and above for failure to
occur
$buff = "\xC0";
$bufflen = length($buff);
$wannaGet = 1;

# This always works
print  "TESTING WITHOUT FUNCTION CALL----------------------\n";
$got = substr($buff, 0, $wannaGet);
&check_it;

# This fails
print  "TESTING WITH FUNCTION CALL-------------------------\n";
&test_substr;
&check_it;


------------------------------

Date: 08 Oct 1998 15:25:53 -0400
From: Uri Guttman <uri@camel.fastserv.com>
To: "John J. Alesse" <jja@inforonics.com>
Subject: Re: Problems with substr (re- posted)
Message-Id: <sar67dusvni.fsf@camel.fastserv.com>

>>>>> "JJA" == John J Alesse <jja@inforonics.com> writes:

  JJA> I'm having a problem with substr in version 5.00550 of Perl. It
  JJA> seems that the substr function has a hard time extracting strings
  JJA> that contain non-printable (binary) data at or above \xC0 but
  JJA> only when used in a subroutine. This becomes a problem in
  JJA> packages like CGI.pm since substr is used to extract binary
  JJA> multipart form/data from the header.
 
i don't see why your code would fail. i ran it on 5.004_4 and got the correct
output. substr knows nothing about the data in the strings. it should
handle binary just fine.

you do realize that 5.005 is still not fully stable (as 5.004_04 is) and
5.00550 is the experimental branch? if this is a real bug, send it in
with perlbug.

BTW thanx for finally posting plain source. see, it got a response!

uri

-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


------------------------------

Date: Thu, 8 Oct 1998 18:16:53 GMT
From: "John J. Alesse" <jja@inforonics.com>
Subject: Re: Problems with substr (re-posted)
Message-Id: <361D0195.13B9@inforonics.com>

Sorry about the attachment.  Here is the test code:




John J. Alesse wrote:
> 
> Perl folk:
> 
> I'm having a problem with substr in version 5.00550 of Perl. It seems
> that the substr function has a hard time extracting strings that contain
> non-printable (binary) data at or above \xC0 but only when used in a
> subroutine. This becomes a problem in packages like CGI.pm since substr
> is used to extract binary multipart form/data from the header.
> 
> I have attached substr_test.pl.  Please try to reproduce the problem and
> let me know what you think is wrong.
> 
> Thanks,
> John
> 
>     ---------------------------------------------------------------
> 
>                         Name: substr_test.pl
>          Part 1.2       Type: Perl Program (application/x-perl)
>                     Encoding: base64


------------------------------

Date: Thu, 08 Oct 1998 14:35:28 -0500
From: Eric Von Zee <evonzee@tritechnet.com>
Subject: Re: Problems with substr
Message-Id: <361D1400.17668CD8@tritechnet.com>

"John J. Alesse" wrote:

> I have attached substr_test.pl.  Please try to reproduce the problem and
> let me know what you think is wrong.

sub no_lurk {
print qq|
Looks OK with my versions of Perl.. (albeit not the one you had a
problem
with)..


OS_NAME=EVIL_EMPIRE_95 (Win '95)
PERL_VERSION=5.00402
TESTING WITHOUT FUNCTION CALL----------------------
OK: read=1 wanted=1 got=1

TESTING WITH FUNCTION CALL-------------------------
OK: read=1 wanted=1 got=1


OS_NAME=Unix System V R.4
PERL_VERSION=5.003
TESTING WITHOUT FUNCTION CALL----------------------
OK: read=1 wanted=1 got=1

TESTING WITH FUNCTION CALL-------------------------
OK: read=1 wanted=1 got=1

HTH!

-Eric
|;
}#end sub no_lurk
--
Best Regards,     | Psychotics are consistently
Tritech Marketing | inconsistent. The essence of
                  | sanity is to be inconsistently
Eric Von Zee      | inconsistent.
Webmaster         | -- Larry Wall


------------------------------

Date: Thu, 08 Oct 1998 19:10:57 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: references becoming null pointers?
Message-Id: <Pine.GSO.4.02A.9810081206440.4710-100000@user2.teleport.com>

On Thu, 8 Oct 1998 rbowen@databeam.com wrote:

> The output from this program is some lines like:
> HASH(0x81191d0)
> Indicating (to me, at least) that the array contains one or more hash
> references, but that those references are not actually pointing at
> anything.

Close. That output means that you're almost certainly printing a hash
reference. That is, it does point to a hash, but you're not dereferencing
it. If you want to access the hash elements, you'll need to dereference
it; see perlref. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: Thu, 08 Oct 1998 15:03:44 -0400
From: Ian Lowe <Ian_Lowe@fanniemae.com>
Subject: Sys::Syslog Problems
Message-Id: <361D0C90.ECD614B8@fanniemae.com>

We are using the following syslogd exercise subroutine as part of a
daemon monitor package written in perl.  This is run every fifteen
minutes.  Most of the time everything works fine, but occasionally the
syslog function writes two identical messages to /var/adm/messages with
the same time stamp and same perl pid.  When this happens the script
returns false and reports that syslogd is down when it really isn't.  I
was hoping that someone who is familiar with the Sys::Syslog module
might be able to assist.  As I see it, the second message of the
identical pair should be ignored as I should have exited the while loop
after it parses the first message.

Any ideas?


sub syslog_exr {
    openlog("chkDaemon", 'ndelay', 'daemon');
    syslog('notice',"Checking syslogd[%d]",$$);
    closelog();

    sleep 3;

    open(IN,"</var/adm/messages");
    my($found);
    while ( <IN> ) {
        chop;
        next unless /\[$$\]$/;
        $found++;
        last;
    }
    return 1 if $found;
    return 0;
}



Ian


------------------------------

Date: Thu, 8 Oct 1998 19:13:57 GMT
From: Farhad Farzaneh <ff@otis.arraycomm.com>
Subject: using File::lockf
Message-Id: <vuyaqq7toq.fsf@otis.arraycomm.com>


I'm trying to use File::lockf (version 0.20) but am doing something very
simple very wrong.  Here's a simple program:

#!/bin/perl -w

use strict;
use File::lockf;

open F, "<foo" or die "Unable to open foo\n";
my $err = File::lockf::lock(\*F);
print "Error = $err\n";

It prints 'Error = 9';

Thanks.

-- 
Farhad


------------------------------

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 3930
**************************************

home help back first fref pref prev next nref lref last post