[17622] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5042 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 6 00:05:40 2000

Date: Tue, 5 Dec 2000 21:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <976079109-v9-i5042@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 5 Dec 2000     Volume: 9 Number: 5042

Today's topics:
    Re: [OT] Re: Perl Illiterate (Craig Berry)
    Re: [OT] Re: Perl Illiterate <peter.sundstrom@eds.com>
        ActiveStatePerl and Perl Expect module <lincwils@teleport.com>
    Re: beginner Perl grep Q (Tad McClellan)
    Re: Beginner's question (Chris Fedde)
    Re: Beginner's question <harrisr@bignet.net>
    Re: Calling a CGI Script beforing serving HTML (David Efflandt)
    Re: cgi-lib upload error (David Efflandt)
    Re: DBI insert problem <john@imining.com.tw>
    Re: Help with program (Chris Fedde)
    Re: Howto create setuid/setgid files and directories? (Chris Fedde)
    Re: No such file or directory (David Efflandt)
    Re: Perl Illiterate (Logan Shaw)
    Re: perlcc static? (Martien Verbruggen)
        Problem with split using | (Tom Hoffmann)
    Re: Problem with split using | (Logan Shaw)
    Re: Problem with split using | (Tad McClellan)
        Protecting my Perl script? <berube@odyssee.net>
    Re: references, hashes & arrays <Jodyman@usa.net>
    Re: Regex multiline html (Garry Williams)
        rePOSTing with cookies (Ken Bass)
    Re: resuming? (Logan Shaw)
    Re: Sorting the result of a function (Garry Williams)
    Re: String Manipulation (Garry Williams)
    Re: Submitting a file via a form (David Efflandt)
        tie()ing an entire namespace (Alan Barclay)
    Re: Your help please (Tad McClellan)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 06 Dec 2000 02:07:33 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: [OT] Re: Perl Illiterate
Message-Id: <t2r7r5q52qo64b@corp.supernews.com>

Joe Schaefer (joe+usenet@sunstarsys.com) wrote:
: David Hiskiyahu <David.Hiskiyahu@alcatel.be> writes:
: > There are many interpretations of Perl, the following came to my mind:
: > - Pascal Experiences Record Low,
: > - Pain, Envy, Revenge, Love,
: > - Practical Enormously Rich Language,
: > - Play & Enjoy this Rubbish Lister,
: > - Pinguins Expect Romance & Love
: > - Pathologically Eclectic Rubbish Lister,
: > - Poorly Educated Romantic Lover,
: > - Playing Environment for Rubbish Lovers, 
: 
: - PERL Encourages Recursive Loathing

Provides Employment for Randal and Larry

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "There is no dark side of the moon really.  Matter
   |   of fact, it's all dark."  - Pink Floyd


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

Date: Wed, 6 Dec 2000 16:11:39 +1300
From: "Peter Sundstrom" <peter.sundstrom@eds.com>
Subject: Re: [OT] Re: Perl Illiterate
Message-Id: <90kaps$g2k$1@hermes.nz.eds.com>


Craig Berry <cberry@cinenet.net> wrote in message
news:t2r7r5q52qo64b@corp.supernews.com...
> Joe Schaefer (joe+usenet@sunstarsys.com) wrote:
> : David Hiskiyahu <David.Hiskiyahu@alcatel.be> writes:
> : > There are many interpretations of Perl, the following came to my mind:
> : > - Pascal Experiences Record Low,
> : > - Pain, Envy, Revenge, Love,
> : > - Practical Enormously Rich Language,
> : > - Play & Enjoy this Rubbish Lister,
> : > - Pinguins Expect Romance & Love
> : > - Pathologically Eclectic Rubbish Lister,
> : > - Poorly Educated Romantic Lover,
> : > - Playing Environment for Rubbish Lovers,
> :
> : - PERL Encourages Recursive Loathing
>
> Provides Employment for Randal and Larry

Probably Everybody's Real Language




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

Date: Tue, 5 Dec 2000 19:25:26 -0800
From: "Dennis Wilson" <lincwils@teleport.com>
Subject: ActiveStatePerl and Perl Expect module
Message-Id: <6iiX5.715$V6.79377@nntp3.onemain.com>

Has anyone found this module on Activestate's site? I saw it listed, but
when I tried to get it with ppm, it was not found.

I don't have a C compiler for windows so I am not sure if CPAN is not an
option.

Thanks for any information.




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

