[9835] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3428 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 12 13:07:54 1998

Date: Wed, 12 Aug 98 10: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           Wed, 12 Aug 1998     Volume: 8 Number: 3428

Today's topics:
    Re: $SIG{ALRM} question <jdporter@min.net>
    Re: ===> Parsing Cobol in Perl scott@softbase.com
        Analyzing HTTP traffic? wayne.pierce@usa.net
    Re: changing access (but not modify) timestamp <jdporter@min.net>
    Re: checking if files exist <tchrist@mox.perl.com>
    Re: formmail.cgi security (brian d foy)
        Free Web Stuff veronica@iminet.com
    Re: I can4t run any perl prog. on my server <jdporter@min.net>
    Re: I can4t run any perl prog. on my server <REPLY_TO_lastronin@earthlink.net>
    Re: IE 4.01 and flush to STDOUT or nonparsed Headers (brian d foy)
    Re: IMPORTANT: Proper Netiquette <jdporter@min.net>
    Re: Latent data on Perl Generated HTML <rootbeer@teleport.com>
    Re: lexically scoped aliases <tchrist@mox.perl.com>
    Re: Mailing List scrip . Help needed (-)
    Re: mkdir <pswaters@eos.ncsu.edu>
    Re: Newbie pattern match question huntersean@hotmail.com
    Re: Newbie Question About 'for' (Michael Rubenstein)
    Re: Perl 5.005.1 core dumps under Irix 6.2 <scotth@sgi.com>
    Re: Perl Style <upsetter@ziplink.net>
    Re: Perl Style <tchrist@mox.perl.com>
    Re: Regexp this! (if possible anyhow...) (Abigail)
        suidperl for NT (William L Harrison)
    Re: Test your Javascript and HTML knowledge birgitt@minivend.com
        Using 2 delim's causing problems? <rosso@rsn.hp.com>
    Re: verify password <aperrin@mcmahon.qal.berkeley.edu>
    Re: What's the most efficient regex to force NOT matchi <mmoreno@cas.org>
    Re: WILLING TO PAY FOR HTML GRABBING SCRIPT. (brian d foy)
    Re: X-file (?=...), case postponed. (Dave Lorand)
    Re: X-file (?=...), case postponed. (Abigail)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Wed, 12 Aug 1998 12:10:28 -0400
From: John Porter <jdporter@min.net>
Subject: Re: $SIG{ALRM} question
Message-Id: <35D1BE74.381E@min.net>

Mark Lybrand wrote:
> 
> Hello again,
> 
> You guys were such a big help with understanding what was being done
> with that "grep" function...
> 
> In any event, in the example script from Lincoln Stein's CGI.pm book,
> located at:
> 
> http://www.wiley.com/compbooks/stein/text/guestbook.txt
> 
> I am having a problem understanding what the following code snippet is
> doing:
> 
> local($msg, $oldsig);
> my $handler = sub { $msg = 'timed out'; $SIG{ALRM} = $oldsig; };
> ($oldsig, $SIG{ALRM}) = ($SIG{ALRM}, $handler);
> alarm($TIMEOUT);
> 
> In the text he states that the anonymous sub only sets the $msg
> variable.  I guess my problem is understanding what is returned by the
> anonymous sub (this would go into $SIG{ALRM}, right?).  So, $oldsig
> takes the value that $SIG{ALRM} had and $SIG{ALRM}???   Also, why are we
> even holding on to the old signal, since the script does not seem to
> return this to $SIG{ALRM} except in the sub.  Is that it?  Does the
> $SIG{ALRM} just stay the same?  In that case... $oldsig gets $SIG{ALRM}
> THEN the sub runs, sets $msg and then $SIG{ALRM} gets set back??  I
> still don't get how that is the return value from the sub.

Would it help any if we rewrote the code like this:

  my $handler = sub { $msg = 'timed out'; $SIG{ALRM} = $oldsig; };

  $oldsig    = $SIG{ALRM};
  $SIG{ALRM} = $handler;

Actually let's write it like this:

  $oldsig = $SIG{ALRM};

  $SIG{ALRM} = sub { 
    $msg = 'timed out'; 
    $SIG{ALRM} = $oldsig;
  };

Now do you see what's going on?
$SIG{ALRM} holds a reference to a subroutine (or possibly some
other special value).  We save off the old value in $oldsig.
We want to restore that value to $SIG{ALRM} when the alarm
signal has been received -- so naturally we put the code that
does that into our signal handler.  The return value of our
handler subroutine is actually irrelevant.

(You do recognize, of course, that the subroutine is anonymous,
and we are using a reference to it, right?  We are not calling
it; we are assigning the reference to $SIG{ALRM}.)

hth,
John Porter


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

