[17600] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5020 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Dec 3 14:05:38 2000

Date: Sun, 3 Dec 2000 11: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: <975870309-v9-i5020@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 3 Dec 2000     Volume: 9 Number: 5020

Today's topics:
        Calling a CGI Script beforing serving HTML (Jonaskuh)
    Re: Calling a CGI Script beforing serving HTML (Honza Pazdziora)
        Cookie dates <ttiger@lineone.net>
    Re: Cookie dates (David Efflandt)
        Dates, times and Perl <colin@dvdtimes.co.uk>
    Re: Dates, times and Perl (Adam)
    Re: Dates, times and Perl <ttiger@lineone.net>
    Re: Dates, times and Perl <colin@dvdtimes.co.uk>
    Re: Dates, times and Perl (David Efflandt)
    Re: Dates, times and Perl <colin@dvdtimes.co.uk>
    Re: DBD::CSV or TEXT::CSV <jeff@vpservices.com>
    Re: Does comp.lang.perl exist? <dsr@mail.lns.cornell.edu>
        Free classads, chat room, newswatch scripts <newsgroups@ebagus.com>
        Help with /\d+\s*(S+)/ Please <ned911@home.com>
        how to do Https:// through perl ? <angenent@kabelfoon.nl>
    Re: how to do Https:// through perl ? (David Efflandt)
    Re: I Have Active Perl--Now What? <mtn_view@sirius.com>
    Re: learning perl, this does not work ... why? (Tad McClellan)
    Re: MD5 or crypt()? (David Efflandt)
    Re: need help with warnings <rick.delaney@home.com>
    Re: Network "Discovery" <carvdawg@patriot.net>
    Re: progress of upload using multipart/form-data (David Efflandt)
    Re: question about matching... (Tad McClellan)
    Re: question about matching... (Tad McClellan)
    Re: question about matching... <joe+usenet@sunstarsys.com>
        Retrieving Files from a Linux Parition to DOS/NT <mtn_view@sirius.com>
        rmdir <todd@mrnoitall.com>
    Re: rmdir <bowman@montana.com>
    Re: rmdir <harrisr@bignet.net>
    Re: SAMS-Perl in 24hrs <t.geffert@gmx.de>
    Re: Sort <brill@hfhmn.org>
    Re: Using s/// to extract information <lincmad001@telecom-digest.zzn.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sun, 03 Dec 2000 17:58:08 GMT
From: jonaskuh@tell-em-off.com (Jonaskuh)
Subject: Calling a CGI Script beforing serving HTML
Message-Id: <3a2a88d7.16621553@news.coastalnet.com>

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.

Thanks in advance for your assistance.




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

Date: Sun, 3 Dec 2000 18:03:52 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Calling a CGI Script beforing serving HTML
Message-Id: <G507IG.DMH@news.muni.cz>

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

It's called mod_perl and the piece of code is then mod_perl handler.
You can set it to return proper output and result code in case of
error. You can find mod_perl on CPAN, together with installation
documentation.

Yours,

-- 
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
   .project: Perl, DBI, Oracle, MySQL, auth. WWW servers, MTB, Spain.
Petition for a Software Patent Free Europe http://petition.eurolinux.org
------------------------------------------------------------------------


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

Date: Sun, 3 Dec 2000 16:13:35 -0000
From: "Tony Bronze" <ttiger@lineone.net>
Subject: Cookie dates
Message-Id: <90drak$hj$1@uranium.btinternet.com>

Some scripts that I am using only allow the year to be input as 2 digits.
If I use 01 when setting a cookie expiry, will that be intepreted as 1901 or
2001 or should I use 101 for 2001?

Thanks




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

Date: Sun, 3 Dec 2000 16:42:29 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Cookie dates
Message-Id: <slrn92ktv9.nl7.efflandt@efflandt.xnet.com>

On Sun, 3 Dec 2000 16:13:35 -0000, Tony Bronze <ttiger@lineone.net> wrote:
>Some scripts that I am using only allow the year to be input as 2 digits.
>If I use 01 when setting a cookie expiry, will that be intepreted as 1901 or
>2001 or should I use 101 for 2001?

I would be suspect of any such scripts that are not y2k compliant.  What
other mistakes (or security flaws) might they have?