Date: Tue, 5 Dec 2000 22:38:19 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: beginner Perl grep Q
Message-Id: <slrn92rd5b.ouu.tadmc@magna.metronet.com>

mike <no_sp@m.for_me.org> wrote:

>I've been having a little trouble getting something worked out and am not
>getting anywhere with the few different ways I've tried.


>    $a = grep(/\$Header: \$.*($file,v)?.*/, $file);
                                        ^^
                                        ^^ that doesn't "do anything"

>along with various permutations but so far I can't get anything to work.
>No matter what I use I get the same result whether or not the RCS keyword
                                ^^^^^^^^^^^
>is in the file.  


And that result would be... what?


>Is there something wrong with my regexp?  


Not that I can see (but that is only half of what you need in
order to evaluate a pattern match problem. The other half is
the string to try and match against).

grep() (Perl) and grep(1) (*nix) are similar but not the same.

grep(1) finds lines in a file that match a pattern.

grep() finds elements in a list that make an expression true
(a pattern match is only one of the many possible Perl 
expressions).


So, Perl's grep searches a list. You need to _have_ a list
before it can be searched. You need to read the file into
a list to do it with grep().

But you do not need (or even want) Perl's grep() for
emulating *nix grep(1). For that you just read the lines
and pattern match:

   # UNTESTED
   open(IN, $file) || die "could not open '$file'  $!";
   while ( <IN> ) {
      print if /\$Header: \$.*($file,v)?/;
   }
   close(IN);

>So either my regexp is wrong (for
>Perl) or I'm not using either grep correctly.


So then you run off and read the description of grep() by 
the very people who wrote perl itself:

   perldoc -f grep

You don't come asking here (until *after* you've spent
a few minutes trying to find it in the standard docs).


-- 
    Tad McClellan                          SGML consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Wed, 06 Dec 2000 02:12:57 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Beginner's question
Message-Id: <JghX5.83$T3.170584064@news.frii.net>

In article <90k6pi$e3i$1@pip.cs.utexas.edu>,
Logan Shaw <logan@cs.utexas.edu> wrote:
>In article <t2r5hb4k7rsp25@corp.supernews.com>,
>Randy Harris <harrisr@bignet.net> wrote:
>>Wolfgang Denk <wd@denx.muc.de> wrote in message
>>news:G549Cp.LG6.7.denx@denx.muc.de...
>>> Nick <square-sun@terra.es> writes:
>>> >Is it possible to get a Perl interpreter to run on a Win98 machine so
>>I
>>> >don't have to go online to test scripts?
>>>
>>> No, that's absolutely impossible.
>>
>>Of course he can get Perl for Win98.  Why would you say that?
>
>Read the rest of the post where he says...
>
>>> You cannot run it on any system when it is not online.
>
>In other words, Mr. Denk was trying to point out the misuse of the
>terminology "on-line".  "on-line" doesn't mean "connected to the
>Internet".  It means "running" or "operational" or "available".
>
>Thus, not having "to go online to test scripts" means not having to
>cause some device to become operational in order to test scripts.
>
>That, of course, is not possible.  You need a functioning computer to
>run Perl scripts.
>

This reminds me of that old joke:

    Perl programmers laugh at a joke three times.
    Once when they hear it,  once when it is explained
    and once when they figure it out.

Gads
chris
-- 
    This space intentionally left blank


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

Date: Tue, 5 Dec 2000 23:42:56 -0500
From: "Randy Harris" <harrisr@bignet.net>
Subject: Re: Beginner's question
Message-Id: <t2rgtceuofkn40@corp.supernews.com>

Logan Shaw <logan@cs.utexas.edu> wrote in message
news:90k6pi$e3i$1@pip.cs.utexas.edu...
> In article <t2r5hb4k7rsp25@corp.supernews.com>,
> Randy Harris <harrisr@bignet.net> wrote:
> >Wolfgang Denk <wd@denx.muc.de> wrote in message
> >news:G549Cp.LG6.7.denx@denx.muc.de...
> >> Nick <square-sun@terra.es> writes:
> >> >Is it possible to get a Perl interpreter to run on a Win98 machine
so
> >I
> >> >don't have to go online to test scripts?
> >>
> >> No, that's absolutely impossible.
> >
> >Of course he can get Perl for Win98.  Why would you say that?
>
> Read the rest of the post where he says...
>
> >> You cannot run it on any system when it is not online.
>
> In other words, Mr. Denk was trying to point out the misuse of the
> terminology "on-line".  "on-line" doesn't mean "connected to the
> Internet".  It means "running" or "operational" or "available".

