[10045] in Perl-Users-Digest
Perl-Users Digest, Issue: 3638 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep  4 18:06:32 1998
Date: Fri, 4 Sep 98 15: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           Fri, 4 Sep 1998     Volume: 8 Number: 3638
Today's topics:
    Re: "reading line by line from a file until condition i <murrayb@vansel.alcatel.com>
    Re: "use vars qw(var)" -vs- "my $var" (Mark-Jason Dominus)
    Re: #!/usr/bin/perl not working? (Tom Vaughan)
    Re: backticks and windows <BERNIEGS@prodigy.net>
        bricht Apache wegen CGI Error ab? (Sascha Berkenkamp)
    Re: bricht Apache wegen CGI Error ab? (Larry Rosler)
        Execute END{} at CGI termination? (Larry Rosler)
    Re: Execute END{} at CGI termination? (Michael Schout)
    Re: Execute END{} at CGI termination? (Larry Rosler)
    Re: exit value lost by system? <aqumsieh@tigre.matrox.com>
        grouping list of ARRAY refs with grep ? <prl2@lehigh.edu>
    Re: Help-about install Perl on NT 4 (Alastair)
    Re: HTML2PS: problem with JPEG files (I R A Aggie)
    Re: If/Then Statement (I R A Aggie)
    Re: Is perl millennium compliant ? cicero_n@my-dejanews.com
        my lousy syntax mmesmer@yahoo.com
    Re: or vs || with open function (I R A Aggie)
    Re: Parsing XML and HTML (was: Re: Better Regular Expre (I R A Aggie)
    Re: Parsing XML and HTML (was: Re: Better Regular Expre <crism@oreilly.com>
    Re: Pattern matching specific <jdw@dev.tivoli.com>
    Re: Pattern matching specific <aqumsieh@tigre.matrox.com>
    Re: Precompiled perl for solaris 2.5? <gregory.t.white@lmco.com>
        Problem installing perl 5.004_04 <debuigny@dallas.net>
    Re: Problem: Opening Word (ack!) doc w/ OLE (Jan Dubois)
    Re: Question of regex in perl (Jonathan Stowe)
    Re: running as setuid (Mark-Jason Dominus)
        Test language in perl <van@venice.dh.trw.com>
        Truncation problem when appending arrays in Perl (Darren Hayes)
    Re: usig a while statement to read from a list and test (Mark-Jason Dominus)
    Re: Why does 'lynx' in perl script fail on some servers <nguyend7@msu.edu>
        Why is 5.005* a pain to switch to safely? <steve.tolkin@fmr.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 04 Sep 1998 12:11:50 -0700
From: Brad Murray <murrayb@vansel.alcatel.com>
Subject: Re: "reading line by line from a file until condition is met"
Message-Id: <upvdbu1zd.fsf@vansel.alcatel.com>
lsgs@my-dejanews.com writes:
>    while (<DATABASE>) {
>           @record = split(/\:/, $_);
>       if ($record[0] eq $name and $record[1] eq $passwd) {
>       close ("DATABASE");
>       &display;
>     }
You're closing your file before you're finished with it.
-- 
Brad Murray      "Every normal man must be tempted at times to spit on
Software Analyst  his hands, hoist the black flag, and begin slitting
Alcatel Canada    throats."             --H.L. Mencken
------------------------------
Date: 4 Sep 1998 16:26:31 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: "use vars qw(var)" -vs- "my $var"
Message-Id: <6spidn$3d3$1@monet.op.net>
In article <35D8A39D.33E4F7F8@geoworks.com>,
Matt Armstrong  <matta@geoworks.com> wrote:
>What is the practical difference between "use vars qw(var)" and a "my
>$var" at file scope?
`my $var' creates a lexical variable which is inaccessible outside its
scope.  For a variable declared not inside any block, the scope is
from the point of declaration to the end of the file.
`use vars wq(var)' declares a package variable, so that `use strict
vars' won't complain about it if you leave off the package qualifier.
Really they have nothing to do with each other.
>What package are variables placed in with "use vars?"  
The current package.
>Are they always place in 'main'? 
No.
>Can variables declared with "use vars" clash with other packages?
No, because they're in the current package and not in some other package.
>What does "use vars" actually do (I already know what the documentation
>says -- namely that it'll make warnings go away -- I'd like to know why
>they go away).
The error message from strict is only triggered when the variable is
first created.  `use vars ...' pre-creates the variable, so that you
avoid the message.
>Traditionally, when using "use strict" and coming across situations
>where code was looking for an explicit package name, I just called the
>variables $main::whatever.  How is "use vars" a superior solution?
1. Less punctuation
2. Works in packages other than `main'
3. You don't have to change all the `main's if you put the code into
   some other package.
4. It probably isn't a big deal whether you use one or the other.
------------------------------
Date: 4 Sep 1998 19:55:55 GMT
From: vaughan@itdc.edu (Tom Vaughan)
Subject: Re: #!/usr/bin/perl not working?
Message-Id: <6spgkb$9cr$1@malgudi.oar.net>
Andrew Mulvey (triangle@iinet.net.au) wrote:
: Hi
: *Very* new to Perl person here.
: I can easily run perl scripts I have written in Linux (RH5.0) by typing
: "perl exename" at the shell prompt but even if i start the script with
: #!/usr/bin/perl my script won't run simply by entering its name at the
: prompt (and yes i have set the file the script is saved in as executable
: by u, g and o). The perl exe is sitting in /usr/bin btw.
: Can anyone enlighten me?
: Thanx
: T :)
Make absolute sure that #!/usr/bin/perl is the first thing in your file.
That means no blanks and no spaces. The #! have to be the 1st two characters.
Tom
------------------------------
Date: Fri, 04 Sep 1998 14:26:50 -0600
From: BERNIEGS <BERNIEGS@prodigy.net>
To: Bob Trieger <sowmaster@juicepigs.com>
Subject: Re: backticks and windows
Message-Id: <35F04D09.2E2369F4@prodigy.net>
Bob Trieger wrote:
> -> now I am convinced that this must be a FAQ,
> -> so if you know where to find the answer,
> -> please send me there
> ->
> -> $out = `echo hey`;
> -> print "Output: $out\n";
> ->
> -> In the above, $out doesn't capture the output.
> Bob Trieger
> sowmaster@juicepigs.com
>
I'm glad it works for you. that means there's hope for me. I've tried it
under WIN95, using both Perl 5.005_02 and 5.005, and in neither is the
DOS output redirected properly. It displays correctly on my screen, but
it never reaches my script. I even set the environment variable
PERL5SHELL=COMMAND.COM /C per the install instructions. Did you have to
do that to get it to work?--
Bernie Schneider: berniegs@prodigy.net
========================================================================
The individual has always had to struggle to keep from being overwhelmed
by the tribe. To be your own man is a hard business. If you try it, you
will be lonely often, and sometimes frightened. But no price is too high
to pay for the privilege of owning yourself.       << Rudyard Kipling >>
------------------------------
Date: Fri, 04 Sep 1998 20:34:27 GMT
From: sberkenkamp@gmx.net (Sascha Berkenkamp)
Subject: bricht Apache wegen CGI Error ab?
Message-Id: <35f007e8.1186006@news.nordwest.net>
Hallo,
ich habe letztens einen lokalen Apache Server auf meiner Linuxkiste
installiert. Leider brechen viele von meinen Skripten (die |brigens
auf anderen Servern im Internet problemlos laufen) mit der
Fehlermeldung _Premature end of script headers_ ab. Liegt das am
falschen Syntax der Skripte, oder sind die Skripte falsch
konfiguriert.
Sorry, wenn es wahrscheinlich die x te Frage dieses Themas ist, aber
ich bin ein absoluter Newbie. Wenn ich wenigstens w|_te, ob es ein
Perl oder ein Error von Apache ist (also falsch konfiguriert).
Danke
Sascha
sberkenkamp@gmx.net <- Sascha Berkenkamp -> Fax: +49 89 666 173 366 6
Infos zu CGI und Perl: http://free-cgi.home.pages.de
[/ Irdisches Gut wird wertlos, wenn man daf|r mit dem eigenen Leben bezahlen soll. /] (Konsalik)
------------------------------
Date: Fri, 4 Sep 1998 14:25:43 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: bricht Apache wegen CGI Error ab?
Message-Id: <MPG.1059fab546f62c8989791@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and a copy mailed.]
In article <35f007e8.1186006@news.nordwest.net> on Fri, 04 Sep 1998 
20:34:27 GMT, Sascha Berkenkamp <sberkenkamp@gmx.net> says...
> ich habe letztens einen lokalen Apache Server auf meiner Linuxkiste
> installiert. Leider brechen viele von meinen Skripten (die |brigens
> auf anderen Servern im Internet problemlos laufen) mit der
> Fehlermeldung _Premature end of script headers_ ab. Liegt das am
> falschen Syntax der Skripte, oder sind die Skripte falsch
> konfiguriert.
> 
> Sorry, wenn es wahrscheinlich die x te Frage dieses Themas ist, aber
> ich bin ein absoluter Newbie. Wenn ich wenigstens w|_te, ob es ein
> Perl oder ein Error von Apache ist (also falsch konfiguriert).
If the Perl program runs correctly on other servers and (presumably) from 
the command line, it surely is not a Perl problem.  You might ask in an 
Apache newsgroup.
-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 4 Sep 1998 12:56:22 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Execute END{} at CGI termination?
Message-Id: <MPG.1059e5bc27592b6f989790@nntp.hpl.hp.com>
Yes, I know this may be *only* a CGI question, in which case I'd 
appreciate a pointer rather than simply being aimed at a newsgroup.  (I 
spend enough time in this one already :-)
I initiate a long-running program via CGI from a browser.  When I 
terminate the program via the 'Stop' on the browser, I want to see 
accumulated results.  I have set '$| = 1', put the proper 'print' 
statements into END{}, and set
$SIG{HUP} = $SIG{INT} = $SIG{KILL} = $SIG{TERM} = sub { &END }
Yet the program just dies without executing END{} at all.  I have 
verified by inserting statements that open and print to a mode-0666 debug 
file that the interrupt handlers are not entered, nor is the END{} 
subroutine itself executed.
I thought that END{} was always called on any exit from a Perl program, 
but evidently not in this case.  It *is* called when I run the program 
from the command line, of course.
-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 4 Sep 1998 16:02:40 -0500
From: schout@rsn.hp.com (Michael Schout)
Subject: Re: Execute END{} at CGI termination?
Message-Id: <6spkhg$75i@starchair.rsn.hp.com>
In article <MPG.1059e5bc27592b6f989790@nntp.hpl.hp.com>,
>I initiate a long-running program via CGI from a browser.  When I 
>terminate the program via the 'Stop' on the browser, I want to see 
>accumulated results.  I have set '$| = 1', put the proper 'print' 
>statements into END{}, and set
Pressing stop on the browser does not necessarily mean that you killed the
CGI process.  All it means is that you are stoping your request.  Many web
servers buffer CGI output, so that you wont see *any* results until the 
CGI program exits.  If you have pressed the stop button before this happens,
then when the server is finally ready to send the output to you, it flushes
the buffer.  However, you have already closed the connection by pressing stop.
If you are running apache, then 1.3.1 is supposed to do better with this and
will flush CGI as soon as data comes in.  This should allow you to see the
results as they come in, instead of having to wait for all of the results.
If you are not running apache, then you will have to consult your servers
documentation on how to make it not buffer cgi output.
Regards,
Mike
------------------------------
Date: Fri, 4 Sep 1998 14:44:50 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Execute END{} at CGI termination?
Message-Id: <MPG.1059ff31c2f77ec3989792@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and a copy mailed.]
In article <6spkhg$75i@starchair.rsn.hp.com> on 4 Sep 1998 16:02:40 -
0500, Michael Schout <schout@rsn.hp.com> says...
> In article <MPG.1059e5bc27592b6f989790@nntp.hpl.hp.com>,
> >I initiate a long-running program via CGI from a browser.  When I 
> >terminate the program via the 'Stop' on the browser, I want to see 
> >accumulated results.  I have set '$| = 1', put the proper 'print' 
> >statements into END{}, and set
> 
> Pressing stop on the browser does not necessarily mean that you killed the
> CGI process.  All it means is that you are stoping your request.  Many web
> servers buffer CGI output, so that you wont see *any* results until the 
> CGI program exits.  If you have pressed the stop button before this happens,
> then when the server is finally ready to send the output to you, it flushes
> the buffer.  However, you have already closed the connection by pressing stop.
Thank you, ex-Convex colleague, but that isn't it.  I just double-checked 
with 'ps -ef' on my server (which runs Netscape FastTrack, not Apache).  
The server writes to the debug file when the program starts, but the code 
in END{} to write to the same file is never executed.  And the process is 
indeed terminated.
As yet another verification, I just let the program run via the web 
server to completion (on a small data set), and the debug file was 
written by END{} correctly.
So I repeat -- is it *possible* that END{} doesn't get executed when the 
program terminates via the browser 'Stop' button?  I have evidence that I 
believe is conclusive that it doesn't.  The server is somehow terminating 
the Perl program such that it doesn't get control back to END{} properly.
My NT IIS server isn't available at the moment, but I'll see if it 
behaves the same there also.
-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 04 Sep 1998 16:46:46 -0400
From: Ala Qumsieh <aqumsieh@tigre.matrox.com>
Subject: Re: exit value lost by system?
Message-Id: <x3yzpcf8v2h.fsf@tigre.matrox.com>
Steven Smith <steves@wco.com> writes:
> 
> I have to be doing something foolish here but I don't see what.  I have
> a perl
> function called by another perl function and $? doesn't contain the
> right
> value upon return.
> 
> Simple scripts to illustrate problem:
> ====== t.pl:
> #!/usr/local/bin/perl
> exit(512);
> ====== t.csh:
> #!/bin/csh
> exit 1;
> ======t1.pl:
> #!/usr/local/bin/perl
> system "t.pl";
> print "$?\n";
> system "t.csh";
> print "$?\n";
> ========file permissions:
> -rwxrwxr-x   1 sjs      sw            20 Sep  2 12:44 t.csh
> -rwxrwxr-x   1 sjs      sw            33 Sep  2 12:34 t.pl
> -rwxrwxr-x   1 sjs      sw            83 Sep  2 12:34 t1.pl
> ======== script output:
> > t1.pl
> 0
> 256
> 
> The csh return value is correct, the perl is not.  What gives?  I get
> the same
> result under both Sun OS and Solaris.  I have perl version 5.004_04.
> 
> Thanks
> Steve Smith
> DSC Communications
> Petaluma, CA.
> 
I got the same results, but I also noticed something else:
Using your *EXACT SAME* files:
aqumsieh@tigre [tmp] <104>% more *
::::::::::::::
t.csh
::::::::::::::
#!/bin/csh
exit 1;
::::::::::::::
t.pl
::::::::::::::
#!/usr/local/bin/perl
exit(512);
::::::::::::::
t1.pl
::::::::::::::
#!/usr/local/bin/perl
system "t.pl";
print "$?\n";
system "t.csh";
print "$?\n";
But with different permissions:
-rw-rw-r--   1 aqumsieh g3dhard       19 Sep  4 16:37 t.csh
-rw-rw-r--   1 aqumsieh g3dhard       33 Sep  4 16:35 t.pl
-rw-rw-r--   1 aqumsieh g3dhard       82 Sep  4 16:42 t1.pl
I get the following:
aqumsieh@tigre [tmp] <103>% perl t1.pl 
65280
65280
Hmmm... I certainly have no explanation! Any one wants to try?
-- 
Ala Qumsieh             |  No .. not Just Another
ASIC Design Engineer    |  Perl Hacker!!!!!
Matrox Graphics Inc.    |
Montreal, Quebec        |  (Not yet!)
------------------------------
Date: Fri, 4 Sep 1998 16:59:50 -0400
From: "Phil R Lawrence" <prl2@lehigh.edu>
Subject: grouping list of ARRAY refs with grep ?
Message-Id: <6spkc5$1s3e@fidoii.cc.Lehigh.EDU>
Hello, witness the following array:
my @beginning_list= (['abc','def','abc'],
                    ['def','abc'],
                    ['ghi','jkl','jkl'],
                    ['jkl','ghi','jkl'],
                    ['mno','pqr']
);
I want to group together those references that share the same 1st two elements (regardless of order) in a new array.  So, output
should be:
(
    [
        ['abc','def','abc'],
        ['def','abc']
    ],
    [
        ['ghi','jkl','jkl'],
        ['jkl','ghi','jkl']
    ],
        ['mno','pqr']
    ]
)
Following is my attempt.  Any hints would be sorely appreciated!
my @grouped_list;
foreach my $ref (@beginning_list) {
    my @temp_group;
    my $comparison_ref = $ref;
    push @temp_group, $comparison_ref;
    # Set this element of beginning_list to empty ARRAY ref
    # so it won't be picked up again later
    $ref = [];
    my $field1 = ${$comparison_ref}[0];
    my $field2 = ${$comparison_ref}[1];
    foreach (@beginning_list) {
        # I want both fields to match before I accept this ref.  I just
        # realized this might erroneously work if there are 2 matches
        # for field1, won't it?
        if (grep /$field1|$field2/, @{$_} > 1) {
            push @temp_group, $_;
            $_ = [];
        }
    }
    push @grouped_list, [@temp_group];
}
Phil R Lawrence
------------------------------
Date: Fri, 04 Sep 1998 21:20:02 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: Help-about install Perl on NT 4
Message-Id: <slrn6v0q2h.56.alastair@calliope.demon.co.uk>
tao Mengtao <mtao@osf1.gmu.edu> wrote:
> After I install the perl 5 forwin32, Whenever I want to run
>the CGI file, it always jump out a frame: Username and passward requird.
>
>
>Enter username for unknown at XXXXXX.
>
>: : What's the matter?
I guess it's a configuration problem with your web server then, nothing to do
with perl. Ask the webmaster or check the docs. Failing that, ask in a news
group devoted to web servers.
HTH.
-- 
Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk
------------------------------
Date: Fri, 04 Sep 1998 15:16:59 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: HTML2PS: problem with JPEG files
Message-Id: <fl_aggie-0409981516590001@aggie.coaps.fsu.edu>
In article <01bdd821$5b5af550$ff80800a@ahlan921>, "Yvan Vandenbogaerde"
<yvan.vandenbogaerde@haven.antwerpen.be> wrote:
+ Corrupt JPEG data: 1 extraneous bytes before marker 0xdb
+ Output file write error --- out of disk space?
You might want to look at the code, and where it opens image files
for ...ummm...input?, you may want to add in:
binmode(HANDLE);
where HANDLE is replaced by the appropriate file handle.
HTH,
James
------------------------------
Date: Fri, 04 Sep 1998 15:29:07 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: If/Then Statement
Message-Id: <fl_aggie-0409981529070001@aggie.coaps.fsu.edu>
In article
<Pine.GSO.3.96.980904112626.23453D-100000@expert.cc.purdue.edu>,
cajun@cyberspace.org wrote:
+ if (!open(MESSAGE, "/export/home/CAM/cam/rm/logs/$job_id"))  
+         {$error = 'Couldn\'t open file log file!';} 
+ Why won't the previous statement set the variable, when the file doesn't
+ exist?
I dunno. Why not use the traditional way:
open(MESSAGE, "/export/home/CAM/cam/rm/logs/$job_id") or $error =
'Couldn\'t open file log file!';
?
James
------------------------------
Date: Fri, 04 Sep 1998 21:11:45 GMT
From: cicero_n@my-dejanews.com
Subject: Re: Is perl millennium compliant ?
Message-Id: <6spl2h$s5c$1@nnrp1.dejanews.com>
Just because we use the term "language" for C and Perl
it does not mean that these rubber chickens have all
the magical properties of their namesakes in nature.
C.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum
------------------------------
Date: Fri, 04 Sep 1998 21:39:14 GMT
From: mmesmer@yahoo.com
Subject: my lousy syntax
Message-Id: <6spmm2$u99$1@nnrp1.dejanews.com>
Someone please help me with the following snippet!  I cannot figure out what's
wrong with it.
Thanks,
Mike
$waiting == 1;
while (! -e "$filepath") {
print '.';
$waiting++;
if ($waiting > 100) {
die;
}
}
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum
------------------------------
Date: Fri, 04 Sep 1998 13:15:09 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: or vs || with open function
Message-Id: <fl_aggie-0409981315090001@aggie.coaps.fsu.edu>
In article <35F00AE8.E644E3C9@cookwood.com>, Liznet@cookwood.com wrote:
+ On page 191 of the 2nd edition Camel, under the explanation for the open
+ function, it says:
+ 
+ "(And you must also be careful to use "or die" after the statement rather than
+ "|| die", because the precedence of || is higher than list operators
like open.)
+ What's the deal?
I'm not sure what you're asking. I think the following might shed some
light for you...
open HANDLE, "some_file" || die $!; # right
open(HANDLE, "some_file") or die $!; # note the use of () on open, also ok
open HANDLE, "some_file" or die $!; # doesn't do what you think it should
Because of the precedence, the last example is evaluated as:
      A                    B
 (open HANDLE) ("some_file" or die $!)