Date: 12 Aug 1998 16:32:29 GMT
From: scott@softbase.com
Subject: Re: ===> Parsing Cobol in Perl
Message-Id: <35d1c39d.0@news.new-era.net>

Naji Mouawad (naji.mouawad@cmpx.saic.com) wrote:

> Anyone has written a cobol parser out there?

Don't laugh! -- but: I wrote something that "parsed" COBOL programs
looking for certain keywords and replacing them with canned code.

It was ugly, and Perl is not a good choice for parsing a language like
COBOL. The key problem is COBOL is not line oriented. A statement can
occur over many lines, which means you have to read logical lines in
from the input file and assemble them. Your next problem is where one
statement ends and the next begins. Unlike C and Pascal, there's no
statement ending character. You can literally write code such as "OPEN
BOO WRITE OUTPUT-RECORD" on one line!  You have to have a list of stuff
that can start a new statement, and stuff that can belong to an
existing statement. Very soon, the parser gets hairy. Soon you run into
ifs and other control structures that don't necessarily have an ending
or even a period.  Let's say you want to replace the OPEN statement
with three lines of code and it's in an IF. What do you do? (I don't
remember what I did, but it was ugly and didn't work very well.)

I originally approached the problem as a linear scan from line one to
EOF. That's probably not, in retrospect, a good way to handle it. I
thought I could get by with reading in lines and assembling logical
lines, and handing them off to be processed. If I had it to do all over
again (and I hope I don't), I'd look at some kind of tree-based parser
that builds a tree of logical lines divided into keywords and their
associated arguments/modifiers.

> I have need to parse cobol modules (about 100 of them) and build a
> rather simple symbol table of identifiers.

You don't really need a parser for COBOL code here -- all user-defined
identifiers are in the 01 levels of the data division. You can do a
line-by-line scan for a number between 01 and whatever the max is
(66?), followed by an identifier.

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


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

Date: Wed, 12 Aug 1998 16:19:15 GMT
From: wayne.pierce@usa.net
Subject: Analyzing HTTP traffic?
Message-Id: <6qsfa3$oih$1@nnrp1.dejanews.com>

 I've got a slight problem and would like to know if Perl can help with it.

 What I have to do is scan all HTTP traffic on our network at the firewall
(running BSD) and create log files for each domain.  In the log file for that
domain it will have all the hosts that went there, total number of accesses,
etc. (I haven't been told the full details yet).

 My main question, before I even start to try and write anything, is if there
is a way for Perl to intercept the HTTP traffic.  Because of the box this is
on I don't have the ability to modify anything so it would all have to be
done via the Perl script.  Perl would need to intercept the HTTP traffic,
analyze it, then pass it back to the firewall (without changing the host IP
info).

 If anyone has any pointers or ideas on how this could be done I would be most
grateful.

 Thanks for any help,

Cpl Pierce, Wayne A. Network Engineer Marine Corps Air Station Miramar <a
href="mailto:piercew@NOSPAM.miramar.usmc.mil">piercew@NOSPAM.miramar.usmc.mil
</a

>

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Wed, 12 Aug 1998 12:25:59 -0400
From: John Porter <jdporter@min.net>
Subject: Re: changing access (but not modify) timestamp
Message-Id: <35D1C217.4F41@min.net>

Luis Bernardo wrote:
> 
> I've been looking at past postings and I didn't find what I'm looking for.
> The same applies to FAQ and to my introductory perl book.
> I know how to modify timestamps with utime($atime,$mtime,"file"). But what
> I would like to do is to change the access timestamp without changing the
> modify timestamp. There should be an easy way to do that. Is there?

Of course!  Use the value of mtime from calling stat() on the file.
You'll be setting the file's mtime to the value it already has.

  sub set_atime {
    my( $new_atime, $filename ) = @_;
    my( $dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, 
        $atime, $mtime ) = stat( $filename );
    utime( $new_atime, $mtime, $filename );
  } # returns 1 if succeeded, 0 if failed.

-- 
John Porter


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

Date: 12 Aug 1998 16:36:12 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: checking if files exist
Message-Id: <6qsg9s$r96$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, abigail@fnx.com writes:
:So, I guess either Solaris isn't a reasonable operating system,
:or NFS isn't a traditional filesystem.

The latter.  Well, at least as manifested in the automounter.  But see
my O_EXCL note posted earlier today for other non-traditional special
effects.

--tom
-- 
    "It is easier to port a shell than a shell script."
		--Larry Wall


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

Date: Wed, 12 Aug 1998 13:00:17 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: formmail.cgi security
Message-Id: <comdog-ya02408000R1208981300170001@news.panix.com>
Keywords: from just another new york perl hacker

In article <35D1187A.2C531B6A@nospam.ican.net>, "Mr. mister" <leegala@nospam.ican.net> posted:

>Can anyone help me re: formmail security.
>I'm currently using Matt Wright's 'formmail.cgi' script to handle the
>results of a form to be sent back to me via email. I would like to
>secure this transaction. I can currently secure my web page however
>securing the actual cgi form is another thing.

by design, FormMail is insecure.  you'd have to start from scratch
do fix that.

if you mean that you are trying to use it with https, you need to
have a server set up to do that.  https servers typically run on
port 443 rather than port 80, so if you don't have that server
set up, you could very well get the following error message:

>Currently I get the message back "server not responding or is down,
>contact administrator"

there are many issues in setting up a secure server to do the https
stuff and your system administrator (as per the error message) is
the only person that can help you with that.

unless you want to write your own SSL server.  in Perl.

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Conference Quiz Show <URL:http://tpj.com/tpj/quiz-show>


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

Date: Wed, 12 Aug 1998 15:48:22 GMT
From: veronica@iminet.com
Subject: Free Web Stuff
Message-Id: <6qsdg5$l3p$1@nnrp1.dejanews.com>

This is the new wave on the Internet.  Add interactivity to your site.

Just go to: http://www.321website.com

We are offering a FREE secure shopping cart, bulletin board, calendar, chat
room, database, links organizer, questionnaire/survey, and more - that you can
add FREE to your existing website in seconds!

You are able to offer a "virtual community" to your web visitors, where YOU
are the mayor and YOU control the community.  Your visitors will keep coming
back to your website again and again and again.

If you DON'T have a website now, you may use this site as your primary site.

Thanks!
Internet Media, Inc.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Wed, 12 Aug 1998 12:37:57 -0400
From: John Porter <jdporter@min.net>
Subject: Re: I can4t run any perl prog. on my server
Message-Id: <35D1C4E5.278D@min.net>

Veronica Machado wrote:
> 
> My server doesn4t accept any perl program .
> Does anyone know why ??

Your system administrator might.

But unless you give us more information, such as what you've
tried and what results you got, how can we possibly be
expected to help?  It's not even obvious what you mean by
"accepting" a perl program.

Have you read any of the FAQs which might address your
problem?  In particular, since this smells to me like a
CGI-ish problem, take a look at 
http://www.perl.com/CPAN-local/doc/FAQs/cgi/perl-cgi-faq.html

-- 
John Porter


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

Date: Wed, 12 Aug 1998 12:02:10 -0400
From: "Ha" <REPLY_TO_lastronin@earthlink.net>
Subject: Re: I can4t run any perl prog. on my server
Message-Id: <6qsdln$qfl$1@fir.prod.itd.earthlink.net>

1) what's your server?
2) do you have permission to execute Perl on the server?
3) what's the O/S?
4) anything more specific than "can't run"? you'll be flamed by the hardcore
regulars in this group if  you can't give us more info to go on to help you.