You should change your input to the actual year (4 digits), unless the
input prompt clearly states which year(s) 2 digit dates represent.  
Subtract 1900 from 4 digit years for use in time functions.  For display
you could either knock it down to 2 digits (if an early 1900's date would
be silly) or convert it to 4.

-- 
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: Sun, 3 Dec 2000 15:03:12 -0000
From: "Colin Polonowski" <colin@dvdtimes.co.uk>
Subject: Dates, times and Perl
Message-Id: <90dnhj$hv3$1@news6.svr.pol.co.uk>

Hi guys,

Just a very quick question - I'm running a site on a US-based server, I'm
actually in the UK as are most of my visitors. My question is, is it
possible to easily convert a date/time to GMT (it's currently PST) so that I
can accurately display it on my site?

--

Best Regards,

Colin Polonowski
* http://www.dvdtimes.co.uk
* http://www.thedvdforums.com
* http://www.dvdportal.co.uk




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

Date: Sun, 03 Dec 2000 15:36:20 GMT
From: adamf@box43.gnet.pl (Adam)
Subject: Re: Dates, times and Perl
Message-Id: <3a2a67e4.12944923@nntp.lucent.com>

On Sun, 3 Dec 2000 15:03:12 -0000, "Colin Polonowski"
<colin@dvdtimes.co.uk> wrote:

>Hi guys,
>
>Just a very quick question - I'm running a site on a US-based server, I'm
>actually in the UK as are most of my visitors. My question is, is it
>possible to easily convert a date/time to GMT (it's currently PST) so that I
>can accurately display it on my site?

you need the 'gmtime' function.

HTH
--
Adam


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

Date: Sun, 3 Dec 2000 16:10:36 -0000
From: "Tony Bronze" <ttiger@lineone.net>
Subject: Re: Dates, times and Perl
Message-Id: <90dr52$3au$1@neptunium.btinternet.com>

"Adam" <adamf@box43.gnet.pl> wrote in message
news:3a2a67e4.12944923@nntp.lucent.com...
> On Sun, 3 Dec 2000 15:03:12 -0000, "Colin Polonowski"
> <colin@dvdtimes.co.uk> wrote:
>
> >Hi guys,
> >
> >Just a very quick question - I'm running a site on a US-based server, I'm
> >actually in the UK as are most of my visitors. My question is, is it
> >possible to easily convert a date/time to GMT (it's currently PST) so
that I
> >can accurately display it on my site?
>
> you need the 'gmtime' function.
>
> HTH
> --
> Adam

Either that or add or subtract a time difference before displaying the final
time




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

Date: Sun, 3 Dec 2000 16:14:26 -0000
From: "Colin Polonowski" <colin@dvdtimes.co.uk>
Subject: Re: Dates, times and Perl
Message-Id: <90drn8$qj1$1@news5.svr.pol.co.uk>

> you need the 'gmtime' function.

Great - thanks for that... What's the syntax for that function?

--

Best Regards,

Colin Polonowski
* http://www.dvdtimes.co.uk
* http://www.thedvdforums.com
* http://www.dvdportal.co.uk





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

Date: Sun, 3 Dec 2000 16:48:48 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Dates, times and Perl
Message-Id: <slrn92kub5.nl7.efflandt@efflandt.xnet.com>

On Sun, 3 Dec 2000, Colin Polonowski <colin@dvdtimes.co.uk> wrote:
>> you need the 'gmtime' function.
>
>Great - thanks for that... What's the syntax for that function?

Are you kidding?  On a system with Perl type:  perldoc -f gmtime

gmtime(time + $tz) where you set $tz to the hours +/- from GMT/UTC.

-- 
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: Sun, 3 Dec 2000 17:13:15 -0000
From: "Colin Polonowski" <colin@dvdtimes.co.uk>
Subject: Re: Dates, times and Perl
Message-Id: <90dv5j$src$1@newsg1.svr.pol.co.uk>

Ignore me! Got it now !!! :)

--

Best Regards,

Colin Polonowski
* http://www.dvdtimes.co.uk
* http://www.thedvdforums.com
* http://www.dvdportal.co.uk

"Colin Polonowski" <colin@dvdtimes.co.uk> wrote in message
news:90drn8$qj1$1@news5.svr.pol.co.uk...
> > you need the 'gmtime' function.
>
> Great - thanks for that... What's the syntax for that function?
>
> --
>
> Best Regards,
>
> Colin Polonowski
> * http://www.dvdtimes.co.uk
> * http://www.thedvdforums.com
> * http://www.dvdportal.co.uk
>
>
>




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

Date: Sun, 03 Dec 2000 10:42:41 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: DBD::CSV or TEXT::CSV
Message-Id: <3A2A9421.51DD659D@vpservices.com>

Chris Sparnicht wrote:
> 
> 1. I have a virtual site on a unix machine,DBI::Shell
> ...
> 2. DBD::CSV does not exist on the the server. Before I ask
> my host to install DBD::CSV, will I still need login and password
> to the host or does DBD::CSV allow you to specify files
> on my site to write/view without a login? 

Correct, you don't need a login or password.

> If it is installed, will I be able to specify
> document paths to specific databases I want to create/use?

Yes.

> 3. I don't have TEXT::CSV available either. Is this an alternative
> worth asking for?

If you are going to be doing database operations anyway, you might as
well go straight to DBD::CSV.  DBD::CSV depends on Text::CSV (or
actually Text::CSV_XS) so you are actually getting both for the price of
one.  It really depends on how much you want to approach things in a
database way and how much in a Perlish way:  DBD::CSV would let you use
SQL (structured query language) to query, sort, update, create, etc.
while Text::CSV would just provide you with the raw tools to process CSV
and you'd have to make your own querying, sorting, updating routines. 
Obligatory self-plug (since I wrote it): you might also want to try
DBD::RAM which is another module very similar to DBD::CSV that allows
access to a wider range of file formats, to on-the-fly databases, and to
remote files.

-- 
Jeff


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

Date: 03 Dec 2000 11:53:11 -0500
From: Dan Riley <dsr@mail.lns.cornell.edu>
Subject: Re: Does comp.lang.perl exist?
Message-Id: <sh1yvpla4o.fsf@lns130.lns.cornell.edu>

"Alan J. Flavell" <flavell@mail.cern.ch> writes:
> Bit of history: Usenet administration of the major hierarchies (was it
> big-5 or big-6 at that time - Randal? - anyone?)

I'm pretty sure it was big-7 from the great renaming (1987) until
humanities.* made it big-8, though apparently soc.* and talk.*
didn't propagate to most of the world back when UUCP over phone
lines was the main backbone protocol.
-- 
Dan Riley                                         dsr@mail.lns.cornell.edu
Wilson Lab, Cornell University      <URL:http://www.lns.cornell.edu/~dsr/>
    "History teaches us that days like this are best spent in bed"


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

Date: Mon, 4 Dec 2000 00:21:48 +0800
From: "Free content" <newsgroups@ebagus.com>
Subject: Free classads, chat room, newswatch scripts
Message-Id: <90drr0$drp$1@mango.singnet.com.sg>

visit http://www.ebagus.com





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

Date: Sun, 03 Dec 2000 17:08:59 GMT
From: Ned <ned911@home.com>
Subject: Help with /\d+\s*(S+)/ Please
Message-Id: <3A2A7E10.7CDE682A@home.com>

I have read through the docs and faq but am still having problems.  I am
trying to sort a flat file by date which is the second field in the
file, tab (|) seperated.  So far I have November and December data (11,
12) and the line /\d+\s*(S+)/ is causing the Nov data to be sorted
correctly (I'm using a descending sort) but the Dec data is being sorted
last.  The file runs from 11-15 through 12-1 which makes me believe the
/\d+ line of code is sorting on the day not the whole string.

Thanks,

Ned



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

Date: Sun, 3 Dec 2000 17:01:32 -0800
From: "GOGAR" <angenent@kabelfoon.nl>
Subject: how to do Https:// through perl ?
Message-Id: <90dqmg$pn1$1@news.kabelfoon.nl>

I've been trying to downloading pages from the net  and sending some forms
forms using perl, but i can't quite figure out how to do Secure connections
stuff..  anybody got a clue?

Chris

# oh and for the people who are about to ask me how to download pages from
the net

use Socket;
use Filehandle;

sub httpGet() {
my($remote,$port,$uri,$data,$proxy,$proxyport)=@_;
 if((length($data)>0) and (substr($data,0,1) ne "?")){$data="?".$data};
$data=~ tr/ /+/;
socket(hpSOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp'));
if(length($proxy) < 1){$proxy=$remote};
while(!connect(hpSOCK, sockaddr_in($proxyport, inet_aton($proxy)))){};
hpSOCK->autoflush();
print hpSOCK "GET ".$uri.$data." HTTP/1.1\r\nHost: ".$remote."\r\n";
@sreturn=<hpSOCK>;
close(hpSOCK);
return @sreturn;
}





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

Date: Sun, 3 Dec 2000 17:19:34 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: how to do Https:// through perl ?
Message-Id: <slrn92l04r.nl7.efflandt@efflandt.xnet.com>

On Sun, 3 Dec 2000 17:01:32 -0800, GOGAR <angenent@kabelfoon.nl> wrote:
>I've been trying to downloading pages from the net  and sending some forms
>forms using perl, but i can't quite figure out how to do Secure connections
>stuff..  anybody got a clue?

You probably need to use the LWP module, because https (port 443) is
encrypted.

>Chris
>
># oh and for the people who are about to ask me how to download pages from
>the net
>
>use Socket;
>use Filehandle;
>
>sub httpGet() {
>my($remote,$port,$uri,$data,$proxy,$proxyport)=@_;
> if((length($data)>0) and (substr($data,0,1) ne "?")){$data="?".$data};
>$data=~ tr/ /+/;
>socket(hpSOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp'));
>if(length($proxy) < 1){$proxy=$remote};
>while(!connect(hpSOCK, sockaddr_in($proxyport, inet_aton($proxy)))){};
>hpSOCK->autoflush();
>print hpSOCK "GET ".$uri.$data." HTTP/1.1\r\nHost: ".$remote."\r\n";
>@sreturn=<hpSOCK>;
>close(hpSOCK);
>return @sreturn;
>}
>
>
>


-- 
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: Sun, 03 Dec 2000 06:31:40 -0800
From: Wayne Watson <mtn_view@sirius.com>
Subject: Re: I Have Active Perl--Now What?
Message-Id: <3A2A594C.E2FAD32B@sirius.com>

Thanks again, but I think I've pretty well had my original question answer, which is simply how do I
execute perl. I think we can move away from that question. To keep current, it looks like I had
better download Perl V6.0. It sounds like there have been some all around improvements in PA, IDE,
etc.

I guess I'll find out the answer to this question soon enough, but it looks like AP is connected
somehow to IE 3 and above. I imagine this is for CGI or generally web work. Is NetScape in the
picture instead of IE?

What I'm planning to use Perl for is: 1. To produce a list of all my mail titles in my Spam folder.
2. Recover source files from a Linux partition on my NT machine. Regarding the second item, a few
years ago I had Linux and NT running together and somehow clobbered Linux. That is, I can no longer
boot Linux. However, I have a Linux partition that contains some useful Perl scripts and a number of
very useful C programs.Although I had put them on a tape, it is now very difficult to get them from
the tape. So what I will be eventually looking at is a perl script to access the partition and
rumble through the filesystem there to pick off the source files and put them into a DOS/NT
partition. I have no idea whether I can somehow selectively grab the partition. I imagine (hope!)
there's a file or partition open statement that gets me to the partition I'd like to search.

Petri Oksanen wrote:

> In article <3A29D848.E8997F3F@sirius.com>, Wayne says...
> > Maybe I misunderstood his directions, but his menu items did
> > not correspond to what I see..
>
> > My ActivePerl is version 5.22.

 ...



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

Date: Sun, 3 Dec 2000 07:46:11 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: learning perl, this does not work ... why?
Message-Id: <slrn92kg4j.j1m.tadmc@magna.metronet.com>


Please do not make the same posting multiple times. Once is enough.

The more copies you post, the LESS likely it is that you
will get help.


Jerry F. Davis <jfdecd@execpc.com> wrote:
>
>I put in the following script (from Beginning perl by Simon Cozens)
>expecting the $1 .. $5 variables to print something.
>I get the first print line, "The text matches ...", but do not get
>anything for $1 as I expected.
>
>why?


We cannot help with a pattern match if you do not tell us
what the pattern is.

Tell us what the pattern is.

Did you have any parenthesis in the pattern?


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


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

Date: Sun, 3 Dec 2000 17:38:22 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: MD5 or crypt()?
Message-Id: <slrn92l182.nl7.efflandt@efflandt.xnet.com>

On 3 Dec 2000 04:11:18 GMT, Alan Barclay <gorilla@elaine.furryape.com> wrote:
>In article <90cfei$8qr$1@nnrp1.deja.com>,  <fallenang3l@my-deja.com> wrote:
>>Which one encrypts better, the Digest::MD5 module or the built-in crypt
>>() function?
>
>Neither one encrypts, they're both forms of hashing algorythmns.
>crypt has built in variation, in that the salt lets there be more than
>one hash for each password. For MD5 you have to do this yourself. crypt
>ignores the 9th or greater character, but can accept longer passwords,
>but on the flip side, MD5 is going to produce a longer hash. If you need
>it for compatability, or if there is a reason to minimize the space,
>then I'd use crypt, otherwise use MD5.

Actually crypt can be DES or MD5 depending upon the system default (which
may vary for the same OS).  For example I have been on FreeBSD that uses
MD5 and FreeBSD or BSDi that uses DES.

So if you are crypting passwords for other system programs (like web auth
passwords), you should either use the crypt on that system, or at least
check which it is before attempting to crypt passwords for it on another
system.

-- 
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: Sun, 03 Dec 2000 15:30:02 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: need help with warnings
Message-Id: <3A2A6A5F.E55729AD@home.com>

[posted & mailed]

John Hunter wrote:
> 
> Prototype mismatch: sub main::tag (@_) vs none at myhtml2texi line 28.
> Subroutine tag redefined at myhtml2texi line 14.

This and all diagnostic messages are documented in perldiag.

> #!/usr/bin/perl -w
> 
> # Convert html to texinfo (I know about html2texi, but it doesn't work
> # like I want it to!)
> 
> use strict;

If you put

  use diagnostics;

here then Perl will look up the message in perldiag for you and print
out more detail.  The warning means that the subroutine tag has already
been defined before your definintion of it on line 14.

> use HTML::Parser 3.00 ();

It could have been defined in this module, but since you're explicitly
asking it to not export anything, that would make this module evil.  A
lot of people use HTML::Parser so this is unlikely.

> use Mysubs::Misc;

It could have been defined in this one.

> use Text::Autoformat;

Or maybe this one, though I doubt that also.  Or maybe in some module or
library called from any one of these.

> my %inside;
> 
> use vars qw($output);

If you don't care that you're redefining an existing function, you can
suppress the warning with the warnings pragma.

{
  no warnings qw/prototype redefine/;
 
> sub tag {                        ### <- line 14
 ...
}

    perldoc warnings
    perldoc perllexwarn

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Sun, 03 Dec 2000 14:10:17 -0500
From: H C <carvdawg@patriot.net>
Subject: Re: Network "Discovery"
Message-Id: <3A2A9A99.6D90FD35@patriot.net>

> >I want to write a Perl script that will find the NetBIOS names of all
> >computers on the network. Either through some sort of broadcast or by
> >accessing Server Manager on one of our NT boxes. I've looked on CPAN
>
> use system or qx to run the NT system command NET.exe with the "view"
> parameter

That's one way...or you could use Win32::Lanman to do it all in Perl.  With
different
constants, you can tell the API to look for different types of machines.  Take a
look
at the below code...

NOTE:  By using different constants, you can get all NT machines, NT servers,
PDCs,
BDCs, or all windows machines...

#! c:\perl\bin\perl.exe

# http://www.forixnt.com
# forixnt@forixnt.com
# (c) 2000 Forix Business Systems
use strict;
use Win32::Lanman;

my $server = shift;
my $domain = shift;

my %serv_hash = ("NT" => SV_TYPE_NT,
                 "RAS" => SV_TYPE_DIALIN_SERVER,
                 "BDC" => SV_TYPE_DOMAIN_BAKCTRL,
                 "PDC" => SV_TYPE_DOMAIN_MASTER,
                 "SQL" => SV_TYPE_SQLSERVER,
                 "TERM" => SV_TYPE_TERMINALSERVER);

foreach my $key (keys %serv_hash) {
 my @info = ();
 if (Win32::Lanman::NetServerEnum($server,$domain,$serv_hash{$key},\@info)) {
   print "[".$key."]\n";
  map {print "\t${$_}{'name'}\n";}@info;
 }
 else {
  my $error = Win32::FormatMessage Win32::Lanman::GetLastError();
  $error = Win32::Lanman::GetLastError() if ($error eq "");
  print "Error:  $error.\n";
 }
}



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

Date: Sun, 3 Dec 2000 18:34:22 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: progress of upload using multipart/form-data
Message-Id: <slrn92l4h2.nl7.efflandt@efflandt.xnet.com>

On Sun, 03 Dec 2000 10:07:54 GMT, yaronn@my-deja.com <yaronn@my-deja.com> wrote:
>Does anyone have an idea how to get the progressive length (bytes)
>of a file uploaded using CGI.pm by multipart/form-data?

You can set an upper limit with CGI.pm or you could check the total
CONTENT_LENGTH, but I don't know what you mean by "progressive
length" because the data has been received before your CGI runs.

>If it's not possible using CGI.pm, how is it done,
>and do I have to parse the query string as well?
>(or leave that to CGI.pm)

You would have to do something browser side for the client to monitor
upload status.  Unless you are using a Perl script to to submit the data,
that is beyond the scope of this newsgroup.

CGI.pm param() automatically includes all POST variables and QUERY_STRING
variables.  But it apparently does NOT include variables from
QUERY_STRING_UNESCAPED (query string of main SSI page) in CGI called from
#include virtual= server side include.  At least not in v2.46 I have.

-- 
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: Sun, 3 Dec 2000 07:53:33 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: question about matching...
Message-Id: <slrn92kgid.j1m.tadmc@magna.metronet.com>

ivolla@my-deja.com <ivolla@my-deja.com> wrote:

>I am trying to make a script to search through a list of names and see
                                        ^^^^^^^^^^^^^^

Your code only looks at the first "list" entry (line), 
because you only read from the file one time.

You need to loop over all of the lines if you want to search
all of the lines.


>if a certain name is in there. The list is set up to show:
>First Name: xxxxLast Name: xxxxx
>First Name: xxxxLast Name: xxxxx
>
>the code i have written is:
>
>open (FILE, '/home/httpd/cgi-bin/volla/list.txt');


You should always, yes *always*, check the return value from open():

   open(FILE, '/home/httpd/cgi-bin/volla/list.txt') ||
      die "could not open '/home/httpd/cgi-bin/volla/list.txt'  $!";



>if (<FILE> =~ m/First Name: $FORM{'firstname'}Last Name: $FORM
>{lastname}/i)
>{
>print "match";
>close FILE;
>}
>
>This will find the first name but not the last. 


I do not follow what you mean there. The substring "Last Name"
_must_ be present for the match to succeed. It cannot match
first name without also matching lastname.


>Is m// limited to one
>variable? 


No.


>Any help on why this won't work 

Because you only read one line from the file, ignoring all of the
other lines.


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


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

Date: Sun, 3 Dec 2000 07:54:45 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: question about matching...
Message-Id: <slrn92kgkl.j1m.tadmc@magna.metronet.com>

Jody Fedor <Jodyman@usa.net> wrote:
>
>ivolla@my-deja.com wrote in message <90d09g$kfo$1@nnrp1.deja.com>...
>>I am trying to make a script to search through a list of names and see
>>if a certain name is in there. The list is set up to show:
>
>>if (<FILE> =~ m/First Name: $FORM{'firstname'}Last Name: $FORM{lastname}/i)
>
>                                       $FORM{'lastname'}


The quotes are optional. That cannot change anything.


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


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

Date: 03 Dec 2000 09:19:36 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: question about matching...
Message-Id: <m37l5hr3if.fsf@mumonkan.sunstarsys.com>

ivolla@my-deja.com writes:

> I am trying to make a script to search through a list of names and see
> if a certain name is in there. The list is set up to show:
> First Name: xxxxLast Name: xxxxx
> First Name: xxxxLast Name: xxxxx
> 
> the code i have written is:
> 
> open (FILE, '/home/httpd/cgi-bin/volla/list.txt');
> if (<FILE> =~ m/First Name: $FORM{'firstname'}Last Name: $FORM
> {lastname}/i)
> {
> print "match";
> close FILE;
> }
> 
> This will find the first name but not the last. Is m// limited to one
> variable? 

No, but <FILE> in a scalar context is (usually) limited to only one line.  
You need to test every line for a match, right?  What makes you sure there's
even a file named '/home/httpd/cgi-bin/volla/list.txt'? Do you have earlier
code that ensures that you haven't exhausted all your file descriptors, or
something else that guarantees the open call will never fail?


> Any help on why this won't work or a better way would be appreciated. Thanks
> in advance.
> 
#/usr/bin/perl -wT
use strict;

my $file = '/home/httpd/cgi-bin/volla/list.txt';
my %form = ( firstname => 'Harry', lastname => 'Ball' );
#open FILE, $file or die "Can't open $file:$!";   # uncomment
while(<DATA>) {                                   # s/DATA/FILE/
    next unless /First Name: $form{firstname}Last Name: $form{lastname}/i;
    print "match on line $.";
    last;
}
#close FILE;                                      # uncomment

__DATA__
First Name: SallyLast Name:  Ride
First Name: WalrusLast Name: McCartney
First Name: HarryLast Name: Doll
First Name: HarryLast Name: Ball
First Name: EverLast Name: Gobstopper
First Name: First Name:HarryLast Name: BallLastName: 31337

A better format for your data might be appropriate.
-- 
Joe Schaefer


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

Date: Sun, 03 Dec 2000 06:35:29 -0800
From: Wayne Watson <mtn_view@sirius.com>
Subject: Retrieving Files from a Linux Parition to DOS/NT
Message-Id: <3A2A5A31.6DAC682@sirius.com>

A  few years ago I had Linux and NT running together and somehow clobbered Linux. That is, I can no
longer boot Linux. However, I have a Linux partition that contains some useful Perl scripts and a
number of very useful C programs.Although I had put them on a tape, it is now very difficult to get
them from the tape. I would like to  write a perl script to access the partition and rumble through
the filesystem there to pick off the source files and put them into a DOS/NT partition. I have no
idea whether I can somehow selectively grab the partition. I imagine (hope!) there's a file or
partition open statement that gets me to the partition I'd like to search. Is what I'm asking
possible?

--
                              "It's better to wear out than rust out"
                                 -- Theodore Roosevelt, 26th U.S. President

                                            Wayne T. Watson




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

Date: Sun, 03 Dec 2000 09:40:42 -0600
From: Todd Anderson <todd@mrnoitall.com>
Subject: rmdir
Message-Id: <3A2A635C.8D92C983@mrnoitall.com>

Dear Persons,
I once saw some code posted in this group that would allow you to remove
a directory and all of it's contents including other directories and as
deep as it went.
Anybody know what it is?
Thanks in advance for your help.



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

Date: Sun, 3 Dec 2000 10:28:10 -0700
From: "bowman" <bowman@montana.com>
Subject: Re: rmdir
Message-Id: <RjvW5.1817$NN6.9935@newsfeed.slurp.net>


Todd Anderson <todd@mrnoitall.com> wrote
> I once saw some code posted in this group that would allow you to remove
> a directory and all of it's contents including other directories and as
> deep as it went.

`rm -rf foo` works for me.




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

Date: Sun, 3 Dec 2000 13:45:44 -0500
From: "Randy Harris" <harrisr@bignet.net>
Subject: Re: rmdir
Message-Id: <t2l55ok5n0i28b@corp.supernews.com>

bowman <bowman@montana.com> wrote in message
news:RjvW5.1817$NN6.9935@newsfeed.slurp.net...
>
> Todd Anderson <todd@mrnoitall.com> wrote
> > I once saw some code posted in this group that would allow you to
remove
> > a directory and all of it's contents including other directories and
as
> > deep as it went.
>
> `rm -rf foo` works for me.
>

Just a guess based on the Subject, but the OP might be looking for
something that would work on Windoze.





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

Date: 03 Dec 2000 14:25:28 +0100
From: Thomas Geffert <t.geffert@gmx.de>
Subject: Re: SAMS-Perl in 24hrs
Message-Id: <m31yvpr60n.fsf@cal056202.student.utwente.nl>

"Graphi_" <graphi@-nospam-mouldmaking.freeserve.co.uk> writes:

> Running an excersise in the book (p.53) for Prime numbers. The following
> errors are encountered:
> !# usr/local/bin/perl -w

This must be

#!/usr/local/bin/perl -w

Perhaps this is only an typing error in this article, but
if I save the above code with the !# and start it with 

perl program.pl

I get also the following error
> 
> $maxprimes=10; #can't modify line 3- not in scalar assignment at primes.pl

but with lots of other errors too.

  Thomas


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

Date: Sun, 03 Dec 2000 12:14:36 -0600
From: "Daniel J. Brill" <brill@hfhmn.org>
Subject: Re: Sort
Message-Id: <3A2A8D8B.394AF98D@hfhmn.org>

Dear John,

One solution is to enter your data differently in your db.  If you enter 1
as 01 and 2 as 02, then this will force your list to sort as 01, 02, 03,
 ... 09, 10.  If your list will go past 100, then enter 1 as 001.  If it
will go past 1,000, then enter 1 as 0001, etc.

If you are entering your data with Excel, a very common situation, this can
be a real pain because Excel doesn't like to have leading zeros.  You need
to set the column format to text, as opposed to a number format.  It will
then take 01.  However, you can't do any computations with the number
because it isn't a number -- its text.  Thankfully perl doesn't care.

Dan

jtjohnston wrote:

> I'm using this to sort the lines in a db file. The problem is each line
> begins with a number.
>
> When the number is below 10, it sorts like this:
>
> 1       asdasd
> 10      asdasd
> 2       asdasda
> 3       wsfdsdfs
>
> etc
>
> I would like to sort so that it would come out like:
>
> 1       asdasd
> 2       asdasda
> 3       wsfdsdfs
> 10      asdasd
>
> What do I have to do differently?
>
> Thanks,
>
> John
>
> ---------snip----------
>
> foreach $key (sort keys %DB){
> ($db_contact_name, $db_email, $db_title, $db_url, $db_desc,
> $db_keywords, $db_hits, $db_flag, $db_date, $db_time)
> = split (/\t/, $DB{$key});
>
> #...etc here I print html code
> }



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

Date: Sun, 03 Dec 2000 03:47:05 -0800
From: Linc Madison <lincmad001@telecom-digest.zzn.com>
Subject: Re: Using s/// to extract information
Message-Id: <031220000347052369%lincmad001@telecom-digest.zzn.com>

In article <906617$f22$1@nnrp1.deja.com>, eT <eT@quidel.com> wrote:

> Greetings - I am currently using the following code to extract a zip
> code:
> 
>  if ($address1 =~ m/(\d{5}\-\d{4})/) {
>    ($zip) = ($1);
>  }
> 
> 
> My question is, can I replace the m/// with s/// in the same way to
> not just extract the zip code from $address1, but also to remove the
> zip code from $address1:
> 
>  if ($address1 =~ s/(\d{5}\-\d{4})//) {
>    ($zip) = ($1);
>  }
> 
> My problem is that the above does not seem to work, i.e. the $zip
> string is empty after the above condition.  I would prefer not to use
> substr().

Works fine for me, with or without the unnecessary parentheses around
$zip and $1, and with or without the unnecessary backslash on the
hyphen.

Also, do you only want to match ZIP+4, or also 5-digit ZIPs?
Furthermore, it's rather unlikely, but a Canadian address could fool
you:

John Q. Canajun
12345-6789 Main St
Vancouver BC  Z9Z 9Z9

That's equivalent to 6789 Main St Unit (Apt/Suite/etc.) 12345, which is
why I say it's rather unlikely (not many five-digit unit numbers in
most buildings).

You could do something like

if ($address1 =~ s/(\d{5})(-\d{4})?(?=\D*$)//) {
   $zip = "$1$2";
}

That allows for something like "U. S. A." after the ZIP but not
something like a Canadian postcode.

Of course, if you know that your input will always be U.S. addresses
ending with ZIP+4, then you needn't bother with the extra stuff, except
that you might still want to stick a $ at the end of the regex just in
case of some weirdness like "123 Main St Mailstop 12345-6789" or what
have you.


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

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


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