[9817] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3410 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 10 21:07:25 1998

Date: Mon, 10 Aug 98 18:00:21 -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           Mon, 10 Aug 1998     Volume: 8 Number: 3410

Today's topics:
    Re: "newgrp" in a Perl script <rootbeer@teleport.com>
    Re: CGI for managing web site??? <rootbeer@teleport.com>
    Re: comp.lang.perl.announce redux <cmcurtin@interhack.net>
        Free Web hosting with CGI/Perl capabilities? PLEASE HEL <dcbel@dr.cgocable.ca>
    Re: Free Web hosting with CGI/Perl capabilities? PLEASE <rootbeer@teleport.com>
    Re: help parsing mail file (Mark-Jason Dominus)
    Re: How to extract HTTP headers sent by a browser that  (brian d foy)
        How to untaint a directory path? kevin@zippy.tnet.com
    Re: How to untaint a directory path? <rootbeer@teleport.com>
    Re: LOCK DATABASE FILES? <rootbeer@teleport.com>
        Named Pipes on NT <player@avoidspam.com>
    Re: Newbie Question About 'for' <jeff@idir.net>
        Perl 5.005 and Linux: make test thestranger@my-dejanews.com
    Re: perl and ftp <rootbeer@teleport.com>
    Re: PERL and HTACCESS <sme@planetpod.com>
    Re: PERL and HTACCESS (brian d foy)
    Re: perl question (please help...) (brian d foy)
    Re: perl script to query QUAKE servers <rootbeer@teleport.com>
    Re: perlfaq - frequently asked questions about Perl (pa (Gary L. Burnore)
    Re: perlfaq - frequently asked questions about Perl (pa <cmcurtin@interhack.net>
    Re: Self-printing code (Jeffrey Drumm)
    Re: strings (Craig Berry)
    Re: strings (Matthew Bafford)
    Re: SUID Perl script (taintperl) blues <rootbeer@teleport.com>
    Re: SUID Perl script (taintperl) blues (Nathan V. Patwardhan)
        Trouble with Perl 5.004_04 on Linux  <jthompso@writeme.com>
    Re: what is this stuff? (brian d foy)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Tue, 11 Aug 1998 00:37:45 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: "newgrp" in a Perl script
Message-Id: <Pine.GSO.4.02.9808101736470.10161-100000@user2.teleport.com>

On 10 Aug 1998, Joseph Bell wrote:

> i know this has been answered before, but i can't find it anywhere on
> the web.

Well, the perl manpages are on the web... :-)

> i would like to be able to change my effective user and group ids
> during the execution of my perl script.  how can I do this?

Look for $( and $) in the perlvar manpage. Hope this helps!

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



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

Date: Tue, 11 Aug 1998 00:02:26 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: CGI for managing web site???
Message-Id: <Pine.GSO.4.02.9808101702050.10161-100000@user2.teleport.com>

On Sun, 9 Aug 1998, Michael Mosher wrote:

> Subject: CGI for managing web site???
> 
> Does anyone know of a script for uploading and deleting files without
> using FTP? I'd like one that's easy to set up.

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

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



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

Date: 10 Aug 1998 20:33:03 -0400
From: Matt Curtin <cmcurtin@interhack.net>
To: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: comp.lang.perl.announce redux
Message-Id: <86r9yonyrk.fsf@scooter.cis.ohio-state.edu>

Randal Schwartz <merlyn@stonehenge.com> writes:

> I write back (in English) to say "hey, CLPA gets
> worldwide distribution -- could you rewrite that in English so more
> people can read it?" and I either get a new English posting, or
> nothing.

I'm not sure this is the Right Thing(tm) to do.  Here's why.

I can read English, Russian, German, and various romance languages
with varying degrees of competence.

However, I am only really _competent_ in English.  I'm "competent
enough" to post in German or Russian.  ("Competent enough" means that
I can be understood, and ask to have my inexpert use of the language
excused on the grounds that I'm learning, and graciously accept
corrections.)  I can't imagine trying to post in French or Spanish,
even though I can usually get the gist of something written in either
of those languages.  I suspect that a lot of folks are in the same
proverbial boat.

So what if someone can read enough English to read the newsgroup, but
not enough to be confident enough to post in English?  Yes, I
understand all of the reasoning behind the non-English-post rejection, 
but it just seems a shame to exclude folks from the party on the
grounds that a smaller group of readers will be able to understand
what they're saying.