cheers.

Veronica Machado wrote in message <35D18916.C7607C96@nt.com>...
My server doesn4t accept any perl program .
Does anyone know why ??




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

Date: Wed, 12 Aug 1998 12:53:00 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: IE 4.01 and flush to STDOUT or nonparsed Headers
Message-Id: <comdog-ya02408000R1208981253000001@news.panix.com>
Keywords: from just another new york perl hacker

In article <6qrjks$r6a$1@gatekeeeper.teledanmark.dk>, "Michael Skjxtt Kjfr" <mskk@tdk.dk> posted:

>I have a problem with a CGI script on a Unix webserver (Netscape server
>2.0). We are trying to flush stdout to the browser (IE 4.01), but the
>browser wait for the script to finish execute before writing anything in the
>browser. In netscape it works fine. We have following test of what to do.
>Filename nph-demo.pl (nonparsed headers)

last i heard IE4 had internal buffering issues.

however, this isn't really a Perl problem.  the folks in 
comp.infosystems.www.authoring.cgi might be able to help though.

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Conference Quiz Show <URL:http://tpj.com/tpj/quiz-show>


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

Date: Wed, 12 Aug 1998 12:27:36 -0400
From: John Porter <jdporter@min.net>
Subject: Re: IMPORTANT: Proper Netiquette
Message-Id: <35D1C278.3E23@min.net>

Brief Good


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

Date: Wed, 12 Aug 1998 15:56:43 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Latent data on Perl Generated HTML
Message-Id: <Pine.GSO.4.02.9808120853050.10161-100000@user2.teleport.com>

On Tue, 11 Aug 1998, Bob Mariotti wrote:

> We run a secured Netscape server using perl 5.004 for our .cgi scripts.
> Very infrequently only one group of clients report that they are
> receiving data on the delivered dynamic html page that is not theirs.

Must be a bug. :-)