because "or" is weaker than "||", and it tries to evaluate part B as a
conditional statement -- "some_file" or die!. The first example gets
evaluated as:
(open HANDLE, "some_file) || ( die $!)
while the second example works because the evaluation order is explicitly
set with the use of the parens.
I always use the second form of open.
James
When in doubt, parenthesize.  At the very least it will let some poor
schmuck bounce on the % key in vi.
 -- Larry Wall in the perl man page
------------------------------
Date: Fri, 04 Sep 1998 13:21:43 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Parsing XML and HTML (was: Re: Better Regular Expressions)
Message-Id: <fl_aggie-0409981321430001@aggie.coaps.fsu.edu>
In article <904920407.127316@thrush.omix.com>, Zenin
<zenin@bawdycaste.org> wrote:
+         After the fiasco that has been HTML, I think most people will
+         be sticking to the strict XML spec and properly blowing chunks
+         on bad code.
Uh huh. Whether or not the spec is followed strictly will depend greatly
upon the "brilliant minds" at Netscape and Microsloth adhering to the
spec strictly. Their track record in this regard leaves one doubting
such a thing could *ever* happen.
+         I see XML
+         authoring tools and code generators being the norm, which will only
+         help prevent human errors and bad markup.
You mean like the current authoring tools and code generators of HTML
preventing bad markup? and further, who is going to write such tools,
little green guys from Mars? ;)
James
------------------------------
Date: 04 Sep 1998 14:15:04 -0400
From: Chris Maden <crism@oreilly.com>
Subject: Re: Parsing XML and HTML (was: Re: Better Regular Expressions)
Message-Id: <keu32nzqvr.fsf@rosetta.ora.com>
Zenin <zenin@bawdycaste.org> writes:
> Abigail <abigail@fnx.com> wrote:
> :  4) No CDATA declared content.
> :     This makes tokenizing easier, as no knowledge of a DTD is needed
> :     (together with 1) and 2)).
> 
>         I'll have to double check my copy of the spec.  I could have
>         swarn there was CDATA stuff defined.
CDATA declared content is different from CDATA marked sections and
CDATA attributes.  See <URL:http://www.art.com/%7Ejoe/sgml/cdata.html>
for the nasty skinny on this; CDATA has five meanings in SGML; XML
cut it down to two.
-Chris
-- 
<!NOTATION SGML.Geek PUBLIC "-//Anonymous//NOTATION SGML Geek//EN">
<!ENTITY crism PUBLIC "-//O'Reilly//NONSGML Christopher R. Maden//EN"
"<URL>http://www.oreilly.com/people/staff/crism/ <TEL>+1.617.499.7487
<USMAIL>90 Sherman Street, Cambridge, MA 02140 USA" NDATA SGML.Geek>
------------------------------
Date: 04 Sep 1998 14:56:45 -0500
From: "Jim Woodgate" <jdw@dev.tivoli.com>
Subject: Re: Pattern matching specific
Message-Id: <obd89b8xdu.fsf@alder.dev.tivoli.com>
bc <bcgrafx@sprynet.com> writes:
> Is there a pattern match that specifies the characters literally.
> What I need is the 26th through the 31st characters of each line.
> I can't seem to find anything about how to match specific parts of a
> line without
> knowing there content to give pattern by.
perldoc -f substr
-- 
Jim Woodgate 
Tivoli Systems
E-Mail: jdw@dev.tivoli.com
------------------------------
Date: 04 Sep 1998 15:50:51 -0400
From: Ala Qumsieh <aqumsieh@tigre.matrox.com>
Subject: Re: Pattern matching specific
Message-Id: <x3y1zprac84.fsf@tigre.matrox.com>
bc <bcgrafx@sprynet.com> writes:
> What I need is the 26th through the 31st characters of each line.
> I can't seem to find anything about how to match specific parts of a
> line without
> knowing there content to give pattern by.
> Please help
> Thanks
> 
You don't need a regexp for that ..
 % perldoc -f substr