The real solution, of course, is to Add More Stuff to Perl so it can
be used as an artificial human language (like Esperanto or Klingon).
Then all of our posts could be in Perl, and everyone, no matter what
their background, would understand.  As long as they know Perl.  And
if they don't, why would they post? :-)

Larry, are you listening?  Perl 6, anyone?

-- 
Matt Curtin cmcurtin@interhack.net http://www.interhack.net/people/cmcurtin/


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

Date: Mon, 10 Aug 1998 18:00:22 -0500
From: "Ryan Belanger" <dcbel@dr.cgocable.ca>
Subject: Free Web hosting with CGI/Perl capabilities? PLEASE HELP
Message-Id: <6qo1n3$cg1$1@nr1.ottawa.istar.net>

Is there someone in here who know where I can get free Web hosting with
CGI/Perl capabitilies in order to set up a CGI/Perl database (Selena Sol's
database and search engine).

Any help is welcome, thank you!




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

Date: Tue, 11 Aug 1998 00:49:50 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Free Web hosting with CGI/Perl capabilities? PLEASE HELP
Message-Id: <Pine.GSO.4.02.9808101742190.10161-100000@user2.teleport.com>

On Mon, 10 Aug 1998, Ryan Belanger wrote:

> Is there someone in here who know where I can get free Web hosting 

Maybe you want to ask this in a newsgroup about the web. 

> with CGI/Perl capabitilies in order to set up a CGI/Perl database
> (Selena Sol's database and search engine).

But, honestly, any sysadmin who lets just anybody install
just any old script with any old configuration for free... 

      (Any parent who lets just anybody feed a child 
       just any old food with any old additives...)

 ...just isn't being very responsible!

Hope this helps!

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



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

Date: 10 Aug 1998 23:19:55 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: help parsing mail file
Message-Id: <6qnv6r$uaa$1@netnews.upenn.edu>

In article <6qnpfr$oqe$1@nnrp1.dejanews.com>,  <jimmyp@marimba.com> wrote:
>I want to pull out the "Subject:" header and the "Content-Base:" header from a
>file with multiple pieces of mail in it.

Here's the straightforward way:

	# Read mail header into hash
	{ my $TAG = '';
	  while (<>) {
	    chomp;
	    last if length == 0;    # Blank line means end of header
	    if (s/^\s+/ /) { # This is a continuation line
	      $HEADER{$TAG} .= $_;
	    } elsif (/([^:]+):\s+(.*)/) {  # Line like  `Foo: bar'
	      $TAG = $1;
	      $HEADER{$TAG} .= $2;  # What is correct for repeated headers?
	    } else {
	      warn "Skipping malformed header line $.:\n\t$_\n";
	    }
	  }
	}
	
	# Now do something with $HEADER{'Subject'}
	# or $HEADER{'Content-Base'}


But there's another approach that might be more appropriate in some
circumstances:

	{ local $ = "";
	  $header = <INPUT>;  # Read entire header
	}

	# Amaze your friends; confound your enemies!	
	@header_lines  = split /^(?!\s)/m, $HEADER;  # LOD
	
	# Each header line is now in a separate array element
	# Deal with array elements normally.

This second one was inspired by Abigail; I remarked once that I had
never seen a use for (?!...), and she came up with this application
immediately.

>I tried to use mail-tools and just extract the info via pop3 but I couldn't
>figure that one out either.

In general, it's better to show what you tried, and then to say what
it did that you didn't like.  Otherwise you run a big risk of gettnig
blown off completely.


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

Date: Mon, 10 Aug 1998 20:47:08 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: How to extract HTTP headers sent by a browser that use SSL?
Message-Id: <comdog-ya02408000R1008982047080001@news.panix.com>
Keywords: from just another new york perl hacker

In article <6qn8du$tv1$1@nnrp1.dejanews.com>, techbull@mailexcite.com posted:

>My question is, short of hacking the browser code and print
>out the HTTP headers, is there any tools that I can readily
>use to print out the HTTP headers sent out by a browser to
>a web page using SSL?


LWP should be able to handle this for you.

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: Mon, 10 Aug 1998 23:02:27 GMT
From: kevin@zippy.tnet.com
Subject: How to untaint a directory path?
Message-Id: <6qnu63$v2j$1@nnrp1.dejanews.com>

I'm looking for a simple way to get around a tainted problem
with Perl.

I know the implications of tainted data but in this case it is running
on a server that has no users allowed on it, is run from a set command
that cannot be modified and generates its own ending filename using
the directory supplied.

How do I get the directory name supplied to be untainted but leave it
intact.

Below is a sample (striped down) version of that program.

It would be called from an alias like:

        maillist1:      "|/usr/local/storemail/storemail /www/archives/test"

Note that the directory could be a wide variety of locations, depths
etc...

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#!/usr/bin/perl
$PGMPATH = "/usr/local/storemail";

$ENV{'PATH'} = '/bin:/usr/bin:/usr/lib:${PGMPATH}';
$ENV{'IFS'} = '' if $ENV{'IFS'} ne '';

$< = $>;

chdir "${PGMPATH}";

# get directory from command line
$directory = shift(@ARGV);

#need to untaint the directory name given somehow...

print "Directory Name: $directory\n";

# Create a filename using the directory and the counter we have stored
$counter = &getcounter;
$filename = "$directory/$counter";

print "Filename: $filename\n";

# Now open the file for output
open (OUTFILE, ">$filename") ||
        die "unable to open $filename\n";

# Take stdin, process each line and store it
while (<>) {
        $result=&process_info($_);
        print OUTFILE $result;
}
close(OUTFILE);
exit(0);

# subroutines below

# This routine would do the processing of the data and reformat it
# into its proper content.  We are just in this example setting it
# to what it was originally
sub process_info {
        local($workstring) = @_;
        return($workstring);
}

# This routine would get the next counter number from a file, increment
# it and the write it back out and return the new number.  It would
# have file locking etc...
sub getcounter {
        return (1);
}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

I've looked at the manual examples etc... but am very poor at pattern
matching...  The path supplied would always be a direct path like
/www/htdocs/testarea/archive  it would never have redirections in
it like ../../etc  .

I have the same problem when I lookup directory paths from say a database
that I have created for that purpose.

Using Perl 5.003  and Perl 5.004_01 for what its worth.

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


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

Date: Tue, 11 Aug 1998 00:41:45 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: How to untaint a directory path?
Message-Id: <Pine.GSO.4.02.9808101738520.10161-100000@user2.teleport.com>

On Mon, 10 Aug 1998 kevin@zippy.tnet.com wrote:

> I'm looking for a simple way to get around a tainted problem
> with Perl.

The perlsec manpage comes to mind. :-)