> A request is made via a form.  The form is parsed by a perl cgi
> script.  The script fabricates a request string which is passed to a c
> program which communicates with the client's host computer system
> (separate link).  The c program then passes the returned records back
> to the perl script until an EOF is received (the perl will keep
> reading).

Could there be a concurrency issue in there somewhere? That is, what
happens if two users are more-or-less simultaneously submitting this
form?

Of course, there's nothing Perl-specific about this. You would be having
the same troubles if your programs were all written in any other language.
You may be able to get more help about this in a web-related newsgroup.  
Good luck!

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



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

Date: 12 Aug 1998 16:39:47 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: lexically scoped aliases
Message-Id: <6qsggj$r96$3@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Niklas Matthies <matthies@fsinfo.cs.uni-sb.de> writes:
:Is it somehow possible to create lexically scoped aliases, 

No.

:i.e. what
:one might expect that 
:
:  my *foo = \$bar;
:
:would do if it were legal?

Using local there is not particularly dangerous, considering
that only $foo is changed, not all *foo.

You do need to come to grips with references, though,
and eschew them not, for these ugly symbol table games
will not always avail you.

--tom
-- 
You know, by the time you get done with all this, the "Swiss Army
Chainsaw" is going to be more like a Swiss Army Tactical Nuke....  :-)
    --Brandon Allbery on perl in <1991Feb21.002412.20045@NCoast.ORG> 


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

Date: Wed, 12 Aug 1998 16:33:03 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: Mailing List scrip . Help needed
Message-Id: <35d1c3b4.88115674@news2.cais.com>

frederic <fredjoua@club-internet.fr> Said this:

>Il s'agit d'un message multivolet au format MIME.
>--------------82B206A73E23C532060E620E
>Content-Type: text/plain; charset=us-ascii
>Content-Transfer-Encoding: 7bit
>
>Hi,
>
>Could you recommend me a good mailing list script for :
>- a moderated list
>- that makes possible for the administrator to group sevral messages
>posted in only one message that will be dispatched to the members of the
>list.
>

Majordomo




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

Date: Wed, 12 Aug 1998 11:40:32 -0400
From: TeXaS <pswaters@eos.ncsu.edu>
To: Martin <minich@globalnet.co.uk>
Subject: Re: mkdir
Message-Id: <Pine.SOL.3.96.980812113707.10515A-100000@cc01du.unity.ncsu.edu>

On Wed, 5 Aug 1998, Martin wrote:

