[13409] in Perl-Users-Digest
Perl-Users Digest, Issue: 819 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 16 13:07:35 1999
Date: Thu, 16 Sep 1999 10: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: <937501510-v9-i819@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 16 Sep 1999 Volume: 9 Number: 819
Today's topics:
Re: ? about bare word. <uri@sysarch.com>
Re: ? about bare word. (Kragen Sitaker)
[Help] Problem with AuthCookie on Apache Server <nguyen.nguyen@infosoft-consulting.com>
Re: CGI cannot open relative path <rootbeer@redcat.com>
Re: CGI cannot open relative path (Randal L. Schwartz)
Re: End Of File <tchrist@mox.perl.com>
Re: End Of File (Larry Rosler)
Re: End Of File (Kragen Sitaker)
ENOWORD: Referer <tchrist@mox.perl.com>
Re: HELP PARSE EMAIL ADDRESSES PLEASE (Larry Rosler)
Re: How can I know if string have points? <srooij@wins.uva.nl>
Re: How can I know if string have points? (Kragen Sitaker)
Re: How can I know if string have points? <tchrist@mox.perl.com>
Re: How to get the Envoriment parameters recorded? (Randal L. Schwartz)
Re: How to get the Envoriment parameters recorded? (Kragen Sitaker)
Re: How to get the Envoriment parameters recorded? (Greg Bacon)
how to produce a 'beep'? <leenick@interchange.ubc.ca>
Re: how to produce a 'beep'? <tchrist@mox.perl.com>
Re: MSQL.pm Please Help <cnspots@mindspring.com>
Re: Net::Ping problem <rootbeer@redcat.com>
Re: Open2 and Filehandle Limits (Kragen Sitaker)
Output pipes to a browser <carlo.mantini@fmr.com>
Re: Parsing Tab Delimited File [REPOST] <tchrist@mox.perl.com>
Re: Parsing Tab Delimited File <sariq@texas.net>
Re: Parsing Tab Delimited File <tchrist@mox.perl.com>
Re: Parsing Tab Delimited File <skilchen@swissonline.ch>
Re: Parsing Tab Delimited File <tchrist@mox.perl.com>
Re: Please help a newbie! - sorry for the mistake! <uri@sysarch.com>
Re: trimming spaces from a string (Greg Bacon)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 16 Sep 1999 12:34:40 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: ? about bare word.
Message-Id: <x7btb2ke72.fsf@home.sysarch.com>
>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
LR> In article <yn7E3.14494$N77.1073211@typ11.nn.bcandid.com> on Thu, 16 Sep
LR> 1999 14:44:46 GMT, Kragen Sitaker <kragen@dnaco.net> says...
>> In article <37E0F5A8.47FBEB19@scmp.com>, scmpoper
>> <scmpoper@scmp.com> wrote:
>> >Do anyone know what's wrong with the code below:
>> >print "\${\"value\"} is ${"value"}\n";
>>
>> print "\${\"value\"} is ${\"value\"}\n";
LR> Because the closing delimiter of a string is found before its
LR> contents are analyzed.
correctamundo!
LR> print qq(\${"value"} is ${"value"}\n);
symref alert!
LR> print "\${'value'} is ${'value'}\n";
symref alert!
LR> print "\${value} is ${value}\n";
why are the braces there at all? no need to disambiguate $value from its
neighboring text in those strings.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: Thu, 16 Sep 1999 16:45:17 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: ? about bare word.
Message-Id: <x89E3.14658$N77.1085919@typ11.nn.bcandid.com>
In article <MPG.124ab142bea22626989f8e@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>Because the closing delimiter of a string is found before its contents
>are analyzed.
Ah, I see. Thanks. I started typing an explanation, then I realized I
knew it was wrong, so I said, "Dunno why."
> print "\${'value'} is ${'value'}\n";
>
> print "\${value} is ${value}\n";
I believe these two are different.
#!/usr/bin/perl -w
use strict 'refs';
print "\${'value'} is ${'value'}\n";
yields:
Can't use string ("value") as a SCALAR ref while "strict refs" in use at - line 3.
But
#!/usr/bin/perl -w
use strict 'refs';
print "\${value} is ${value}\n";
yields:
Name "main::value" used only once: possible typo at - line 3.
Use of uninitialized value at - line 3.
${value} is
. . . i.e. it's not a symref.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Thu Sep 16 1999
53 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Thu, 16 Sep 1999 10:55:22 -0600
From: "Nguyen Nguyen" <nguyen.nguyen@infosoft-consulting.com>
Subject: [Help] Problem with AuthCookie on Apache Server
Message-Id: <Ox591NGA$GA.275@cpmsnbbsa03>
Hello,
I am trying to setup AuthCookie to work with
our Apache server. The AuthCookie comes
with a sample script called "login.pl". In that
script, it has a line of
my $r = Apache->request;
which produces the following error message in the
Apache error log file:
Can't locate object method "request" via package "Apache" at
/usr/website/eg/unprotected/login.pl line 6.
[Wed Sep 15 20:33:41 1999] [error] [client 63.14.54.86] Premature
end of script headers: /usr/website/eg/unprotected/login.pl
Can someone let me know which package this
script is trying to use? Is there such a thing
as a Apache package (eg Apache.pm) for Apache
server? If so where can I get it?
The following is the configuration info of our Apache
web server:
[Wed Sep 15 20:33:32 1999] [notice] Apache/1.3.6 (Unix)
mod_perl/1.19 mod_ssl/2.3.1 OpenSSL/0.9.3a configured
-- resuming normal operations
Thanks in adnvance for any help you can provide.
Nguyen D. Nguyen
(303) 766-4317
------------------------------
Date: Thu, 16 Sep 1999 09:18:55 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: CGI cannot open relative path
Message-Id: <Pine.GSO.4.10.9909160917050.25903-100000@user2.teleport.com>
On Thu, 16 Sep 1999, JduPayrat wrote:
> I don't see any solution that don't need a change
> in each script.
Use a configuration module for your site. On each machine, unstall that
module into one of the @INC directories that that machine's perl uses.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 16 Sep 1999 09:20:49 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: CGI cannot open relative path
Message-Id: <m1g10e7rq6.fsf@halfdome.holdit.com>
>>>>> "Ethan" == Ethan H Poole <ehpoole@ingress.com> writes:
Ethan> In many instances, you can calculate the base directory of your
Ethan> executing script by examining $0 ($ zero).
This is merely a hint. It's user-defined data, and so the moment
you trust it, you will lose when someone trivially defeats that.
print "Just another Perl hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: 16 Sep 1999 10:32:55 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: End Of File
Message-Id: <37e11bb7@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
Ala Qumsieh <aqumsieh@matrox.com> writes:
:2) Unless you screwed around with $/, the only place where a line
:could exist without a line terminator (\n) will be the very last line
:of your file. But this is a very very rare case.
It's not a line until the newline. It's merely data. Somebody
screwed up the file.
--tom
--
If you get all your information from local TV news, you end up knowing less
than if you just stayed home on the couch and drank gin from the bottle.
-- Garrison Keillor
------------------------------
Date: Thu, 16 Sep 1999 09:33:53 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: End Of File
Message-Id: <MPG.124abbcdfffaf624989f8f@nntp.hpl.hp.com>
In article <x3ybtb2hqcd.fsf@tigre.matrox.com> on Thu, 16 Sep 1999
10:40:34 -0400, Ala Qumsieh <aqumsieh@matrox.com> says...
...
> 2) Unless you screwed around with $/, the only place where a line
> could exist without a line terminator (\n) will be the very last line
> of your file. But this is a very very rare case.
No, the final '0' without a line terminator is not a line, which is
defined as a string terminated by a newline. And the file with such a
fragment is not a valid text file, which is defined as a sequence of
lines.
The whole fiasco hasn't been as costly as the 'year - 1900' bobble, but
it has been annoying. Such is the price of pointless pedantry.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 16 Sep 1999 16:50:14 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: End Of File
Message-Id: <ad9E3.14662$N77.1086111@typ11.nn.bcandid.com>
In article <MPG.124abbcdfffaf624989f8f@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>> 2) Unless you screwed around with $/, the only place where a line
>> could exist without a line terminator (\n) will be the very last line
>> of your file. But this is a very very rare case.
>
>No, the final '0' without a line terminator is not a line, which is
>defined as a string terminated by a newline.
Many Unix programs define it that way. Most MS-DOS programs use their
perverted equivalent of newline as a line separator, not a line
terminator. Unicode has adopted the MS-DOS way; the line separator and
paragraph separator characters are separators, not terminators, and if
you have one at the end of your file, why, that means you have an empty
line (or paragraph) following it.
I'm not sure how God defines it. Probably the Unix way. :)
> And the file with such a
>fragment is not a valid text file, which is defined as a sequence of
>lines.
Defined by whom? :)
It is obviously the Wrong Thing to silently discard data at the end of
your file because the file doesn't match your expectations. You should
either process it or die "invalid text file".
Fortunately, Perl does the Right Thing.
>The whole fiasco hasn't been as costly as the 'year - 1900' bobble, but
>it has been annoying. Such is the price of pointless pedantry.
We pointless pedants aim to please :)
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Thu Sep 16 1999
53 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: 16 Sep 1999 10:37:36 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: ENOWORD: Referer
Message-Id: <37e11cd0@cs.colorado.edu>
In comp.lang.perl.misc,
kragen@dnaco.net (Kragen Sitaker) writes:
:In article <37B3266A.8970EAA3@microcal.com>, Larry Yu <yu@microcal.com> wrote:
:What is the download record? You can get the HTTP Referer header from
:$ENV{HTTP_REFERER}.
There is, of course, no word "referer" in English. It's "referrer".
The illiterati strike again, but this time deep into the heart of the
standards docs. Don't these people have proofreaders and spell checkers?
--tom
--
Chip Salzenberg sent me a complete patch to add System V IPC (msg, sem and
shm calls), so I added them. If that bothers you, you can always undefine
them in config.sh. :-) --Larry Wall in <9384@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: Thu, 16 Sep 1999 09:56:01 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: HELP PARSE EMAIL ADDRESSES PLEASE
Message-Id: <MPG.124ac0ff422f9d76989f90@nntp.hpl.hp.com>
In article <Pine.GSO.4.10.9909160849100.25903-100000@user2.teleport.com>
on Thu, 16 Sep 1999 08:51:21 -0700, Tom Phoenix <rootbeer@redcat.com>
says...
[with a stealth e-mail. Oh, well!]
> On Wed, 15 Sep 1999, Larry Rosler wrote:
>
> > #!perl -nw
> > print "$1\n" if /\s(\S+@\S+)\s/
>
> Of course, that won't necessarily find or extract an e-mail address from a
> text stream. In fact, I can't think of a real-world use for that program.
> Oh, well!
At least it's easier to read than what we started with, so we can see
clearly just how useless it might be.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 16 Sep 1999 18:21:26 +0200
From: Steven de Rooij <srooij@wins.uva.nl>
Subject: Re: How can I know if string have points?
Message-Id: <37E11906.96BCC715@wins.uva.nl>
Hi,
> How can I know if string have points?
>
> I have a string $var and I want to know if this string have the char
> '.':
>
> my var can be as this: $var="../" or $var="/../../"
>
> Thanks
You need to escape special characters in a regular expression with the
backslash `\'.
So you can use this:
blahblah if $var =~ /\./;
You badly need to read the perldoc perlre!
Steven
------------------------------
Date: Thu, 16 Sep 1999 16:25:28 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: How can I know if string have points?
Message-Id: <YR8E3.14619$N77.1083981@typ11.nn.bcandid.com>
In article <37E10602.62732A22@ogilvyinteractive.es>,
Abel Almazán <abel.almazan@ogilvyinteractive.es> wrote:
>I have a string $var and I want to know if this string have the char
>'.':
>
>my var can be as this: $var="../" or $var="/../../"
$var =~ /\./
Read a good Perl tutorial. _Learning Perl_ is quite good; see your
local bookstore. (I don't know if there's a Spanish translation yet.)
_Picking Up Perl_, on the Web at http://www.ebb.org/PickingUpPerl/,
seems rather thorough, although it's less than half finished and the
tone is a bit dry. I have confidence in the author. (I am certain
there is no Spanish translation of PUP yet.)
Good luck.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Thu Sep 16 1999
53 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: 16 Sep 1999 10:33:56 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How can I know if string have points?
Message-Id: <37e11bf4@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
Abel =?iso-8859-1?Q?Almaz=E1n?= <abel.almazan@ogilvyinteractive.es> writes:
:How can I know if string have points?
:
:I have a string $var and I want to know if this string have the char
:'.':
% man perlre
% man perlop
% man perlfunc/index
--tom
--
"Lazy people never bother to actually read the manual. Instead they
(like kids) pick something with big, colorful buttons."
--Eugene Tyurin <gene@insti.physics.sunysb.edu>
------------------------------
Date: 16 Sep 1999 09:24:12 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: How to get the Envoriment parameters recorded?
Message-Id: <m1btb27rkj.fsf@halfdome.holdit.com>
>>>>> "Kragen" == Kragen Sitaker <kragen@dnaco.net> writes:
Kragen> What is the download record? You can get the HTTP Referer header from
Kragen> $ENV{HTTP_REFERER}.
... which is merely a hint of the real data, since Referer: can be
faked trivially. Use it for statistics, but never as an
authentication token.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Thu, 16 Sep 1999 16:26:50 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: How to get the Envoriment parameters recorded?
Message-Id: <eT8E3.14621$N77.1082651@typ11.nn.bcandid.com>
In article <m1btb27rkj.fsf@halfdome.holdit.com>,
Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>Kragen> What is the download record? You can get the HTTP Referer header from
>Kragen> $ENV{HTTP_REFERER}.
>
>... which is merely a hint of the real data, since Referer: can be
>faked trivially. Use it for statistics, but never as an
>authentication token.
Yes, of course. Anything sent by the user can have any contents the
user wants.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Thu Sep 16 1999
53 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: 16 Sep 1999 16:40:21 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: How to get the Envoriment parameters recorded?
Message-Id: <7rr6hl$34r$3@info2.uah.edu>
In article <eT8E3.14621$N77.1082651@typ11.nn.bcandid.com>,
kragen@dnaco.net (Kragen Sitaker) writes:
: Yes, of course. Anything sent by the user can have any contents the
: user wants.
Wouldn't you be pretty pissed otherwise? :-)
Greg
--
Drugs may lead to nowhere, but at least it's the scenic route.
------------------------------
Date: Thu, 16 Sep 1999 09:59:17 -0700
From: Nick Lee <leenick@interchange.ubc.ca>
Subject: how to produce a 'beep'?
Message-Id: <37E121E4.446995B6@interchange.ubc.ca>
Hi,
I guess the title explains itself. My question is: how to produce a
beep from a perl program?
Any help is appreciated,
Nick
------------------------------
Date: 16 Sep 1999 11:02:09 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: how to produce a 'beep'?
Message-Id: <37e12291@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
Nick Lee <leenick@interchange.ubc.ca> writes:
:I guess the title explains itself. My question is: how to produce a
:beep from a perl program?
use Curses;
initscr();
beep();
endwin();
--tom
--
"All things are proceeding rapidly to their contusion." --Larry Wall
------------------------------
Date: Thu, 16 Sep 1999 12:49:30 -0400
From: "CNspots" <cnspots@mindspring.com>
Subject: Re: MSQL.pm Please Help
Message-Id: <7rr7qk$tuk$1@nntp9.atl.mindspring.net>
Thanks for your help guys.. after much trying I finally got in touch with
technical support for my server to find out that the problem was not with my
code but with the server.
Once again Thanks...
CNspots <cnspots@mindspring.com> wrote in message
news:7r8o5s$eb8$1@nntp3.atl.mindspring.net...
> Could someone please tell me what is wrong with thiscode I have been
racking
> my brains for a week and I still can't figure it out.. Also can anyone
> reccomend a good source for learning msql.pm Thanfs
>
> #!/usr/local/bin/perl
> use CGI;
> use Msql;
> use DBI;
>
> $cgiobject=new CGI;
> print $cgiobject->header;
>
> #$msql_hostname = "";
> #$msql_databasename = "disnco";
> $query = new CGI;
>
>
>
> #read in submitted Values
>
> if ($query->param)
>
> $ID_str = $query->param('Client_ID');
> $Company_str = $query->param('Company');
> $Address_str = $query->param('Address');
> $City_str = $query->param('City');
> $State_str = $query->param('State');
> $Country_str = $query->param('Country');
> $Zip_str = $query->param('Zip');
> $Phone_str = $query->param('Phone');
> $Fax_str = $query->param('Fax');
> $Email_str = $query->param('Email');
> $Web_Site_str = $query->param('Web_Site');
> $Refferd_by_str = $query->param('Refferd_by');
> $Contact_str = $query->param('Contact');
> $Notes_str = $query->param('Notes');
> $Alt_Contact_str = $query->param('Alt_Contact');
>
> }
>
> #Connect to Database
>
>
> $dbh = Msql->Connect("","disnco") or
> die "not ok 1: $Msql::db_errstr\n";
>
> #Insert New Client into Database
>
>
> $self = shift;
>
> $sql = qq[INSERT INTO client (Client_ID,Company,Address) VALUES
> ($ID_str,$Company_str,
> $Address_str)];
> $sth= $self->{ dbh }->query($sql);
>
> # CODE BREAKS HERE
>
> print "<HTML><HEAD></HEAD><BODY>";
> print $ID_str, "<BR>";
> print $Company_str, "<BR>";
> print $Address_str, "<BR>";
> print $City_str,"<BR>";
> print $State_str, "<BR>";
> print $Zip_str, "<BR>";
> print $Country_str, "<BR>";
> print $Phone_str, "<BR>";
> print $Fax_str, "<BR>";
> print $Email_str, "<BR>";
> print $Web_Site_str, "<BR>";
> print $Refferd_by_str, "<BR>";
> print $Contact_str, "<BR>";
> print $Notes_str, "<BR>";
> print $Alt_Contact_str, "<BR>";
>
>
>
> print "test5";
> #Create Output Page
> print $cgiobject->footer;
>
>
>
------------------------------
Date: Thu, 16 Sep 1999 09:06:06 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Net::Ping problem
Message-Id: <Pine.GSO.4.10.9909160903160.25903-100000@user2.teleport.com>
On Thu, 16 Sep 1999, Bernie wrote:
> When attempting to run ICMP ping as setuid, I still receive
> the error "icmp ping requires root privilege at ./test line 104".
Are you sure it's running set-id to root? Add this line before the ping:
die "Oops - not set-id to root" if $>;
> I then did a chmod 4755 ping.pl, and changed the
> UID and GID to root.
Not in that order, I hope. Good luck with it!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 16 Sep 1999 16:40:46 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Open2 and Filehandle Limits
Message-Id: <i49E3.14649$N77.1085447@typ11.nn.bcandid.com>
In article <7rr1p3$ct1$1@nova.thezone.net>,
E. Smith <edwardwjsmith@hotmail.com> wrote:
>However, this is only working for a limited number
>of files. Once this limit is reached, the program hangs.
>
>open2(READER, WRITER, "sccsget $filename $version") || die "Can't open
>sccsget $!";
> while(<READER>)
> {
> if (/.*ISCS external.*/)
> {
> print WRITER "y\n";
> }
> }
> close WRITER || die "Can't close writer: $!";
> close READER || die "Can't close reader: $!";
My guess: buffering is fucking you up. If sccsget (is this the sccs
'get' command by another name? how does it smell?) writes
block-buffered output, it may output something that requires a 'y', but
leave it in its output buffer instead of flushing it to you. So you
won't get the ISCS external whatever, and then sccsget will block
reading its input while you're blocking reading its output.
Possibly, also, it's outputting a question your script isn't
recognizing as a question.
Is it always the same file it hangs on, regardless of how many files
precede it? That would suggest I am right.
My suggestion: open READER, "yes | sccsget $filename $version |" or die
"Can't open sccsget: $!"; -- assuming you really do want to say 'y'
every time it asks a question :)
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Thu Sep 16 1999
53 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Wed, 15 Sep 1999 14:31:36 -0400
From: Carlo Mantini <carlo.mantini@fmr.com>
Subject: Output pipes to a browser
Message-Id: <37DFE608.EE3AB31C@fmr.com>
I am rewriting a shell script in Perl. Its function is to run a bin
that performs a data inquiry (named dds_access) and prints the output to
a frame in a browser. Fields needed by the bin are input on the left
side of the frame and the fields are sent to the script using a PUT.
The output is displayed on the right.
To accomplish this, I construct 3 lines of input, pipe that into the
bin, then pipe the output into another Perl script (named
format_output_html.cgi) that reads the input and formats the output for
viewing in the output frame in the browser. It is this script that is
actually producing the output that is viewed with the browser. Below is
the pipe as it exists in the first script:
open ( CMD, "| dds_access | format_output_html.cgi" );
CMD->autoflush( 1);
print CMD "new\n"."open host $host port $port\n"."xref $XREF\n"."sym sym
$sym $R
TDEL\n"."quit\n"."quit\n" ;
print "";
close CMD;
The problem I am encountering is this: When I submit the form, the
command runs to completion but nothing is written to the output frame in
the browser. When I run the script from a command line, the output is
sent to my screen. No error messages are being written to the log by the
web server.
I suspect that the second Perl script, the one that formats the output,
cannot connect to the output frame in the browser. However, I'm not
sure how to remedy this. the form tag on the input frame has the
correct name of the output frame.
Does anybody have any thoughts on this?
Thanks, Carlo Mantini
carlo.mantini@fmr.com
------------------------------
Date: 16 Sep 1999 10:30:11 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Parsing Tab Delimited File [REPOST]
Message-Id: <37e11b13@cs.colorado.edu>
[REPOST: This posting appears to have been rogue cancelled.]
In comp.lang.perl.misc,
"Samuel Kilchenmann" <skilchen@swissonline.ch> writes:
:Neither regexps nor split are particularly useful for simple things like
:parsing csv files, so this extension module is exactly the right thing
:to use.
You misstate yourself. Regexps and split certainly are
useful for simple data parsing, as seen in
@fields = split(' ', $line);
@pwent = split(/:/, $line, -1);
Or even for complex files like termcap:
while (<>) {
next if /^(#.*)?\s*$/; # comments
$_ .= <> while s/\\$// && !eof; # continuations
@fields = split /:(?:\s*:)*/; # colon-separated w/glitch
printf "%d fields in %s\n", 0+@fields, $fields[0] =~ /^([^|]+)/;
}
In a sane world, where "comma-separated values" actually happens to mean
the remarkably surprising "comma-separated values", this is all it takes:
@fields = split(/,/, $line, -1);
You'll notice that this approach also suffices for the passwd file, etc.
Those were designed for simplicity.
However, programmer-hostile systems seem riddled with programmer-hostile
files mis-designed by evil and stupid sado-masochistic programmers who
should have all their fingernails torn out, very slowly. No thought
is given to simplicity of parsing, which means you get something
that is *not* simple to parse. Do not call things so-called "CSV
files" simple, because if they were, then a split would suffice.
It doesn't, so they aren't. And they're hardly "comma-separated".
They're "quasi-comma-separated with inane hacks and idiosyncrasies
bearing only a superficial and conquently deceptive resemblance to actual
comma-separated data".
--tom
--
I hope to get Perl 5 out this summer, for certain values of summer.
-- <1993Jun5.052825.3897@netlabs.com>
------------------------------
Date: Thu, 16 Sep 1999 10:53:39 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Parsing Tab Delimited File
Message-Id: <37E11283.920CAD38@texas.net>
Samuel Kilchenmann wrote:
>
> <brian_fredette@vnet.ibm.com> wrote in:
> news:7ro7uu$dge$1@nnrp1.deja.com...
> >
> > I'm having some trouble finding information on how to parse a tab
> > delimited text file. Any pointers would be appreciated.
> >
> You may want to take a look at:
> http://search.cpan.org/search?module=Text::CSV_XS
> Neither regexps nor split are particularly useful for simple things like
> parsing csv files, so this extension module is exactly the right thing
> to use.
For parsing tab-separated text files?
I don't see any reference to comma-separated in the posters question.
A number of people have already given correct answers.
- Tom
------------------------------
Date: 16 Sep 1999 10:27:11 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Parsing Tab Delimited File
Message-Id: <37e11a5f@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
kragen@dnaco.net (Kragen Sitaker) writes:
:>Those were designed for simplicity.
:
:It's not a general-purpose data format, though; you can't store commas
:in its fields.
And a C string is not a general purpose data format because
you can't use nulls in it. Well, perhaps, but we seldom
care. The normal thing is to use an alternate representation.
:>No thought
:>is given to simplicity of parsing, which means you get something
:>that is *not* simple to parse. Do not call things so-called "CSV
:
:"things like"?
This is not CSV:
this,"peter, paul, and mary",jane
this,"peter, paul, and mary","jane"
this,"peter, paul, and mary",'jane''s game',here
Because any xSV can be processed with split /x/. Those are
just screwed up idiocies. I hate them. They were designed
by someone who didn't design.
None of that crap is present in any of the Unix colon-separated data
formats. You don't have the quote crap. And even if you have colons
in your fields, you simply do something like:
for (@fields = split /:/) { s/\\0(\d+)/ord $1/ge }
You don't have to say "goodness, was that comma a separator or not?"
You don't have to say "gosh, should I use quote marks?"
You don't have to say "golly, were those quote marks real data?"
You don't have to say "gee whiz, what about doubled quotes?"
You get to use a trivial parser, not those completely hellish
regexes that you posted. That is Colon-Separated Data.
What you are calling Comma-Separated Data *is not*. It's
an idiocy.
:Can you give me an example of one of these formats?
Above.
:The ones I'm familiar with are quotes-with-doubled-quote,
That's insane.
:hex encoding,
That's admissible.
:and quotes-with-backslashed-quote-and-doubled-backslash.
That's insane.
:Admittedly, that's not as simple as 'split'.
It sucks.
--tom
--
Any sufficiently advanced technology is indistinguishable from a rigged
demo.
------------------------------
Date: Thu, 16 Sep 1999 16:28:04 GMT
From: "Samuel Kilchenmann" <skilchen@swissonline.ch>
Subject: Re: Parsing Tab Delimited File
Message-Id: <oU8E3.16899$m4.69259929@news.magma.ca>
Tom Briles wrote in news:37E11283.920CAD38@texas.net
>Samuel Kilchenmann wrote:
>> >
>> You may want to take a look at:
>> http://search.cpan.org/search?module=Text::CSV_XS
>> Neither regexps nor split are particularly useful for simple things like
>> parsing csv files, so this extension module is exactly the right thing
>> to use.
>
>For parsing tab-separated text files?
>
Yes, the problem to solve is evidently exactly the same. The separator
character can be arbitrarily choosen.
>I don't see any reference to comma-separated in the posters question.
>
Then you don't understand the problem.
>A number of people have already given correct answers.
>
No, unfortunately even the gurus posted mostly rubbish based on split or
regexp's. I don't get the point about the "moral issue" of values containing
the separator or the quote character. And as long, as values may contain
these characters, neither regexp's nor split's are very useful. But it is
really simple to parse CSV data on a character by character basis, together
with a very simple state machine. It ist that simple that even i am able
write such a beast from scratch. But Jochen Wiedmann already did it in the
module mentionned above, so there is no need to do it again.
------------------------------
Date: 16 Sep 1999 10:46:31 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Parsing Tab Delimited File
Message-Id: <37e11ee7@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
"Samuel Kilchenmann" <skilchen@swissonline.ch> writes:
:No, unfortunately even the gurus posted mostly rubbish based on split or
:regexp's. I don't get the point about the "moral issue" of values containing
:the separator or the quote character. And as long, as values may contain
:these characters, neither regexp's nor split's are very useful.
Anybody who creates external data in that format should be shot,
plain and simple. Yes, many people do it. The world would be a far,
far better place without those people programming. They're idiots who
make life hard for others. There are better jobs for them at the
local hot dog stand. They'd do less damage there.
:really simple to parse CSV data on a character by character basis, together
:with a very simple state machine.
Oh for crying out loud, 95% of the people using Perl have never even
heard of a state machine, and if they have, probably connect it with a
fascist government.
--tom
--
Unix is supported by IBM, like a hanging man is supported by rope
- _Life With Unix_ Don Libes & Sandy Ressler
------------------------------
Date: 16 Sep 1999 12:26:15 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Please help a newbie! - sorry for the mistake!
Message-Id: <x7emfykel4.fsf@home.sysarch.com>
>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
LR> Printing a line when you have it in hand is a lot clearer than
LR> concatenating it to a string that you print eventually.
in general i would agree. but building up strings for later printing is a
time honored perl technique. i have used it many times under various
situations. one was where i had to build up c structs from recursive
data structures, so i had to build the string and prepend to it before i
could print it. the code generation rules were very complex.
and a favorite design technique i use is to have routines/methods which
create a text output to not print the results but return them. then the
caller has the decision of where and when to print or further process
the text.
in creating html, i build strings before printing. this is so i can wrap
things later in tags (using CGI.pm calls sometimes). i also can output
the html to a second file handle (e.g. file or named pipe) as well as
STDOUT for debugging.
but in this case where you just process and print in a loop, saving
the text beforehand is not needed.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: 16 Sep 1999 16:38:11 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: trimming spaces from a string
Message-Id: <7rr6dj$34r$2@info2.uah.edu>
In article <MPG.124aaa59b4cc13c7989f8c@nntp.hpl.hp.com>,
lr@hpl.hp.com (Larry Rosler) writes:
: In article <7rqvkl$1ts$1@info2.uah.edu> on 16 Sep 1999 14:42:29 GMT,
: Greg Bacon <gbacon@itsc.uah.edu> says...
:
: > Appropriate? Appropriate?! I don't understand. :-)
:
: Oh, yes you do. 'Appropriate' as in 'an order of magnitude faster'.
: :-)
Compilers are in general much better at microoptimization than humans
are. The burden of microoptimization should therefore fall on the
compiler and not on the programmer. Otherwise, you should start to
advocate C code like
integer ^= integer; /* set integer to zero */
or
arg <<= 2; /* quadruple arg */
Feh.
Greg
--
Anger is a gift.
-- rage against the machine
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
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 819
*************************************