> I've looked at the manual examples etc... but am very poor at pattern
> matching...

Here's hoping you get better soon! (Read the perlre manpage, and maybe
also chapter seven of the Llama book.) Good luck!

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



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

Date: Tue, 11 Aug 1998 00:21:43 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: LOCK DATABASE FILES?
Message-Id: <Pine.GSO.4.02.9808101719500.10161-100000@user2.teleport.com>

On Mon, 10 Aug 1998, Sleepy_Z wrote:

> I am writing a database file that will only be READ and not WRITTEN
> to. Do I need to lock that database or will it be ok without it?

If it's never being changed, why lock it? Of course, there's nothing
Perl-specific about this; any good book on Unix (or any other operating
system) should tell you about this. Hope this helps!

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



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

Date: Mon, 10 Aug 1998 23:53:55 GMT
From: "R. Player" <player@avoidspam.com>
Subject: Named Pipes on NT
Message-Id: <01bdc4ba$f3e5b280$8cb3ba9b@tlabs-raj>

Does anyone know how to create a named pipe in perl on NT....are named
pipes even supported
on NT-Perl.

Thanks


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

Date: Tue, 11 Aug 1998 01:45:26 GMT
From: "jeff robertson" <jeff@idir.net>
Subject: Re: Newbie Question About 'for'
Message-Id: <WmNz1.276$gI1.257208@newsfeed.slurp.net>