I don't dispute that the OP phrased his question poorly, in addition to
using an inappropriate Subject. I still don't think, however, that an
appropriate response was inaccurate information, which is what was
supplied.

It's pretty much moot now, other respondents steered him to ActiveState
and CPAN.

RH

> Thus, not having "to go online to test scripts" means not having to
> cause some device to become operational in order to test scripts.
>
> That, of course, is not possible.  You need a functioning computer to
> run Perl scripts.
>
>   - Logan




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

Date: Wed, 6 Dec 2000 03:29:17 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Calling a CGI Script beforing serving HTML
Message-Id: <slrn92rcjt.qbm.efflandt@efflandt.xnet.com>

On Sun, 03 Dec 2000 17:58:08 GMT, Jonaskuh <jonaskuh@tell-em-off.com> wrote:
>I am wondering how, with Apache and Perl, I can require certain
>directories on my webserver to run a CGI script, that I will code to
>check the validity of a cookie and user session, before it will allow
>access to any static HTML page that falls within that directory
>structure? 
>
>It seems like this should be able to be done on Apache, what I'm
>trying to do is get rid of Basic Authenitication all together and use
>custom authentication site wide.

Check out the Action apache directive.  It can run a CGI when there is a
request for a specified handler (like text/html or custom AddHandler)
other than CGI.  It is up to your Action CGI to actually serve up the
requested file.  I believe your CGI gets the URI request path as PATH_INFO
and system path of request as PATH_TRANSLATED, so you can open and print
the file if it passes your 'security' test.

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

Date: Wed, 6 Dec 2000 03:39:46 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: cgi-lib upload error
Message-Id: <slrn92rd7j.qbm.efflandt@efflandt.xnet.com>

On Tue, 05 Dec 2000 03:55:45 GMT, EM <me@privacy.net> wrote:
>the code i use for uploading is
>
>require "cgi-lib.pl";

Since cgi-lib.pl is an old perl4 script that nay not be up to date, you
should really look into the CGI module that comes with any Perl 5.  For
its examples of file upload type:  perldoc CGI

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

Date: Wed, 6 Dec 2000 11:02:59 +0800
From: "John" <john@imining.com.tw>
Subject: Re: DBI insert problem
Message-Id: <90kai8$gc8@netnews.hinet.net>

But when I use 'do' to insert strings more than 255 characters.
It's ok......

Chris Kantarjiev <cak@xxx.putzl.com> wrote in message
news:3A2D6106.BFF1EAEF@xxx.putzl.com...
>
> Access doesn't like fields that are more than 255 characters in size.
> --
>       Remove xxx. to reply ...
>   Don't just sit there reading news: get active!
> http://www.earthjustice.org/join/  http://www.yosemitevalley.org
> http://www.heifer.org




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

Date: Wed, 06 Dec 2000 04:36:45 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Help with program
Message-Id: <xnjX5.90$T3.170653696@news.frii.net>

In article <mGiX5.2841$Fn.104726739@news.xtra.co.nz>,
Kelvin Sim <kjs404@hotmail.com> wrote:
>Bugger... Sorry Chris
>
>#! \perl\bin\
>#
># Setting up the FarmCentre Store Codes
>#

Your program seems to work on my unix box.  

    $ perl farmenabler
    Enter the date:
    asdf
    Enter the FarmCentre Warehouse Code:
    ds
    You have entered the following date asdf
    You have entered the following FarmCentre ds Enabler Store
    Code = 0201

Maybe I'm misunderstanding your question.

chris
-- 
    This space intentionally left blank


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

Date: Wed, 06 Dec 2000 02:51:45 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Howto create setuid/setgid files and directories?
Message-Id: <5RhX5.85$T3.170584064@news.frii.net>

In article <90j8pj$crl$1@nnrp1.deja.com>,  <kmyer@hotmail.com> wrote:
>Hi,
>
>I have a small perl program that I developed to help migrate accounts to
>a Linux file server, running netatalk and Samba.  It queries an LDAP
>server to find valid accounts, then tests to see if those accounts have
>home directories.  If it doesn't, it then creates a home directory, as
>well as a few directories under them.  However, when I try to change
>file modes on a directory to 2707, chmod complains that the first bit
>isn't a zero.
>