=item substr EXPR,OFFSET,LEN
 
=item substr EXPR,OFFSET
 
Extracts a substring out of EXPR and returns it.  First character is at
offset 0, or whatever you've set C<$[> to (but don't do that).
If OFFSET is negative (or more precisely, less than C<$[>), starts
that far from the end of the string.  If LEN is omitted, returns
everything to the end of the string.  If LEN is negative, leaves that
many characters off the end of the string.
 
If you specify a substring which is partly outside the string, the part
within the string is returned.    If the substring is totally outside
the string a warning is produced.
 
You can use the substr() function
as an lvalue, in which case EXPR must be an lvalue.  If you assign
something shorter than LEN, the string will shrink, and if you assign
something longer than LEN, the string will grow to accommodate it.  To
keep the string the same length you may need to pad or chop your value
using sprintf().
In other words, you want
$fourth = substr $line, 25, 6;
or something like that!
Hope this helps,
-- 
Ala Qumsieh             |  No .. not Just Another
ASIC Design Engineer    |  Perl Hacker!!!!!
Matrox Graphics Inc.    |
Montreal, Quebec        |  (Not yet!)
------------------------------
Date: Fri, 04 Sep 1998 13:48:44 -0700
From: Gregory White - LMMS <gregory.t.white@lmco.com>
Subject: Re: Precompiled perl for solaris 2.5?
Message-Id: <35F0522C.2D09B210@lmco.com>
Philip Le Riche wrote:
> Can anyone point me to (or send me) a precompiled version of Perl5 for
> Solaris 2.5 please? I don't seem to have a dev system.
>
> Thanx - Philip
> --
> =============================================================================
> Philip Le Riche                               Voice: +44 1442 884390
> (Malgre son nom, ce brave homme               Fax:   +44 1442 884854
>  ne parle pas Francais)                       Email: pleriche@uk03.bull.co.uk
> =============================================================================
You can find a version of perl for Solaris 2.5 at the following URL:
        ftp://nce.sun.ca/pub/freeware/perl-5.003.gz
I hope this helps.
Gregory White
Lockheed Martin
Sunnyvale, CA
408-756-4562
------------------------------
Date: Fri, 04 Sep 1998 14:57:21 -0700
From: Art DeBuigny <debuigny@dallas.net>
Subject: Problem installing perl 5.004_04
Message-Id: <35F06240.CC7751EA@dallas.net>
Greetings;
I am having trouble installing perl 5.004_04 on AIX 4.1 using gcc
2.7.2.2
as my C compiler.
Here is the error message I get when I run the make command.
Writing Makefile for DynaLoader
mkdir ../../lib/auto/DynaLoader
The Unsupported function umask function is unimplemented at
 ../../lib/ExtUtils/Install.pm line 247.
make: 1254-004 The error code from the last command is 2.
make 1254-004 The error code from the last command is 2.
Stop.
There are no other apparant error messages.  I searched line 247 and
surrounding lines of code in Install.pm and could find no reason.
Has anyone seen this error before.  Any ideas?
Art DeBuigny
debuigny@dallas.net
------------------------------
Date: Fri, 04 Sep 1998 21:59:00 +0200
From: jan.dubois@ibm.net (Jan Dubois)
Subject: Re: Problem: Opening Word (ack!) doc w/ OLE
Message-Id: <35fa435d.6425769@news2.ibm.net>
[mailed & posted]
Charles Sherman <euschsh@am1.ericsson.se> wrote:
>VB code:
>
>	Application.Documents.Open FileName:="C:\DOCS\MYDOC.DOC"
>
>PERL (I think this would work or some variation):
>	use OLE;
>	$wd = CreateObject OLE "Word.Application.8" || die "CreateObject: $!";
>	$wd->{visible}=1;
>	$wd->Documents->Open('FileName:="C:\DOCS\MYDOC.DOC"'); 
>		#I've tried without '' also
>
>This will launch Word but does not bring up the document.
>If you have any suggestions, ideas, etc. I would like to know.
First suggestion: Please use the Win32::OLE module; it is much more powerful
than the old OLE module. The OLE.pm module in Perl 5.005 is actually only
for backward compatibility (it still allows some "bad style" things that
have been made more regular in Win32::OLE).
  use strict;
  use Win32::OLE;
  my $wd = Win32::OLE->new("Word.Application.8") 
     or die "Could not start Word: " . Win32::OLE->LastError;
  $wd->{Visible} = 1;
  $wd->Documents->Open({FileName => 'C:\DOCS\MYDOC.DOC'});
You should use "use strict". It will give you much better error messages
from the Win32::OLE module too whenever some method/property access fails.
(It also disables the remaining hacks in the Module that we compromised to
still leave in for backward compatibility).
Another thing: $! is not used to report OLE errors. They will be printed
through carp/croak depending on the value of the $Win32::OLE::Warn class
variable. The error is also available through the class method
Win32::OLE->LastError(), which returns a dual valued thing like $!: a string
when used as a string or a number when used as a number.
You have to double up backslashes in strings quoted by '"' because they act
as escape characters. Alternatively you can use single quotes.
Finally, you can use a hash reference as the last argument to a method call
to specify named parameters (this is an extension to the old OLE module; you
would have to use positional parameters only with OLE.pm).
Hope this helps!
-Jan
PS: Don't forget to read the included PODs in the Win32::OLE module and
friends (Win32::OLE:Variant, Win32::OLE::Const etc.).
------------------------------
Date: Fri, 04 Sep 1998 20:56:37 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Question of regex in perl
Message-Id: <35f05107.86891@news.btinternet.com>
On Thu, 3 Sep 1998 22:25:45 -0400, Ronald J Kimball wrote :
>duke <djhwang@lgtel.co.kr> wrote:
>
>> The following is part of my perl script to match a string.
>> 
>> $line =~ m/^From: (\S+).*\(([^()]*)\)/
>> 
>> I like to match a string like
>> "From: yasha@harari.org (the king)" or
>> "From: yasha@harari.org " with the regex.
>
>It appears that you want the \(...\) part of the regex to be optional.
>
>$line =~ m/^From: (\S+).*(?:\([^()]*\))?/;
>
Not forgetting the inner parentheses of course ;-}
However it shouldnt be forgotten that these are not the only forms
that From: lines can take.  At the risk of igniting another E-Mail
parsing thread I tries this:
#!/usr/local/bin/perl
@lines = ("From: yasha\@harari.org (the king)",
          "From: yasha\@harari.org", 
          "From: The King <yasha\@harari.org>"); 