Larry Rosler wrote in message ...
>Mike Stok has answered historically.  Stylistically, it is probably wise
>to use 'foreach' to introduce iteration over a list, and 'for' to
>introduce a C-style 'for' loop.  That way, your eye (and those of other
>readers, for this is the way it's typically documented and taught) will
>expect the two semicolons for 'for' but not for 'foreach'.


Of course, foreach is so versitle that I only use C-style in rare cases.






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

Date: Mon, 10 Aug 1998 23:24:53 GMT
From: thestranger@my-dejanews.com
Subject: Perl 5.005 and Linux: make test
Message-Id: <6qnvg4$104$1@nnrp1.dejanews.com>

Hi:

Though 5.005 seemed to compile ok, I got most of the tests under /t/lib failed
with references to DynaLoader.

Someone suggested that perhaps gcc 2.7.2.1 is not ok. Any other Linux people
encounter this?

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


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

Date: Mon, 10 Aug 1998 23:48:48 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: perl and ftp
Message-Id: <Pine.GSO.4.02.9808101646060.10161-100000@user2.teleport.com>

On Sun, 9 Aug 1998, sam ansari wrote:

> Do you know of a way to redirect perl to launch ftp from a special
> directory, either by specifying the full path somewhere in the perl
> script or by modifying the ftplib.pl to point to the proper directory.

Why not use a module that does the FTP directly, rather than running an
external program? Look for Net::FTP on CPAN. Hope this helps!

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



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

Date: Mon, 10 Aug 1998 16:54:53 -0700
From: Stewart Eastham <sme@planetpod.com>
Subject: Re: PERL and HTACCESS
Message-Id: <35CF884C.752F8F36@planetpod.com>

> >I am trying to get a user through a .htaccess protected directory
> >through PERL.  (i.e.  I want to have the user enter their name and
> >password into a HTML form instead of the htaccess pop-up box.).  Is this
> >possible?
>
> yes. did you have another question about it?

The follow-up question would be, then, HOW does one do it?

> >The other thing I am wondering, along the same lines, is it possible for
> >PERL to retrieve the name and password that a user has entered into a
> >.htaccess pop-up box?  Then, based on their login, I could output a
> >page, through a PERL script, with conditional outputs.
>
> with mod_perl you can get both.

I downloaded the mod_perl module, but couldn't quite figure out how to use it
to serve my purposes.  I also downloaded the HTTPD module, which seemed to
have something related to authenticating .htaccess user through PERL, as
well.  Again, though, I couldn't figure out which code is directly applicable
to what I need to do.

Any sample code would be greatly appreciated.  Thanks

stewart eastham
sme@planetpod.com



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

Date: Mon, 10 Aug 1998 20:45:41 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: PERL and HTACCESS
Message-Id: <comdog-ya02408000R1008982045410001@news.panix.com>
Keywords: from just another new york perl hacker

In article <35CF884C.752F8F36@planetpod.com>, Stewart Eastham <sme@planetpod.com> posted:

>> >I am trying to get a user through a .htaccess protected directory
>> >through PERL.  (i.e.  I want to have the user enter their name and
>> >password into a HTML form instead of the htaccess pop-up box.).  Is this
>> >possible?
>>
>> yes. did you have another question about it?
>
>The follow-up question would be, then, HOW does one do it?


>I downloaded the mod_perl module, but couldn't quite figure out how to use it
>to serve my purposes.  

read more about the mod_perl stuff and its hooks into the Apache
API.  all the informantion you need in in the mod_perl documentation.

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: Mon, 10 Aug 1998 19:27:31 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: perl question (please help...)
Message-Id: <comdog-ya02408000R1008981927310001@news.panix.com>
Keywords: from just another new york perl hacker

In article <01bdc4a6$41206820$763a73c2@web-1>, "Alexander Zurhorst" <zurhorst@aol.com> posted:

>1.Is it possible to have a script, which shows you informations about your
>hard disc (e.g. free space) and more important:

   /bin/df -k

>2. show all programs running (like the taskmanager) a.) on a single
>computer
>                                                b.)in a network
>(I need a perl script, which counts all open CAD-programs...)

   /bin/ps -ef | grep CAD | wc -l

of course, the grep CAD finds itself, so the number is one less than
the printed value.

or perhaps you had a different problem, like:

   i need to count the number of computers using a software
   product at one time.  these are linux boxen on a TCP
   network.

perhaps there is additional information which would allow for
more helpful responses? :)

-- 
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: Tue, 11 Aug 1998 00:18:46 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: perl script to query QUAKE servers
Message-Id: <Pine.GSO.4.02.9808101715570.10161-100000@user2.teleport.com>

On 10 Aug 1998, Brad McCready wrote:

> Subject: perl script to query QUAKE servers

> i have seen a couple of good c++ programs to do the same thing. im
> thinking these are probably better because they could do multiple
> servers at a time(dunno if u can do that in perl) 