I dont get the error that you get.  perl 5.6 on FreeBSD happily sets
the mode as requested.  The decimal value 2707 translates to octal
05223 and binary:

    101010010011
    sgtrwxrwxrwx
	u  g  o

Is that what you want?  That seems weird for a directory to only have write
permissions and be searchable only by 'other'. did you mean decimal 1479?
That's octal 02707. and is equivalent to binary

    010111000111
    sgtrwxrwxrwx
	u  g  o

That's more reasonable but I'm still confused by the 'other' permissions.
Maybe you really want decimal 1472, octal 02700, binary 010111000000.

This is really more a unix question than it is a Perl one.  You might get a
better answer in a group that has unix somewhere in it's name.

good luck
chris
-- 
    This space intentionally left blank


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

Date: Wed, 6 Dec 2000 04:46:44 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: No such file or directory
Message-Id: <slrn92rh54.qbm.efflandt@efflandt.xnet.com>

On Tue, 05 Dec 2000 00:57:07 GMT, Mark Kidd <lexkidd@gte.net> wrote:
>I'm trying to add a perl script to my website, and when I execute it in
>my HTML, it comes up with "Internal Server Error."
>Checking the error logs, I see "No such file or directory"
>The filename is correct, and the permissions are correct. I don't have a
>lot of experience with Perl, but I can't figure out what isn't working.
>I'm thinking it's a server configuration issue.

Try uploading in ASCII text mode (not binary).  Otherwise a Unix server
cannot find "perl^M" (Unix does NOT use carriage returns in text like
DOS/Win).

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

Date: 5 Dec 2000 20:29:23 -0600
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Perl Illiterate
Message-Id: <90k8a3$e89$1@pip.cs.utexas.edu>

In article <3A2BE7C8.C579CB08@alcatel.be>,
David Hiskiyahu  <David.Hiskiyahu@alcatel.be> wrote:
>There are many interpretations of Perl, the following came to my mind:
>
>- Pascal Experiences Record Low,
>- Pain, Envy, Revenge, Love,
>- Practical Enormously Rich Language,
>- Play & Enjoy this Rubbish Lister,
>- Pinguins Expect Romance & Love
>- Pathologically Eclectic Rubbish Lister,
>- Poorly Educated Romantic Lover,
>- Playing Environment for Rubbish Lovers, 
>- ...
>
>
>anyone wants to continue the list?

Parenthesis Excluded from Regular Languages, referring to the fact that
people are always asking how to construct a regular expression to match
balanced parenthesis.

Or, Programmers Eyeball Random Listings, referring to the write-only
nature of some Perl code.

  - Logan


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

Date: Wed, 06 Dec 2000 02:05:25 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: perlcc static?
Message-Id: <slrn92r7m2.nr.mgjv@verbruggen.comdyn.com.au>

On Tue, 5 Dec 2000 20:19:30 -0800,
	thijs@abzurd.com <thijs@abzurd.com> wrote:
> hi , .. i'm afraid i'm adking a bit of a faq here but i couldn't find it
> anywhere, ..
> 
> i'd like to us perlcc to make statically linked binarys, .
> i have a couple of programs that i need to easily distribute between a
> couple of linux distros we are running

I don't know whether perlcc calls the linker or the compiler to link
the binary, but if it's the compiler, you can set PERLCC_OPTS, as
described in the manual page. What you set it to, depends on your
compiler.

Martien
-- 
Martien Verbruggen              | My friend has a baby. I'm writing
Interactive Media Division      | down all the noises the baby makes so
Commercial Dynamics Pty. Ltd.   | later I can ask him what he meant -
NSW, Australia                  | Steven Wright


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

Date: Wed, 06 Dec 2000 02:35:59 GMT
From: tom.hoffmann@worldnet.att.net (Tom Hoffmann)
Subject: Problem with split using |
Message-Id: <slrn92r9a8.15c.tom.hoffmann@localhost.localdomain>

When I split the following string on the "|" character, it splits into
35 array elements. When I change the "|" to a "," and split on the
comma, it splits into the 7 fields I expect, but I can not figure out
why splitting on "|" does not give the same result. 

The pertinent code is:

$unidata = '|0000 0000|CI78-00727|19780126||DV||';
@unidata = split ("|", $unidata);

It would be easy to recreate my input and use the comma as the split
character, but I would like to understand what's going on.     
@unidata contains 35 elements, each one a single character from the
string.


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