for $line (@lines)
{
   if($line =~ m/^From: (\S+)\s*(?:\(([^()]*)\))?$/)
   {
      $reply_address = $1;
      $from_name = $2;
   }
   elsif ( $line =~ m/^From: (.+?)\s*<([^<>]*)>$/)
   {
      $reply_address = $2;
      $from_name = $1;
   }
   print "To: $reply_address ($from_name) \n";
}
__END__
I couldnt see my way clear to putting it all into one RE but there you
go.
Undoubtedly I have overlooked some other variant or nuance but you get
the idea.
/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 4 Sep 1998 16:46:23 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: running as setuid
Message-Id: <6spjiv$3if$1@monet.op.net>
In article <35E87418.F2E151E2@partitura.com>,
Paul Phillips  <paul@partitura.com> wrote:
>I have seen various references in this group to running a perl program
>as setuid.  I'm afraid that I need some help understanding what this
>means.
Normally, when someone runs a program, It runs with their permissions.
For example, when you run the unix `cat' program, it can examine only
the files that you have permission to read, and not any others.  That
way, you can't `cat' other people's private files.
Sometimes this isn't appropriate.  The usual example is a game that
maintains a high score file.  If you score higher than anyone else,
you need to be record your high score, which means you need to be able
to write to the high score file.  The same is true of everyone.  But
adding world-write permission on the file is wrong, because then
people would be able to modify it arbitrarily and lie about their high
scores.
The solution is the `setuid' permission.  This is a special permission
bit; when it's set on a program file, the program runs with the
permissions of the owner of the program file instead of the
permissions of the person who executed it.
The solution to the score file dilemma is that the score file and the
game executable should be owned by the same user, say `games', and the
game program should be made setuid; now the game runs as user `games',
no matter who is running it, and can modify the score file even,
though the file is not world-writable.
Similarly, the unix `passwd' program, which has to modify the
/etc/passwd file, is setuid root.
You turn on the setuid bit by doing
	chmod u+s file