Why wouldn't Perl be that capable? :-)  It sounds like basic socket
programming - which, of course, isn't all that basic. But you could
download some socket-using modules from CPAN and see how it's done. Hope
this helps!

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



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

Date: Mon, 10 Aug 1998 23:47:45 GMT
From: gburnore @d a t a b a s i x . c o m   (Gary L. Burnore)
Subject: Re: perlfaq - frequently asked questions about Perl (part 0 of 9)
Message-Id: <35cf85ed.26946597@nntpd.databasix.com>

On Fri, 07 Aug 1998 11:20:45 -0400, in article
<pudge-0708981120450001@192.168.0.3>, pudge@pobox.com (Chris Nandor) wrote:

>In article <6qf2ib$9hv$2@csnews.cs.colorado.edu>, tchrist@mox.perl.com
>(Tom Christiansen) wrote:
>
>#  [courtesy cc of this posting sent to cited author via email]
># 
># In comp.lang.perl.misc, pudge@pobox.com (Chris Nandor) writes:
># :No, on our GUI platforms we often use editors for viewing arbitrary
>text files.
># 
># That's a silly idea.  Why would you use an editor when you aren't editing?
>
>Why not?  I don't see why it makes one jot of difference.
>
>
># That's as stupid as using a web browser to read mail.  Of course, I guess
># on those platforms, you do that, too. :-(
>
>No, I don't.  But it not similar, anyway.  Web sites and mail are two
>different things.

You're starting to get it.  Web and email aren't the same thing. Usenet and
web aren't the same thing. Usenet and email aren't the same thing.

-- 
      I DO NOT WISH TO RECEIVE EMAIL IN REGARD TO USENET POSTS
---------------------------------------------------------------------------
                  How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore                       |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
                                      |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