Date: 5 Dec 2000 20:42:45 -0600
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Problem with split using |
Message-Id: <90k935$ecn$1@pip.cs.utexas.edu>

In article <slrn92r9a8.15c.tom.hoffmann@localhost.localdomain>,
Tom Hoffmann <tom.hoffmann@worldnet.att.net> wrote:
>When I split the following string on the "|" character, it splits into
>35 array elements. When I change the "|" to a "," and split on the
>comma, it splits into the 7 fields I expect, but I can not figure out
>why splitting on "|" does not give the same result. 

split() doesn't split on characters.  It splits on regular
expressions.  The regular expression consisting of just the "|"
character has a special meaning.  In a regular expression, the "|"
character matches either the regular expression on its right or the one
on the left.  Since both are the empty string, the regular expression
consisting of just the "|" character matches all empty strings.

And, there are empty strings between each of the characters in the
string you're passing to split().

So, basically, you need to do this:

	@thingies = split ('\|', $stringy);

The regular expression to match the literal "|" character.

  - Logan


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

Date: Tue, 5 Dec 2000 22:41:41 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Problem with split using |
Message-Id: <slrn92rdbl.ouu.tadmc@magna.metronet.com>

Logan Shaw <logan@cs.utexas.edu> wrote:

>	@thingies = split ('\|', $stringy);
>
>The regular expression to match the literal "|" character.


Except that should be:

   @thingies = split (/\|/, $stringy);

If it is a pattern match, then it should _look like_ a pattern match.

(which is perhaps what caused the problem in the first place)


-- 
    Tad McClellan                          SGML consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 5 Dec 2000 23:47:18 -0500
From: "Neb" <berube@odyssee.net>
Subject: Protecting my Perl script?
Message-Id: <kyjX5.646$n3.8984@news.globetrotter.net>

Hello,

I wrote a Perl script which acts as a "page server", so it will return an
HTML page when called with the propert content-type.  I simply put it on my
web site and call the file using my browser to see the HTML page.