from the shell, or
	$mode = (stat $file)[2];
	$mode |= 04000;
	chmod $mode => $file;
in Perl.
------------------------------
Date: Fri, 4 Sep 1998 12:52:49 -0700
From: "Ken VanCouvering" <van@venice.dh.trw.com>
Subject: Test language in perl
Message-Id: <6spgd7$mm3$1@cronkite.sp.trw.com>
Are there any examples of BASIC like test languages written in perl?  We
have a language
already in place that is currently implemented by translating to FORTRAN and
compiling.
I would like to replace and extend this by using a perl core for the parse
and eval loop.
Thanks,
Ken VanCouvering
van@venice.dh.trw.com
------------------------------
Date: Fri, 04 Sep 1998 21:39:56 GMT
From: darrenh@efn.org (Darren Hayes)
Subject: Truncation problem when appending arrays in Perl
Message-Id: <35f05d8a.80356869@news.efn.org>
Hello,
I have two arrays, one %form_data, the other %form_data2 which 
I am appending with the command:
%form_data = (%form_data, %form_data2);
However I find that the data originating from %form_data fields is 
truncated at the point where the first space character appears in 
the data. But all data from %form_data2 shows up in the resulting 
array fine (including full sentences with spaces, etc).
Any suggestions on keeping truncation from occurring? Thanks.
Darren
------------------------------
Date: 4 Sep 1998 16:05:47 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: usig a while statement to read from a list and test for condition
Message-Id: <6sph6r$37p$1@monet.op.net>
In article <6sp9ue$cuo$1@nnrp1.dejanews.com>,  <lsgs@my-dejanews.com> wrote:
>Can anyone help me?
Sure.
First, you need to indent your code consistently.  Unless you do that,
you won't be able to see the structure, which means you won't be able
to tell what parts are controlled by what.  Sure, you can figure it
out, but the point of correct formatting that that you don't have to
figure it out, you can just see it, and then you can use your
figureouter for something more important.
So I'm going to fix the indentation on your code.
>if ($query eq "home"){
>  open (DATABASE,"new_data/list.db") || die("Cannot open database: $!");
>  while (<DATABASE>) {
>    @record = split(/\:/, $_);
>    if ($record[0] eq $name and $record[1] eq $passwd) {
>      close ("DATABASE");
>      &display;
>    } else {
>      close ("DATABASE");
>      &noway;
>    }
>  }
>}
You had an extra } at the end, which I took out for you.
Now, it all makes sense for me up to the `else' clause.  On a certain
kind of query, you open the database, and then you're going to process
the database record by record; that's fine.  And then for each record,
you split it into fields, which makes sense.  
Then if the first two fields of the current record match the data
you're looking for, that's a successful query, so you close the
database and display the result, it all makes sense.
But if the current record doesn't match, you close the database and
fail.  That doesn't make any sense!  You should go on to the next
record, and fail only if you run out of records.  The way your program
is now, it only looks at the first record, never at the rest, and it
fails unless the first record matches the input.
So the code should look like this:
>if ($query eq "home"){
>  open (DATABASE,"new_data/list.db") || die("Cannot open database: $!");
>  while (<DATABASE>) {
>    @record = split(/\:/, $_);
>    if ($record[0] eq $name and $record[1] eq $passwd) {
>      close ("DATABASE");
>      &display;
>    }
>  }
>  # No more records -- fail 
>  close ("DATABASE");
>  &noway;
>}
Maybe that's what you thought you were doing?  I'm not sure.
Now, there may be a problem here: This code assmues that the `display'
subroutine is going to print some output and then call `exit', so that
control never returns to the place that called `display'.  But you
didn't show `display', so maybe that's not true, and maybe control
*will* return.  If it does, control will fall out of the `while' loop
and pass to `noway', which presumably isn't what you want.
One way to solve this problem, if it is appropriate to exit the
program after displaying the success message:
>    if ($record[0] eq $name and $record[1] eq $passwd) {
>      close ("DATABASE");
>      &display;
       exit;
>    }
Another way, if the code you showed is part of a `search' function:
>    if ($record[0] eq $name and $record[1] eq $passwd) {
>      close ("DATABASE");
>      &display;
       return 1;   # 1 means success
>    }
Another way, if you want the control to continue to the next block of
code, involves a little more rewriting:
if ($query eq "home"){
  open (DATABASE,"new_data/list.db") || die("Cannot open database: $!");
  $FOUND = 0;
 RECORD:
  while (<DATABASE>) {
    @record = split(/\:/, $_);
    if ($record[0] eq $name and $record[1] eq $passwd) {
      $FOUND = 1;
      last RECORD;
    }
  }
  close ("DATABASE");
  if ($FOUND) {
    &display;
  } else {
    &noway;
  }
}
You might prefer this form anyway, since it's easier to be sure that
the database is always closed.
Hope this helps.
------------------------------
Date: 4 Sep 1998 20:00:11 GMT
From: Dan Nguyen <nguyend7@msu.edu>
Subject: Re: Why does 'lynx' in perl script fail on some servers?
Message-Id: <6spgsb$m51$1@msunews.cl.msu.edu>
L J Stoneman <lee@nospam.dvd-debate.com> wrote:
: It doesn't work on one other, however. It will run from the servers
: command line, but not through a browser request. Debugging reveals that
: the script runs but gets nothing back from the command:
: $htmldoc= `lynx -source $url`;
Try using the LWP::Simple module to retrieve the source code.  It's
lost easier than using the system call.
-dan
-- 
           Dan Nguyen            | There is only one happiness in
        nguyend7@msu.edu         |   life, to love and be loved.
http://www.cse.msu.edu/~nguyend7 |                   -George Sand
------------------------------
Date: Fri, 04 Sep 1998 17:27:51 -0400
From: Steven Tolkin <steve.tolkin@fmr.com>
Subject: Why is 5.005* a pain to switch to safely?
Message-Id: <35F05B57.1411164C@fmr.com>
Zenin (zenin@archive.rhps.org) wrote (and will receive this as email)
>         5.005* being such a major pain to switch to safely (in large
>         systems at least), 5.004 will be with us longer then 4*... :-(
Can you and/or other people provide some details about this.
I was planning on upgrading once the last revision digit dstopped
changing.  What bad things might happen if I do?
Steve
---
Steven Tolkin          steve.tolkin@fmr.com      617-563-0516 
Fidelity Investments   82 Devonshire St. R27C    Boston MA 02109
There is nothing so practical as a good theory.  Comments are by me, 
not Fidelity Investments, its subsidiaries or affiliates.
------------------------------
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 3638
**************************************