> $absdir = "/www/Data/$FORM[$bus]";
> open(NEWDIR,"|$make $absdir");
>   print NEWDIR $absdir;
> close(NEWDIR);
> 
This is what I have done (I've used it for reading files, not creating
directories, but should work either way:

change $make $absdir ==> $make '$absdir'

The only thing you have to be careful of is that you are not closing a
quotation by using this.  ie:  '$make '$absdir'' would look as two
separate delimited fields, but "$make '$absdir'" should be fine.

Hope this helps

+-----------------------------------------------------------------------+
 Trey Waters                                       pswaters@eos.ncsu.edu
                  "Never meddle in the affairs of dragons
                 for you are crunchy and good with ketchup."
+-----------------------------------------------------------------------+



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

Date: Wed, 12 Aug 1998 16:37:01 GMT
From: huntersean@hotmail.com
Subject: Re: Newbie pattern match question
Message-Id: <6qsgbd$qq6$1@nnrp1.dejanews.com>

In article <6qs9i9$4oq$1@nnrp1.dejanews.com>,
  huntersean@hotmail.com wrote:
> In article <ianExJJF6.H8t@netcom.com>,
>   ian@netcom.com wrote:
> > Gentle-people,
> >
> > I'm having a problem understanding a simple RE in the following
> > script.  I can workaround, but I'd really like to know what
> > I'm missing.  If anyone has a few minutes to aid my perl
> > skills, my gratitude shall overfloweth.
> >
> > What I'm trying to do is grab the facility being logged
> > from syslog and summarize.  1st attempt:
> >
> > while ($line=<SYSLOG>) {
> >    # Split the line into chunks based on spaces
> >    ($a,$b,$c,$d,$_)=split " ",$line;
> >    # Grab the facility
> >    /(.*)\[?.*\]?:/;
> >    $list{$1}.=$line;
> >    $count{$1}+=1;
> > }
> >
> > Aug  9 23:59:00 embarcadero syslogd: restart
> > $1=syslogd
> > Aug  9 23:59:00 embarcadero sendmail[52795]: AA52795: message-id ...
> > $1=sendmail[52795]
> >
> > the (.*) is too greedy - I want to discard the [52795] part.
> > however, changing the RE to /(.*)?\[?.*\]?:/ makes no diff and
> > /(.*?)\[?.*\]?:/ gives
> >
> > Aug  9 23:59:00 embarcadero syslogd: restart
> > $1=
> > Aug  9 23:59:00 embarcadero sendmail[52795]: AA52795: message-id= ...
> > $1=
> >
> > I have the feeling that whatever I'm missing is something basic...
> >
> > any clues, pointers to faq's (already consulted perlre, but
> > obviously don't understand it :-( ) very welcome.
> >
> > thanks,
> > ian
> >
> > ---
> > (The following is ugly, but has the benefit of working...
> [..snippage..]
>
> Your problem is that you need non-greedy matching.  I think that's what you
> thought you were doing, but you've got your "?" in the wrong place.  You need
> /(.*?)(?:\[.*\])?:/
>
> Notice I made a small change to the second half too.  This half (starting
> with "(?:" just means "match one or none of the whole "[...]" bit, and chuck
> away the results".  My whole regexp means something like "Match as much as
                                                                     ^^^^
Err... I meant "match as _little_ as you can".  Oh dear! So much for attaining
guruhood 8^)


Sean H

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Wed, 12 Aug 1998 16:08:10 GMT
From: miker3@ix.netcom.com (Michael Rubenstein)
Subject: Re: Newbie Question About 'for'
Message-Id: <35d1ba48.142111044@nntp.ix.netcom.com>

On 11 Aug 1998 13:50:20 +0930, Martin Gregory
<mgregory@asc.sps.mot.com> wrote:

>lr@hpl.hp.com (Larry Rosler) writes:
>
>> In article <martimer-1008980812070001@pool-207-205-143-51.rvdl.grid.net> 
>> on 10 Aug 1998 13:09:25 GMT, Martin Gallo <martimer@mindspring.com> 
>> says...
>> > I just started with Perl over the weekend (I have been programming off and
>> > on since 1980), and cannot understand why the simple program:
>> > 
>> > for ($a=1,$a<7, ++$a) {
>> > print $a,"\n"
>> > }
>> 
>> Try using semicolons instead of commas.  What you have specified is a 
>> "foreach" loop ("for" and "foreach" are synonyms) consisting of the three 
>> items $a = 1, $a < 7, ++$a.  These are evaluated before the looping 
>> begins, so the value of $a is 2.  This is then printed three times, once 
>> for each element of the list.  No surprise, but not what you wanted, 
>> either.
>
>
>I read this and thought "Bah hah - that's funny, but now I get it!"
>
>Then I did this:
>
>  perl -e 'for ($a=1, $a < 7, $a++){print;}'
>
>Then I was confused again.  
>
>Can you predict what this prints?
>
>If you didn't predict it correctly, can you now explain why it does
>what it does?

I must confess that I didn't predict it, but this behavior is
documented.

>From perlop, the result of $a=1 is an lvalue.  It assigns 1 to a, but
its value is $a, not 1.  In most contexts this doesn't matter, but
here it does.  Since $a has value 1, $a < 7 and $a++ both have value 1
and the latter also sets $a to 2.

>From perlsyn, this form of for iterates through the list.  It doesn't
successively evaluate the expressions, but first constructs the list.
>From the above, the list is ($a, 1, 1).  Since $a now has the value 2,
the loop prints 211.
--
Michael M Rubenstein


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

Date: 12 Aug 1998 09:21:03 -0700
From: Scott Henry <scotth@sgi.com>
Subject: Re: Perl 5.005.1 core dumps under Irix 6.2
Message-Id: <yd8emumi32o.fsf@hoshi.engr.sgi.com>

>>>>> "O" == Oliver Laumann <net@informatik.uni-bremen.de> writes:

O> Has anybody managed to successfully compile Perl 5.005.1 under Irix
O> 6.2 using cc -n32 (on an IP-22 machine)?

Most definitely. What compiler version are you using? Perl found
some optimizer bugs in pre-7.2.1 compilers, one of them during the
5.005 alphas. The fix made it into the 7.2.1 compilers.. As long as
you didn't override the hints file, which reduces optimization for
the cases which were tested...

There is a bug with -DUSE_LONG_LONG and usemymalloc=y on 6.2 (but
strangely, not on 6.5) that I'm trying to track down, though.

O> When I build Perl using all the defaults suggested by Configure, it
O> dumps core (illegal instruction) when running the lib/posix test from
O> the test suite.  In particular, it crashes when executing the lines

O>    # Pick up whether we're really able to dynamically load everything.
O>    print &POSIX::acos(1.0) == 0.0 ? "ok 17\n" : "not ok 17\n";

All my builds on 6.2 and 6.5 pass the test suite (except for the
one case above).

-- 
 Scott Henry <scotth@sgi.com> /  Help! My disclaimer is missing!
 IRIX MTS,                   /  GIGO *really* means: Garbage in, Gospel Out
 Silicon Graphics, Inc      /  http://reality.sgi.com/scotth/


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

Date: 12 Aug 1998 16:17:36 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Perl Style
Message-Id: <6qsf70$6eb@fridge.shore.net>

Tom Christiansen <tchrist@mox.perl.com> wrote:
:  [courtesy cc of this posting sent to cited author via email]

: In comp.lang.perl.misc, Scott.L.Erickson@HealthPartners.com (Scott Erickson) writes:
: :I, for one, believe
: :that using 'or' is much more readable than ||, 

: Do you also believe that `plus' is more readable than `+' comma
: or that `BEGIN' is more readable than `{' question mark

Sorry, Tom. He must have forgotten that There's Only One Way To Do It!

--Art

--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
                  http://www.agitators.com/calendar/
--------------------------------------------------------------------------


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

Date: 12 Aug 1998 16:37:35 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl Style
Message-Id: <6qsgcf$r96$2@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, Scratchie <upsetter@ziplink.net> writes:
:Sorry, Tom. He must have forgotten that There's Only One Way To Do It!

That doesn't mean all ways are equally desirable. And exchanging
all symbolic notation for namby-pamby wordies isn't one of the
desirable ways.

Why don't you just kill file me instead of continuing your whining?

--tom
-- 
Intel chips aren't defective.  They just seem that way.


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

Date: 12 Aug 1998 15:59:07 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Regexp this! (if possible anyhow...)
Message-Id: <6qse4b$oda$3@client3.news.psi.net>

Abigail (abigail@fnx.com) wrote on MDCCCVII September MCMXCIII in
<URL: news:6qr30k$i3o$1@client3.news.psi.net>:
++ 
++ 
++ $regex .= "|(?:[ \t]*KEYWORD[ \t]+(\\w+)[ \t]*\$)";

That should be:

   $regex .= "|(?:^[ \t]*KEYWORD[ \t]+(\\w+)[ \t]*\$)";


Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'


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

Date: 12 Aug 1998 16:23:38 GMT
From: harrison@cs.uiuc.edu (William L Harrison)
Subject: suidperl for NT
Message-Id: <6qsfia$j8$1@vixen.cso.uiuc.edu>


Hi-

	I was wondering if anyone knows of a port of suidperl to Windows
NT? What I have in mind is something that would allow a script to be run
as "Administrator". 

	Please reply via e-mail to harrison@cs.uiuc.edu

			Thanks in Advance,
				Bill
-- 

                  "Right now I'm having amnesia and
                  deja vu at the same time. I think
                  I've forgotten this before."


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

Date: Wed, 12 Aug 1998 16:09:03 GMT
From: birgitt@minivend.com
Subject: Re: Test your Javascript and HTML knowledge
Message-Id: <6qsemv$nf2$1@nnrp1.dejanews.com>

In article <35D084B6.4B26@tekmetrics.com>,
  Mike Russiello <mike.russiello@tekmetrics.com> wrote:
> We have developed separate HTML and JAVASCRIPT tests that will SOMEDAY
> be used to screen job applicants and help employees get rewarded for
> learning (perl is coming soon).

May be the employers will be rewarded with having no employees left
to reward...

Birgitt Funk

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Wed, 12 Aug 1998 11:18:18 -0500
From: Sara Rosso <rosso@rsn.hp.com>
Subject: Using 2 delim's causing problems?
Message-Id: <35D1C04A.585B@rsn.hp.com>

My script takes input from a html/cgi form and then it outputs it as an
on-the-fly html page. (This _IS_ a perl question)

I use one textarea for users to enter checkpoints and their dates,
relating to a project. I have a need of two deliminators (;,|) because I
need to separate the checkpoints from each other, as well as the
checkpoint from its date. 

For example:  Project Assigned|8-10; Project in Progress|8-16; Project
Completed|8-31 will result in a table like this:
Project Assigned     8-10
Project in Progress  8-16
Project Completed    8-31

Right now, my script outputs this, each letter being in a different
column, but it does put them on different lines:
P r o j e c t A s s i g n e d | 8 - 1 0 
P r o j e c t i n P r o g r e s s | 8 - 1 6 
etc.

The script I have so far is this:
sub makemilestones {

$towritemilestones = "\n";
$towritemilestones .= "<p><font face=\"Arial\"
color=\"blue\"><b>Milestones</b><
/font></p>\n";
$towritemilestones .= "\n";
$towritemilestones .= "<table
border=0><tr><td><b>Checkpoint</b><td><b>Date</b><
/tr>";
for $milestones (split /$delim/, $in{'milestones'})
  { 
  $towritemilestones .= "<tr>";
  for $milestoneindiv (split /$delim2/, $milestones)
    {
    $towritemilestones .= "<td>$milestoneindiv</td>";
    }
  $towritemilestones .= "</tr>";
  }
$towritemilestones .= "</table>";
}

I reference this in my main sub by:
print PDSTEMP $towritemilestones;

I also declare the two delim's globally by:
$delim = ';';
$delim2 = '|';

So obviously the ; is working and the | is not. Is there a problem with
using | as a deliminator? Or is it another problem?

I would appreciate any help you can give me - Thanks in advance!
Sara Rosso


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

Date: Wed, 12 Aug 1998 09:29:00 -0700
From: Andrew Perrin <aperrin@mcmahon.qal.berkeley.edu>
To: Craig Nuttall <admin@kewl.com.au>
Subject: Re: verify password
Message-Id: <35D1C2CB.869193D3@mcmahon.qal.berkeley.edu>

My understanding of this is that this is expected behavior -- only root is
allowed to read the shadow file.  If I'm wrong, I'd love to be corrected....

I think the most secure way of dealing with this is to write another little
script that runs as root and can take the password your user is sending as
input, check it against shadow, and return a true or false value.  The reason
for doing it in a separate script is to minimize code running as root.

There's an additional problem that if you just send the password as an argument
to the script, it will show up (albeit for a very short time) in the output of
ps, thus creating a security risk.  If you want to deal with this, I think you
need to use IPC (something like open2) to open a bidirectional pipe between the
two scripts; then you can send the password to be tested over the pipe.

Of course, if you're less concerned with security you can just cross your
fingers and run the whole script as root -- easier but potentially more
problematic.

Andy Perrin

Craig Nuttall wrote:

> I am trying to verify user passwords on a linux system with shadow passwd
> file
> Ultimately, the script will be called from a web form but I have scripted a
> console
> version for the purpose of testing and simplicity.
>
> #!/usr/bin/perl
>
> print "what is your username? ";
> $name = <STDIN>; chomp ($name);
> print "what is your password? ";
> $guess = <STDIN>; chomp ($guess);
>
> $passwd = (getpwnam ($name))[1];
> $salt = $passwd, 0, 2;
>
> if (crypt ($guess, $salt) ne $passwd) {
>         print "the encrypted password for $name is $passwd you guessed
> $guess\n";
>         } else {
>                 print "good guess\n";
>                 }
>
> This works perfectly under a root login, but under any other login, $passwd
> returns "x"
> obviously this is coming from the /etc/passwd file....
>
> the easy fix would be to chmod the shadow file, but I am reluctant to for
> security......
>
> is there a better way ????
> can I make this script run AS root ?????



--
-------------------------------------------------------------
Andrew J. Perrin - NT/Unix/Access Consulting -  (650)938-4740
aperrin@mcmahon.qal.berkeley.edu (Remove the Junk Mail King
http://socrates.berkeley.edu/~aperrin        to e-mail me)
    e-mail wheres-andy@socrates.berkeley.edu to find me!
-------------------------------------------------------------




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

Date: Wed, 12 Aug 1998 11:15:41 -0400
From: Marco Moreno <mmoreno@cas.org>
To: Ilya Zakharevich <ilya@math.ohio-state.edu>, Tom Phoenix <rootbeer@teleport.com>
Subject: Re: What's the most efficient regex to force NOT matching any char? (repost)
Message-Id: <35D1B19D.1438624@cas.org>

Ilya Zakharevich wrote:
> 
> [A complimentary Cc of this posting was sent to Tom Phoenix
> <rootbeer@teleport.com>],
> who wrote in article <Pine.GSO.4.02.9808111605390.10161-100000@user2.teleport.com>:
> > I don't get this. Do you want a pattern that will never match any input?

Yes.

> > If so, use /\b\B/ . I can't say that it's the most efficient pattern ever,
> > but you won't have to wait long for it to fail to match!

I would think that this would be less efficient than [^\x00-\xff] or
(?!.) since \b must read two chararacters before it can decide whether
it is at a word boundary or not.
 
> Hmm, I would use (?!).  Benchmarks welcome.
> 
> Ilya

As I indicated in my original post, I first considered using (?!),
(well, actually (?!.)), but since both fail under 5.004_01 yet work
with 5.005_02, I wondered if it was a 5.004 bug or if the construct
should be avoided.

I'm doing character conversions on very large files so performance is
critical.  I was looking for different ideas and intend to perform
some benchmarks.  I can post the results.

Marco


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

Date: Wed, 12 Aug 1998 12:49:46 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: WILLING TO PAY FOR HTML GRABBING SCRIPT.
Message-Id: <comdog-ya02408000R1208981249460001@news.panix.com>
Keywords: from just another new york perl hacker

In article <6qrd9n$skv$1@nnrp1.dejanews.com>, GBremner@cnbceurope.com posted:

>I wish to grab text from an HTML page that changes periodicaly (yes we have
>permision). We need to only grab selected info from that page ie news
>headlines, its URL,a short paragraph relating to the story and possiblly
>graphics link. This information is then created in a simple text document to
>a predefined format in a directory on our servers. I know that this would be
>a fairly simple scripting procedure, but I am looking for someone with a good
>experiance of cgi to create the above and to offer good support if it doesnt
>work and to provide tech documentation. I am willing to pay some money for
>this simple script. So please contact me if you have any samples or wish to
>discuss this further or even if you can think of a better way to do this.

   #!/usr/bin/perl

   use LWP::Simple qw(get);

   my $data = get('http://foofoo');

   #data munging goes here
   __END__

so what do i win? ;)

seriously though - why is CGI involved in this process?  i have several
such cron-job scripts to grab information on the web and display it on my
personal web page (that only i can see).  saves me the trouble of 
checking 50 separate web pages everyday to get the tiny bits of
info i want out of them.  the only trouble is that web designers
keep mucking with their layouts!

so what's the page and which parts of it do you want to extract?  do
you have a template for where you want tose parts to end up?

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Conference Quiz Show <URL:http://tpj.com/tpj/quiz-show>
sounds like an excuse to play with HTML::Parser.


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

Date: Wed, 12 Aug 1998 15:51:59 GMT
From: davel@spc.uchicago.edu (Dave Lorand)
Subject: Re: X-file (?=...), case postponed.
Message-Id: <davel-1208981051590001@honeybee.spc.uchicago.edu>

[ coutesy copy cc'd to the author ]

In article <6qr68u$jts$1@nnrp1.dejanews.com>, ptimmins@netserv.unmc.edu
(Patrick Timmins) wrote:

> I now know *how* split/(?=(.*))/ works, I'm just wondering *why* it was
> designed so that:
> 
> split/(?=(.*))/s, "Just another Sig\n";
> gives elements of: ('J', 'ust another Sig\n', 'u', 'st another Sig\n', etc)
> 
> instead of the less silly and more sensible elements of:
> ('Just another Sig\n', 'J', 'ust another Sig\n', 'u', etc).
> 
> So I'm not saying I don't understand why it gives the elements it does.
> I'm saying I don't understand why it doesn't work the way you (read 'I')
> would guess it works, since there is nothing in the fine documentation to
> otherwise "tip you off" to this silliness. :)

I'm no Perl guru, but my guess is that the design was aimed more toward
less frivolous null-matching patterns (no offense, Abigail).  If I do a

  split //, 'abcde'

I expect ('a', 'b', 'c', 'd', 'e') - that way I can use this simple
expression to split text into a list of characters.

If the // pattern were to match before the 'a', then I'd get ('', 'a',
'b', 'c', 'd', 'e') and if it matched after the 'e' I'd get another null
list element at the end of the list.  The I'd have to mess around with
something like:

  @arr = split //, 'abcde';

  @arr = @arr[1..$#arr];
  # or
  shift @arr; pop @arr;

Or else:

  ($temp, @arr, $temp) = split //, 'abcde';

All of which clutter up the code.  I can't even do something like:

  @arr = (split //, 'abcde')[1..$#blah]

because there is no $#blah variable for whatever is within the parens. 
And that's messy anyway.

So, my answer to why it's done this way is that it's more useful to those
of us doing simple tasks.  If people want to obfuscate their code, they
should be the ones taking extra steps so that the rest of us don't have
to.

Cheers,

Dave

 ____________________________________________________________
| Dave Lorand                       | davel@spc.uchicago.edu |
| Programmer/Analyst                | 773-702-3792           |
| Social Science Research Computing | 773-702-0793 (dept.)   |
| University of Chicago             | 773-702-2101 (fax)     |
+-----------------------------------+------------------------+


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

Date: 12 Aug 1998 15:45:03 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: X-file (?=...), case postponed.
Message-Id: <6qsd9v$oda$1@client3.news.psi.net>

Patrick Timmins (ptimmins@netserv.unmc.edu) wrote on MDCCCVII September
MCMXCIII in <URL: news:6qr68u$jts$1@nnrp1.dejanews.com>:
++ 
++ 
++ So I'm not saying I don't understand why it gives the elements it does.
++ I'm saying I don't understand why it doesn't work the way you (read 'I')
++ would guess it works, since there is nothing in the fine documentation to
++ otherwise "tip you off" to this silliness. :)


Really? I've posted several times the following from the fine documentation:

   A pattern matching the null string (not to be confused with
   a null pattern C<//>, which is just one member of the set of patterns
   matching a null string) will split the value of EXPR into separate
   characters at each point it matches that way.


It is certainly in the fine documentation. 



Abigail
-- 
perl -wle '$, = " "; sub AUTOLOAD {($AUTOLOAD =~ /::(.*)/) [0];}
           print+Just (), another (), Perl (), Hacker ();'


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

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 3428
**************************************

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