Now, is there a way that I can protect (so people can't read) my source code
so that I can give my script away?  I could use Perl2Exe, but the problem is
that the executable can't be used on my web site provider.  They don't allow
executable to be run on their server.

So, beside executables, is there an other way to be able to run the script,
but with some encryption of the source code?

Thanks,

neb






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

Date: Tue, 5 Dec 2000 23:43:24 -0500
From: "Jody Fedor" <Jodyman@usa.net>
Subject: Re: references, hashes & arrays
Message-Id: <90kg2u$2bs$1@plonk.apk.net>


Ilmari Karonen wrote in message <976007422.26149@itz.pp.sci.fi>...
>In article <90i6d1$qd3$1@plonk.apk.net>, Jody Fedor wrote:
>>
>>OK, so I'm brain dead.  $unit{$in{'unit'}} worked fine.  Why does it work?
>>What actually does the ' ' do around the key?


<snip>

>  $unit{'$in{unit}'} # Looks for the literal key '$in{unit}' in %unit.


Ahhhhh,  I see the light!  Thanks for the informative discussion.

>
>  $unit{"$in{unit}"} # Interpolates the value of $in{unit} into a
>                     # string, and uses that as the key to look for.
>
>  $unit{$in{unit}}   # Uses the value of $in{unit} as the key to look
>                     # for in %unit.  (Hash keys are always treated as
>                     # strings anyway, so this is the same as above.)

Yes,  This works just fine.  Learn something new each and every
day!  Thanks.

Jody




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

Date: Wed, 06 Dec 2000 03:59:53 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Regex multiline html
Message-Id: <ZQiX5.1158$Xq5.36483@eagle.america.net>

On 04 Dec 2000 11:25:12 -0500, Vinny Murphy <vmurphy@Cisco.Com> wrote:
> >  next if /\# remove from here/ ... /\# to here .*$/;
> >  # notice the three dots. ------^
>
>Garry> This is from the perlop manual page:
>Garry> 
>Garry>   Range Operators
>Garry> 
>Garry>     Binary ".." is the range operator,
>Garry> 
>Garry> Notice the *two* dots.  

Vinny Murphy correctly pointed out to me that the range operator is
*also* three dots: 

     If
     you don't want it to test the right operand till the next
     evaluation, as in sed, just use three dots ("...") instead
     of two.  In all other regards, "..." behaves just like ".."
     does.

All I had to do was read a few lines further in the perlop manual
page.  Sigh.  

>Garry> Did you even try to run the code you posted?  
>
>Why yes I did - did you try to run my code as posted?  I believe that
>you should pay closer attention to the code and verify that I was
>incorrect before you decided to slam me.  You could also look at the
>perl cookbook for Section 6.8 for explaination of .. or ... and what the
>difference is.
>
>Garry> 
>Garry>     readline() on closed filehandle main::DATA at x line 3.
>Garry>     ------------------------------------------------------------------------
>Garry>     readline() on closed filehandle main::DATA at x line 5.
>Garry> 
>Garry> Why would you post such a thing?  
>
>Because I knew what I was doing.

I corrected this post with my own followup.  (I pasted the wrong text
in this quote.)  The suggested code still does not do what the
original poster required.  

However, Vinny Murphy did have the right idea.  Just don't attempt to
read the file twice (past end of file).  

-- 
Garry Williams


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

Date: Wed, 06 Dec 2000 04:36:03 GMT
From: Cookie.Monster@End.Of.Universe (Ken Bass)
Subject: rePOSTing with cookies
Message-Id: <3a2dbf6c.213170703@ca.news.verio.net>

I need to do the following:

Accept a POST query, modify and/or add parameter values, then POST the
query to another URL, along with all of the cookies from the original
POST. The response from that POST would just become the response for
the original POST. Sort of a filtered redirect.

Using the HTTP and LWP modules, I can build up the new request, with
the modified paramters, and then send them on to the new URL. But I
haven't found out how to copy the cookies from the original POST to
the new request.

Could someone please give me an example of how this might be done. I
really need to figure this out and get this working ASAP.

Any help is greatly appreciated. Also, if possible, could you email
your responses to the address below as well. I may not always have
access to news.

TIA,



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

Date: 5 Dec 2000 20:12:57 -0600
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: resuming?
Message-Id: <90k7b9$e54$1@pip.cs.utexas.edu>

In article <13hX5.7404$Nw6.24653@news.iol.ie>, EM <me@privacy.net> wrote:
>i use this code to print the contents of a file to the browser
>use File::Copy 'copy';
>copy("$filetodownload",\*STDOUT);
>
>but if i use getright (a resuming download manager) to download it tells me
>the server does not support resuming
>but my server does support resuming so i guess its a cgi thing

How does the server know your CGI is going to return the same thing
every time?  What is you script prints a random quote from a list of
quotes?  You might have a list of quotes like these:

	All we are saying is give peace a chance.
	The spirit is willing, but the flesh is weak.

Then, if the download stops after a certain number of bytes and is
restarted, the user might see the quote

	All we are saying is givut the flesh is weak.

This is hardly reasonable behavior, so I'm not surprised that web
servers try to avoid it.

There may be some way of spitting out an HTTP header or something that
will avoid this.  You might try asking in a web-related group, like
maybe comp.infosystems.www.authoring.cgi, since after all this isn't
really a Perl question in the first place.

  - Logan


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

Date: Wed, 06 Dec 2000 02:09:17 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Sorting the result of a function
Message-Id: <hdhX5.1151$Xq5.35574@eagle.america.net>

On Tue, 05 Dec 2000 16:32:09 GMT, John Wiersba <jrw32982@my-deja.com> wrote:
>garry@zvolve.com wrote:
>> But not with the sort() parameter prototype that is described in
>> perldoc -f sort:
>...
>>                  @sortedclass = sort byage @class;
>
>But my code doesn't say "sort f @LIST".  It says "sort f(...)".  Is
>there not a big visual and cognitive difference?  "f(...)" looks like a
>function call.  "f @LIST" looks like a bare word followed by a list and
>consequently is much less prone to misinterpretation.

I'm slowly starting to get it.  I was not (initially) aware of the
interpretation of the `f()' as `SUBNAME ()' to match the first
prototype listed (sort SUBNAME LIST).  I (incorrectly) thought of
`f()' as SUBNAME.  I see your point, now.  

 ...
>I don't see how a prototype for sort() is supposed to explain that you
>cannot pass as an argument to sort() the result of a function-call
>written using "normal" function-call syntax.
>
>Bottom line:
>
>I believe I understand what perl is doing.  I believe I understand why
>perl is doing it.  But that doesn't make it right.
>
>You're saying, in effect, that:
>   foo f(...)
>is a call to f() whose list-context result is passed to foo().  Except
>if foo == sort, in which case it's a call to sort() passing it a
>function name f and a list.

Or unless foo specifies the same prototype as sort.  

I suppose a way that perl *could* disambiguate this is to treat `f()'
as a function call and `f ()' as a SUBNAME and (empty) list.  I seem
to remember reading about some behavior of the parser being sensitive
to the space or lack of space.  I couldn't find that reference,
though.  

>I really find it incredible that a) a language could be designed to work
>this way, and b) people would defend it as if it made sense.
>
>(Sorry, Garry, if you're not really defending perl.  But I haven't
>heard even a single voice say, "Yea, you're right, it's unbelievably
>ugly; but that's the way it is and here's why...".)

A way to think about it is that the Perl prototype is the ugly piece.
I'm not sure that it's "unbelievably" ugly; just ugly.  I suppose the
reason is that the parser thinks it has no other choice by the time
that it hits the token `('.  (My compromise. :-)  

-- 
Garry Williams


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

Date: Wed, 06 Dec 2000 04:06:38 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: String Manipulation
Message-Id: <iXiX5.1160$Xq5.36483@eagle.america.net>

On Tue, 05 Dec 2000 10:30:53 GMT, Helgi Briem <helgi@NOSPAMdecode.is> wrote:
>On Sat, 2 Dec 2000 19:08:04 -0000, "James Boulter"
><jbou@bunker79.fsnet.co.uk> wrote:
>
>>Dear all,
>>
>>I have the string "James <email address>"
>>
>>How can I get the information into two separate variables without the
>>brackets.
>>
>>James
>>
># putting both > and < in the split delimiter gets
># rid of the trailing >
>my ($name,$email) = split/[<>/,$string; 

But this doesn't compile.  

    $ perl -we 'my ($name,$email) = split/[<>/,$string;'
    /[<>/: unmatched [] in regexp at -e line 1.
    $ 

-- 
Garry Williams


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

Date: Wed, 6 Dec 2000 04:58:30 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Submitting a file via a form
Message-Id: <slrn92rhr7.qbm.efflandt@efflandt.xnet.com>

On 4 Dec 2000 13:05:11 GMT, M.I. Planchant <M.I.Planchant@ncl.ac.uk> wrote:
>I wonder if anyone can help me with a problem that im having. Im trying to
>create a web page that contains a form. The form has three fields. 2 text and
>one which is of type file.
>
>What I need to do, is to run the cgi program when the submit button is
>clicked on and for the file which has been submitted to be processed and
results shown. How do I go about doing this? Ive done the form post
>stuff for the text fields but how can I do it for the file input?

On a system with perl type:  perldoc CGI
Look for the upload example.

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

Date: 6 Dec 2000 01:59:54 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: tie()ing an entire namespace
Message-Id: <976067961.11612@elaine.furryape.com>

Is it possible to tie an entire name space, so that eg:

package test;
$a='value';

would result in my tie'd method being called, without having to explictly
tieing $test::a.

I've tried tie'ing to $test::, and even though the tie worked, my
TIEHASH was called, my STORE never was.



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

Date: Tue, 5 Dec 2000 22:48:44 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Your help please
Message-Id: <slrn92rdos.ouu.tadmc@magna.metronet.com>

Nigel <nigeljennison@cs.com> wrote:
>In article <90if3b$61i$1@pheidippides.axion.bt.co.uk>,
>  "Katie Foster" <unknown@boat.bt.com> wrote:
>> I haven't been doing Perl very long, so I was hoping someone on here
>could
>> help me, please.
>>
>> My group have upgraded from Perl 3 to Perl 5.05.  Some of our scripts
                               ^^^^^^

You have CGI programs in Perl *3* ?

'cmon, we weren't born yesterday...  :-)


Maybe you meant 5.003 ?

If you are having a "version change" problem, then accurate
info on the versions involved is errr, important.


>I also want to upgrade but I heard that 5.05 will be replaced by


Ehh, there is no version 5.05. You mean 5.005 maybe?

5.005 has _already_ been replaced. By version 5.6 released
last summer.


>version 6 soon? Anybody else verify that?


I can UNverify that.

Perl 6 will NOT be available soon.

Larry hasn't even finished deciding what Perl 6 will be yet.

Puhhlenty of time before Perl 6 gets here. 12-24 months, I'd guess.


-- 
    Tad McClellan                          SGML consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 5042
**************************************


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