DOH!                                  |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
                                      |  ][3 3 4 1 4 2  ]3^3 6 9 0 6 9 ][3
Special Sig for perl groups.          |     Official Proof of Purchase
===========================================================================


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

Date: 10 Aug 1998 20:12:06 -0400
From: Matt Curtin <cmcurtin@interhack.net>
To: Peter A Fein <p-fein@uchicago.edu>
Subject: Re: perlfaq - frequently asked questions about Perl (part 0 of 9)
Message-Id: <86u33knzqh.fsf@scooter.cis.ohio-state.edu>

Peter A Fein <p-fein@uchicago.edu> writes:

> I'm not, but thanks for the trip back to grade school.  Usually
> though, the FAQ is for the newsgroup itself, not the topic of the
> newsgroup.

Nope.  Check the cryptography-faq.  Very little has to do with the
newsgroup itself.

-- 
Matt Curtin cmcurtin@interhack.net http://www.interhack.net/people/cmcurtin/


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

Date: Tue, 11 Aug 1998 00:03:21 GMT
From: drummj@mail.mmc.org (Jeffrey Drumm)
Subject: Re: Self-printing code
Message-Id: <35d08868.115531446@news.mmc.org>

On 10 Aug 1998 22:34:43 GMT, mjd@plover.com (Mark-Jason Dominus) wrote:

>For your amusement and edification, I present the following file,
>which, when installed in /tmp/p and executed by Perl, emits its own
>source code on the standard *error*:
>
>
>-------------------------------- BEGIN FILE
>Illegal division by zero at /tmp/p line 1.
>-------------------------------- END FILE
>
>% perl /tmp/p
>Illegal division by zero at /tmp/p line 1.
>
>%

Not so cut 'n' dried on Win32[1]. But that's not your fault. :-)

C:\>echo Illegal division by zero at /tmp/p line 1. > \tmp\p
C:\> perl \tmp\p
Illegal division by zero at \tmp\p line 1.
                            ^   ^
This works, though:

C:\>perl /tmp/p
Illegal division by zero at /tmp/p line 1.

A minor sticking point, but I *think* you ought to be able to use a
platform's commonly accepted path/file naming conventions to create the
file that you used to execute it . . . and the echo statement above doesn't
work if you use forward slashes.

Interesting approach . . . though it's not *really* printing its own source
code, but an amazing simulacrum!

[1] As opposed to a *real* OS

Regards,

-- 
                           Jeffrey R. Drumm, Systems Integration Specialist
                                  Maine Medical Center Information Services
                                     420 Cumberland Ave, Portland, ME 04101
                                                        drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented." -me


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

Date: 10 Aug 1998 23:32:34 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: strings
Message-Id: <6qnvui$hfj$1@marina.cinenet.net>

Mark-Jason Dominus (mjd@plover.com) wrote:
: In article <6qnk39$508$1@marina.cinenet.net>,
: Craig Berry <cberry@cinenet.net> wrote:
: >Seriously, I think it's a reasonable goal that, where possible, code and
: >data *should* use the same formats and conventions.  And, indeed, I've
: >often wished that 077 and 0xCA in input data would parse as octal and hex
: >respectively.
: 
: I don't think you've thought this through.  It would be an incredible
: disaster.  You'd be reading in your file of zip code, and you'd get to
: 
: 	TPJ,POB 54,Boston,MA,02101
: 
: and you'd discover that the zip code had been interpreted as `1089'.

Well, one could argue that the zip code should be treated as a string
value, not a numeric value.  If treated as a string, the original
representation would be retained.  Only if the zip code were treated as an
operand in a numeric operation would the conversion occur.

But I agree in the general case that this could cause some very serious
problems.

: As you pointed out, Lisp does have such features---all invoked through
: explicit conversion functions of one kind or another.  The most
: powerful and well-known of these conversion functions is `eval'.

I was referring (a bit elliptically, true) more to Lisps use of list
representation for both data and code, and the resulting easy blurring of
the two.  The formats for external scalar representation are indeed
subject to similar explicit manipulation in Perl and Lisp. 

: >it's sad how every language and OS become gradually encumbered by the
: >weight of past practice.
: 
: While I would agree with you in general, I think that this is not a
: sad example.  I think this is an example of how a good designer can
: get things right the first time and not have to change them later.

Quite probably so wrt octal and hex interpretations, possibly not so wrt _
as a thousands separator, and certainly a minor enough nit (with easy
enough workarounds) that it does not noticeably dim Perl's brilliant glow. 

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Tue, 11 Aug 1998 01:32:20 GMT
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: strings
Message-Id: <MPG.103960c27a09e5d1989695@news.scescape.net>

In article <6qn6rn$puo$1@news.pop-stuttgart.de> on Mon, 10 Aug 
1998 18:22:54 +0200, Ronald Gvggel (a) felt the following 
information to be of use:
> 
> The problem is not the comma.
> 
> Problem 1 is: you don't use the -w option.
>    -w would tell you: Argument "2,450" isn't numeric in le at ...
> 
> So you can rewrite the code to
> $price = 2,450;
> if ($price <= 99)
>   {
>   ....
>   ....
>   }

The problem _is_ the comma.  Perl automatically changes the 
string to a number, and vice-versa when needed.  IIRC, Perl uses 
something similar (perhaps the very ones?) to C's atoi, atof, etc 
functions, so translation to a number stops at the first non-
digit.  Hence, comparing '2,450' <= 99 is equiv to saying '2' <= 
99, which is, of course, true.

Removing the , from the string works fine (in this example).  

Consider:

#!/usr/bin/perl -w

$_ = '2,450';

if ( $_ < 99 ) {print "(1) Less than 99!\n";}
else           {print "(1) Greater than 99!\n";}

tr/,//d;

if ( $_ < 99 ) {print "(2) Less than 99!\n";}
else           {print "(2) Greater than 99!\n";}

__END__

Gives me:

Argument "2,450" isn't numeric in lt at temp line 5.
(1) Less than 99!
(2) Greater than 99!


Hope this helps!

--Matthew


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

Date: Tue, 11 Aug 1998 00:01:03 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: SUID Perl script (taintperl) blues
Message-Id: <Pine.GSO.4.02.9808101651510.10161-100000@user2.teleport.com>

On Mon, 10 Aug 1998, Andrew Pollock wrote:

> I've got a CGI script that's running setuid root (because it needs to) 

Uh oh, scary! :-)

> and Perl's barfing at the following subroutine 

 ...There's Perl, trying to save you from yourself again...

> saying it's got an insecure dependency (the chown() line):
> 
> sub chown_by_name {
>         local($user, $pattern)=@_;

local instead of my?

>         chown((getpwnam($user))[2,3], <${pattern}>);
> }

Well, what could be the problem there.... Hey! Are you trying to glob?
That's not secure. Go read perlsec again. Tsk tsk tsk. 

And, just for fun, consider what happens if, somehow, $user is the 
empty string. Hmmm.... :-)

Hope this helps!

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



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

Date: 11 Aug 1998 00:06:38 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: SUID Perl script (taintperl) blues
Message-Id: <6qo1ue$76h@fridge.shore.net>

Andrew Pollock (apollock@bit.net.au) wrote:

: I've got a CGI script that's running setuid root (because it needs to) and

Oooo!  What's the URL for your website?  :-)

--
Nate Patwardhan|root@localhost
"Fortunately, I prefer to believe that we're all really just trapped in a
P.K. Dick book laced with Lovecraft, and this awful Terror Out of Cambridge
shall by the light of day evaporate, leaving nothing but good intentions in
its stead." Tom Christiansen in <6k02ha$hq6$3@csnews.cs.colorado.edu>


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

Date: Tue, 11 Aug 1998 00:13:58 GMT
From: Jeremy Thompson <jthompso@writeme.com>
Subject: Trouble with Perl 5.004_04 on Linux 
Message-Id: <35CF8CC5.3E627C17@writeme.com>

I'm trying to compile perl 5.004_04 on Slackware Linux, kernel 2.0.33,
i686, glibc2, egcs-2.90.29.

I am trying to compile new version of perl because after upgrading my
libs (glibc, libstdc++, etc.), my old perl doesn't work anymore.  (This
isn't the first thing I've had to recompile lately . . . )

Anyway, the Configure and make go well, but a number of tests fail
during "make test" -- Here is the output, I filtered out anything that
was "ok", replacing those with "...":

--

 ...
pragma/locale.....FAILED at test 0
 ...
lib/anydbm........FAILED at test 0
 ...
lib/db-btree......FAILED at test 0
lib/db-hash.......FAILED at test 0
lib/db-recno......FAILED at test 0
 ...
lib/filecopy......FAILED at test 6
 ...
lib/filehand......FAILED at test 0
 ...
lib/gdbm..........skipping test on this platform
 ...
lib/io_dup........FAILED at test 0
lib/io_pipe.......FAILED at test 0
 ...
lib/io_sock.......FAILED at test 0
lib/io_taint......FAILED at test 0
lib/io_tell.......FAILED at test 0
lib/io_udp........FAILED at test 0
lib/io_xs.........FAILED at test 0
lib/ndbm..........FAILED at test 0
lib/odbm..........skipping test on this platform
lib/opcode........FAILED at test 0
lib/open2.........FAILED at test 0
lib/open3.........FAILED at test 0
lib/ops...........FAILED at test 0
 ...
lib/posix.........FAILED at test 0
lib/safe1.........FAILED at test 0
lib/safe2.........FAILED at test 0
lib/sdbm..........FAILED at test 0
 ...
lib/socket........FAILED at test 0 

Failed 24 test scripts out of 153, 83.01% okay.
   ### Since not all tests were successful, you may want to run some
   ### of them individually and examine any diagnostic messages they
   ### produce.  See the INSTALL document's section on "make test".
   ###
   ### Since most tests were successful, you have a good chance to
   ### get information with better granularity by running
   ###     ./perl harness
   ### in directory ./t.
make: *** [test] Error 1      

--

I tried running ./perl harness in the ./t directory, but it dumps core.

Anyone have any ideas?  Please e-mail or post here.
             
--
"We have to move fast to do something about
these monkeys because the people here are
scared to death," -- a Japanese official
commenting on an incident where a pack of
wild monkeys swooped down and attacked
passers-by in a Japanese seaside town,
injuring 26 people, January 27, 1998.
--
Jeremy Thompson
mailto:jthompso@writeme.com


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

Date: Mon, 10 Aug 1998 19:38:48 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: what is this stuff?
Message-Id: <comdog-ya02408000R1008981938480001@news.panix.com>
Keywords: from just another new york perl hacker

In article <35cf5a13.9334992@news.es.hac.com>, areeves1@csc.com (Anthony Reeves) posted:

>Hi, I'm reading a file that is produced by a different process.
>
>when I read the file, its got these weird chacters I cannot figure out
>how to get rid of.. 
>
>here is the line that is read and displayed during a debug session:
>
>X line
>
>line = "Time\cIAmt\cIJob\cJ"
>
>the \cI \cJ
>I want to remove, I thought they might be something like a control
>char. so I tryed \033I
>did not work, try \eI
>did not work..


did you try

   s/\cI//g;
   s/\cJ//g;

?

-- 
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: 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 3410
**************************************

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