[17883] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 43 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 11 21:05:56 2001

Date: Thu, 11 Jan 2001 18:05:17 -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: <979265116-v10-i43@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 11 Jan 2001     Volume: 10 Number: 43

Today's topics:
        a question on scope dtbaker_dejanews@my-deja.com
        Apache - CGI File Uploads don't work <dheera@usa.net>
        Clearing a hash. west999@my-deja.com
    Re: Clearing a hash. (Greg Bacon)
    Re: Clearing a hash. gungeek@my-deja.com
        Damian Conway Seminars: OO-Perl/Munging, Seattle 2/20-2 <tim@consultix-inc.com>
    Re: Dir dots in readdir and Win dtbaker_dejanews@my-deja.com
    Re: Dir dots in readdir and Win (Gary E. Ansok)
    Re: How to get STDERR from system? dtbaker_dejanews@my-deja.com
    Re: How to get STDERR from system? <tony_curtis32@yahoo.com>
    Re: How to get STDERR from system? <mr_joesixpack@yahoo.com>
    Re: How to setup time elapse (Mark Jason Dominus)
    Re: how to use HTML::Parser (Mark Jason Dominus)
    Re: HTTP::Request encoding query gungeek@my-deja.com
    Re: Jobs: Senior Software Engineer <uri@sysarch.com>
    Re: Jobs: Senior Software Engineer (Jerome O'Neil)
    Re: Jobs: Senior Software Engineer jatgirl@yahoo.com
    Re: Jobs: Senior Software Engineer dtbaker_dejanews@my-deja.com
    Re: Jobs: Senior Software Engineer (Martien Verbruggen)
        Large array in CGI slow ? (Q) mgrabens@popd.isinet.com
    Re: Large array in CGI slow ? (Q) dtbaker_dejanews@my-deja.com
    Re: MS Interdev Perl plugin??? (Damian James)
    Re: need help with getpwnam command <wescott@conterra.com>
        nsPerl5 <mikec@country-life.com>
    Re: nsPerl5 (Martien Verbruggen)
    Re: OT: .htpasswd on Win32 build dtbaker_dejanews@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 11 Jan 2001 23:19:39 GMT
From: dtbaker_dejanews@my-deja.com
Subject: a question on scope
Message-Id: <93lf23$1tl$1@nnrp1.deja.com>

I have projects in which I isolate some site-specific variable
declarations in a script,which is then "required" in several main
"working" scripts. My question is how to avoid compilation warnings from
variables that may only be used once.

What I have done so far is to not use the -w flag in the declaration
script, and in the main scripts that "require" it, any variable I use I
try to use at least twice... sometimes just by assigning it to a dummy a
the top of the main script as a form of inline documentation of which
of the configuration variables I am using.

Is there a slicker way to do this?

Dan


Sent via Deja.com
http://www.deja.com/


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

Date: Thu, 11 Jan 2001 21:03:48 -0500
From: "Dheera Venkatraman" <dheera@usa.net>
Subject: Apache - CGI File Uploads don't work
Message-Id: <t5spgs93i32q67@corp.supernews.com>

Hi,
I'm trying to write a CGI script that accepts a file upload via HTTP and
puts it into the '/pub' folder that I have created (web server is Apache on
Linux).

ASCII files upload fine, but binary files always give me an 500 internal
server error.

The HTML and the CGI script are below... any ideas?

Thanks,
Dheera Venkatraman
dheera@usa.net

------------------------ upload.cgi -----------------
#!/usr/bin/perl -w

use CGI;
my $query = new CGI;
my $file = $query->param('file');
my $filename=$query->param('filename');

print "Content-type: text/html\n\n";
print qq|<HTML><BODY>|;

if($filename!~/(\.\.)/) {
# so people don't hack and send filename='../something' to put files outside
/pub
    my $myFile = "/pub/$filename";
    open(FILE,">$myFile");
        while(read($file,$buffer,1024)) { print FILE $buffer; }
    close(FILE);
    print qq|File was uploaded.|;
}
else {
    print qq|Filename invalid for security reasons.|;
}

print qq|</FORM></BODY></HTML>|;
------------------------------------------------------
------------------------ upload.html -----------------
<HTML><BODY>
<FORM ENCTYPE="multipart/form-data" ACTION="/cgi-bin/upload.cgi"
METHOD="POST" NAME="upl">
<INPUT TYPE="FILE" NAME="file" SIZE="50">
<INPUT TYPE="hidden" NAME="filename">
<INPUT TYPE="button" VALUE="Upload"
onClick="setvalue(document.forms.upl.file.value);document.forms.upl.submit()
;">

<script language="JavaScript"><!--
// script to determine the name of the file being uploaded from the 'file'
control on the form, so the cgi script can correctly name the file.
function setvalue(what) {
    if (what.indexOf('/') > -1)
        answer = what.substring(what.lastIndexOf('/')+1,what.length);
    else
        answer = what.substring(what.lastIndexOf('\\')+1,what.length);
 document.forms.upl.filename.value=answer;
 document.forms.upl.submit();
}
//--></script>
        </FORM>
</BODY>
</HTML>
-----------------------------------------------------------------




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

Date: Fri, 12 Jan 2001 00:37:06 GMT
From: west999@my-deja.com
Subject: Clearing a hash.
Message-Id: <93ljjh$5q2$1@nnrp1.deja.com>

Hi,

I have a script that assigns a bunch of keys/values to a hash.  At some
point in that script I would like to "clear" the hash, that is to say
get rid of all of the keys/values.

I do not want to redeclare the hash.

So far I have tried:
undef %hash;

and

%hash = "";

Neither works, the old key/values persist.

Any ideas?

Thanks in advance...
Dan


Sent via Deja.com
http://www.deja.com/


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

Date: Fri, 12 Jan 2001 01:15:12 -0000
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Clearing a hash.
Message-Id: <t5sml0582n0a2d@corp.supernews.com>

In article <93ljjh$5q2$1@nnrp1.deja.com>,
     <west999@my-deja.com> wrote:

: Any ideas?

%hash = ();

Greg
-- 
compilant, adj.: Not necessarily compliant, but at least it compiles.
    -- Jutta Degener


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

Date: Fri, 12 Jan 2001 01:32:50 GMT
From: gungeek@my-deja.com
Subject: Re: Clearing a hash.
Message-Id: <93lms2$8jt$1@nnrp1.deja.com>

In article <93ljjh$5q2$1@nnrp1.deja.com>,
  west999@my-deja.com wrote:
> Hi,
>
> I have a script that assigns a bunch of keys/values to a hash.  At
some
> point in that script I would like to "clear" the hash, that is to say
> get rid of all of the keys/values.

%x = (y => 1,z => 2);
print keys %x;
%x = ();
print keys %x;


Sent via Deja.com
http://www.deja.com/


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

Date: 12 Jan 2001 01:17:01 GMT
From: Tim <tim@consultix-inc.com>
Subject: Damian Conway Seminars: OO-Perl/Munging, Seattle 2/20-23
Message-Id: <93llud$sm2$1@brokaw.wa.com>
Keywords: oop perl data munging conway training seminars seattle

Dr. Damian Conway, a leading expert on OO Perl and "the bloke who
wrote the definitive book on the subject,"  will be giving a two-day
seminar entitled "Advanced Object Oriented Perl", from 2/22-2/23.
To help students prepare for this seminar, the Consultix "Intermediate
Perl Programming" and "Basic Object Oriented Perl" classes will be
offered in the preceding week.

From 2/20-2/21, Damian will be presenting his new two-day seminar
on "Data Munging", which shows students how to use Perl features
and CPAN modules to read in, decipher, process, and reformat, or in
other words, expertly "munge" ASCII text data. (In Ancient Geek,
munge is a verb meaning to transform data or code in some
unspecified -- but fiendishly clever -- manner.)  This seminar is
suitable for Beginning/Intermediate Perl programmers.

And to top it off, we're holding a special Beta-test offering of a
new "Database Programming with Perl" course written by Colin Meyer
from 2/7-9.

There are 10% discounts for early registrants, proving that
laziness (or procrastination at least) is not *always* a virtue! 8-}.

Full details and online registration are available at the Consultix
web site: http://www.consultix-inc.com

*==================================================================*
| Tim Maher, PhD  CEO, Consultix &    (206) 781-UNIX/8649          |
|      Pacific Software Gurus, Inc.   Email: tim@consultix-inc.com |
| "The UNIX/Perl Training Experts"    http://www.consultix-inc.com |
|      ** Public and On-Site Software Training since 1986 **       |
*==================================================================*



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

Date: Fri, 12 Jan 2001 00:13:30 GMT
From: dtbaker_dejanews@my-deja.com
Subject: Re: Dir dots in readdir and Win
Message-Id: <93li73$4mc$1@nnrp1.deja.com>

you can indeed check for . and .. a number of different ways. Your
approaches looked ok... are you sure that the readdir is returning any
results? i.e. did you check that your opendir succeeded?

Dan


Sent via Deja.com
http://www.deja.com/


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

Date: 12 Jan 2001 00:56:22 GMT
From: ansok@alumni.caltech.edu (Gary E. Ansok)
Subject: Re: Dir dots in readdir and Win
Message-Id: <93lknm$1vh@gap.cco.caltech.edu>

In article <93kpum$coo$1@nnrp1.deja.com>,  <markfolse@rocketmail.com> wrote:
>Everything I try in Perl ( "m/^[\.]+/ && next" or "if ($_ eq "..")
>{next}" as the first line of the while (@allfiles) loop; or @allfiles=
>m!^([A-Z,a-z,1-9]+)! , readdir(DIRLIST), seems goes into an
>uninitialized value loop).

I think you want for (or foreach) instead of while -- for (@allfiles)
says to loop once for each item in @allfiles, setting (aliasing, actually)
$_ to the item for each trip through the loop.  while (@allfiles)
just says to loop as long as there is anything in @allfiles.

See perlsyn for more details on the various loop constructs.

-- Gary Ansok


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

Date: Thu, 11 Jan 2001 23:05:33 GMT
From: dtbaker_dejanews@my-deja.com
Subject: Re: How to get STDERR from system?
Message-Id: <93le7n$12s$1@nnrp1.deja.com>

In article <93l9u9$2ig@fidoii.CC.Lehigh.EDU>,
  "Phil R Lawrence" <prlawrence@lehigh.edu> wrote:
> Basically, I want to seperately log (from my perl script) the STDERR
and
> STDOUT from system calls.  How can I do this?  Does the return from
system()
> mix both together?
---------------------

well... the system(0 call does return a status, but it is hard to get
much detailed information from it. what you could try is to explicitly
open STDERR as a log file in the script you are running within the
system call. what you can do is:

	close STDERR ; 	# we dont want to put errors down on server log
			# I want them where I can find them
	open( STDERR , ">../cgierr.txt" ) or
		die "Failed to open cgierr.txt to redirect errors" ;
	print STDERR scalar(localtime)." - executing $0 \n\n" ;



Dan


Sent via Deja.com
http://www.deja.com/


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

Date: 11 Jan 2001 17:24:12 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: How to get STDERR from system?
Message-Id: <87hf35r7tv.fsf@limey.hpcc.uh.edu>

>> On Thu, 11 Jan 2001 16:51:13 -0600,
>> "Phil R Lawrence" <prlawrence@lehigh.edu> said:

> Basically, I want to seperately log (from my perl
> script) the STDERR and STDOUT from system calls.  How
> can I do this?  Does the return from system() mix both
> together?

perldoc perlipc

has examples of forking subprocesses and controlling and
redirecting their I/O etc.

hth
t
-- 
Eih bennek, eih blavek.


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

Date: Thu, 11 Jan 2001 23:22:33 GMT
From: Paul Laub <mr_joesixpack@yahoo.com>
Subject: Re: How to get STDERR from system?
Message-Id: <93lf7g$21h$1@nnrp1.deja.com>

Find your answers here:

perlfaq8

or, in more detail,

Christiansen and Torkington, "Perl Cookbook", section 16.7, "Reading
STDERR from a Program"

Paul

In article <93l9u9$2ig@fidoii.CC.Lehigh.EDU>,
  "Phil R Lawrence" <prlawrence@lehigh.edu> wrote:
> Basically, I want to seperately log (from my perl script) the STDERR
and
> STDOUT from system calls.  How can I do this?  Does the return from
system()
> mix both together?
>
> Thanks,
> Phil R Lawrence
>
>


Sent via Deja.com
http://www.deja.com/


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

Date: Fri, 12 Jan 2001 00:33:23 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: How to setup time elapse
Message-Id: <3a5e50d3.39f5$37@news.op.net>
Keywords: andesite, chapter, slither, worksheet


In article <3A5D3560.F22F6474@yahoo.com>,
Cheng Huang  <zfhuang99@yahoo.com> wrote:
>I want to get the time, which is a 30 minutes from now,
>and turn it into a special formatted string.
>Can anybody tell me how to do that?


        $time_30_minutes_from_now = localtime(time() + 30*60);

If you want the string formatted differently, look into the
POSIX::strftime function.  (Do 'man POSIX' or 'perldoc POSIX')


>Thanks,

You are welcome.
-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Fri, 12 Jan 2001 00:31:02 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: how to use HTML::Parser
Message-Id: <3a5e5044.39ea$255@news.op.net>
Keywords: antennae, asbestos, masonry, percolate

In article <93jt12$1gqv$1@news.cz.js.cn>,
james roads <zhenghua_li@nj.trendmicro.com> wrote:
>can you tell me about how to use the modules HTML::Parser?
>I don't know how to define the "subclass" to get the result of file

Try this:

        #!/usr/bin/perl

        $p = MyParser->new;
        $p->parse_file("foo.html");

        package MyParser;
        use HTML::Parser;
        BEGIN { @ISA = 'HTML::Parser' }
        sub start {
          my ($parser, $tagname, $attr, $attrseq, $origtext) = @_;
          return unless $tagname eq 'a';
          print "I see a link to $attr->{href}.\n";
        }        
        sub text {
          my ($parser, $text) = @_;
          print "I see the plain text <<$text>>\n";
        }


Hope this helps.

You may also want to take a look at HTML::TreeBuilder instead.

-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Thu, 11 Jan 2001 22:59:30 GMT
From: gungeek@my-deja.com
Subject: Re: HTTP::Request encoding query
Message-Id: <93ldsd$rm$1@nnrp1.deja.com>

In article <93la7l$t68$1@nnrp1.deja.com>,
  iain_hogg@my-deja.com wrote:
> Hi,
>
> Take the following HTTP::Request :
>
> $tgt = 'http://www.acme.com/cgi/test.cgi?val=bar|';
> $req = new HTTP::Request('GET' => $tgt);
>
> Now, when this request is made at some point it is encoded (in iso
latin 1 I
> think) into a HTTP request that looks like
>
> GET http://www.acme.com/cgi/test.cgi?val=bar%7C
>
> where '|' has become '%7C'
>
> So what I'd like to know is if there is any way to prevent this
encoding
> taking place?  I don't mind changing perl source and recompiling if

If it wasn't encoded, it wouldn't be a valid URL, and you might get
a "Malformed Request" response.  Why do you want to do this?


Sent via Deja.com
http://www.deja.com/


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

Date: Thu, 11 Jan 2001 23:34:48 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Jobs: Senior Software Engineer
Message-Id: <x7snmp3boq.fsf@home.sysarch.com>

>>>>> "TB" == Terrence Brannon <brannon@lnc.usc.edu> writes:

  TB> dha@panix2.panix.com (David H. Adler) writes:
  >> On Tue, 09 Jan 2001 17:58:14 GMT, jatgal  wrote:
  >> 
  >> >Title: Senior Software Engineer / Software Architect
  >> 
  >> >Availability:
  >> 
  >> Irrelevant.
  >> 
  >> You have posted a job posting or a resume in a technical group.

  TB> He posted a Perl job posting in a Perl newsgroup. Because this is
  TB> where Perl programmers are. I don't mind that.

<flame war starting>

well, then post anything about any job that is for a company that may
have heard about perl in here. there are jobs groups just for that
purpose. this group is to discuss perl, not perl jobs.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Thu, 11 Jan 2001 23:48:35 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: Jobs: Senior Software Engineer
Message-Id: <nDr76.2204$dy.423040@news.uswest.net>

Uri Guttman <uri@sysarch.com> elucidates:

>   TB> He posted a Perl job posting in a Perl newsgroup. Because this is
>   TB> where Perl programmers are. I don't mind that.
> 
> <flame war starting>
> 
> well, then post anything about any job that is for a company that may
> have heard about perl in here. there are jobs groups just for that
> purpose. this group is to discuss perl, not perl jobs.

<dons asbestos pants>

A Perl job is certainly a miscelaneous topic regarding Perl.

-- 
If men could learn from history, what lessons it might teach us!  But
passion and party blind our eyes, and the light which experience gives
is a lantern on the stern, which shines only on the waves behind us.
				--Samuel Taylor Coleridge, "Recollections"


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

Date: Fri, 12 Jan 2001 00:04:43 GMT
From: jatgirl@yahoo.com
Subject: Re: Jobs: Senior Software Engineer
Message-Id: <93lhmm$46b$1@nnrp1.deja.com>

I agree with you 100%. My sincere apologies. Thanks for the pointeres
on pm.org mailing list, will utilise it .

Thanks
PJ

In article <slrn95mrel.c04.dha@panix2.panix.com>,
  dha@panix2.panix.com (David H. Adler) wrote:
> On Tue, 09 Jan 2001 17:58:14 GMT, jatgal  wrote:
>
> >Title: Senior Software Engineer / Software Architect
>
> >Availability:
>
> Irrelevant.
>
> You have posted a job posting or a resume in a technical group.
>
> Longstanding Usenet tradition dictates that such postings go into
> groups with names that contain "jobs", like "misc.jobs.offered", not
> technical discussion groups like the ones to which you posted.
>
> Had you read and understood the Usenet user manual posted frequently
> to "news.announce.newusers", you might have already known this. :)
(If
> n.a.n is quieter than it should be, the relevent FAQs are available at
> http://www.faqs.org/faqs/by-
newsgroup/news/news.announce.newusers.html)
>
> Please do not explain your posting by saying "but I saw other job
> postings here".  Just because one person jumps off a bridge, doesn't
> mean everyone does.  Those postings are also in error, and I've
> probably already notified them as well.
>
> If you have questions about this policy, take it up with the news
> administrators in the newsgroup news.admin.misc.
>
> There is a Perl Jobs Announce list that may be more helpful to you.
See
> <http://www.pm.org/mailing_lists.shtml> for details.
>
> Yours for a better usenet,
>
> dha
>
> --
> David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
> We went on holiday by mistake	- Withnail
>


Sent via Deja.com
http://www.deja.com/


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

Date: Fri, 12 Jan 2001 00:06:18 GMT
From: dtbaker_dejanews@my-deja.com
Subject: Re: Jobs: Senior Software Engineer
Message-Id: <93lhpk$48l$1@nnrp1.deja.com>

In article <lbn1cxzog1.fsf@lnc.usc.edu>,
  Terrence Brannon <brannon@lnc.usc.edu> wrote:
> dha@panix2.panix.com (David H. Adler) writes:
>
> > On Tue, 09 Jan 2001 17:58:14 GMT, jatgal  wrote:
> >
> > >Title: Senior Software Engineer / Software Architect
> >
> > >Availability:
> >
> > Irrelevant.
> >
> > You have posted a job posting or a resume in a technical group.
>
> He posted a Perl job posting in a Perl newsgroup. Because this is
> where Perl programmers are. I don't mind that.
>
--------------

I mind that! This is a tech group... not to be cluttered with job
postings resumes, or other off-topic stuff. If you want jobs, use a
*job* newsgroups,there are tons of them....

D


Sent via Deja.com
http://www.deja.com/


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

Date: Fri, 12 Jan 2001 01:31:15 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Jobs: Senior Software Engineer
Message-Id: <slrn95snh1.jgc.mgjv@verbruggen.comdyn.com.au>

Note followups

On Thu, 11 Jan 2001 23:48:35 GMT,
	Jerome O'Neil <jerome@activeindexing.com> wrote:
> Uri Guttman <uri@sysarch.com> elucidates:
> 
>>   TB> He posted a Perl job posting in a Perl newsgroup. Because this is
>>   TB> where Perl programmers are. I don't mind that.
>> 
>> <flame war starting>
>> 
>> well, then post anything about any job that is for a company that may
>> have heard about perl in here. there are jobs groups just for that
>> purpose. this group is to discuss perl, not perl jobs.
> 
><dons asbestos pants>
> 
> A Perl job is certainly a miscelaneous topic regarding Perl.

It is not. The purpose of the comp.lang groups is to talk about the
LANGUAGE specified. Not about all kinds of other things with might
have a sideways relevance. Not about social issues like jobs. 

Job postings do NOT belong in technical groups. In these technical groups
people talk about technical things related to the specified language.
Jobs are not part of the language, or even its application domain.

You can argue as much as you want that in _your_ view job postings
belong here, but that doesn't alter the point that they don't. Your
view does not determine what the intention of the comp.lang groups
was and is, nor the rules of the individual groups.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Hi, John here, what's the root
Commercial Dynamics Pty. Ltd.   | password?
NSW, Australia                  | 


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

Date: Fri, 12 Jan 2001 00:10:38 GMT
From: mgrabens@popd.isinet.com
Subject: Large array in CGI slow ? (Q)
Message-Id: <93li1o$4kd$1@nnrp1.deja.com>

	I have a text file that looks like:
Key:	Data
===============
UT	1234
NM	Mike
AU	ABCD
RN	2345
AU	BCDE
RN	3456
AU	CDEF
RN	4567
 ...

The Keys RN and AU repeat about 3,000 more times each. Actual data in
them may be much larger...

The code I have does:
push @{$info{$key}}, $data;

I have also tried:
$info{$key} = [ @{$info{$key}}, $data ];

Both seem to go through the data just fine when I run a small program
using my library on the command line and when I have a small CGI use the
library to parse the file. Round about 1-2 seconds (I am not timing the
read, that was done already). The CGI the library was written for is a
much larger CGI (many more Perl modules) and when it does the same thing
it can take 15-25 second depending on server load.

To get $key and $data I am using a regular expression:
$pattern = qr((\w+)\s+(\w+)\s+);
Then:
	while ($file =~ /$pattern/ocxg)
{
	$key = $1;
	$data = $2;
	push @{$info{$key}}, $data;
	...
}

Any ideas why ?

Is the bigger CGI using all of Perl's allocated variable space before I
parse the file, so by the time I start to parse the file Perl has to do
fresh memory allocations for the array I am building ?

This is happening on a Solaris 2.6 box running Perl 5.005_3 same thing
happens for Apache and Netscape enterprise server.

I have also seen the same problem parsing another large file. The only
similarity is the fact that it creates an enormous array and is using a
regular expression. Like:
$ref1 = \@tree;
$stRef = \$ref1;
while ($file =~ /$pattern/ocxg)
{
	$key = $1;
	$data = $2;
	push @{$$stRef}, $key;
	push @{$$stRef}, \%tmp;
	$ref2 = [ 0 , $data ];
	push @{$$stRef}, $ref2;
	$stRef = \$ref2;
}

Thanks,
	Mike
ps - Please CC me on your reponse. TIA (A).



Sent via Deja.com
http://www.deja.com/


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

Date: Fri, 12 Jan 2001 00:20:24 GMT
From: dtbaker_dejanews@my-deja.com
Subject: Re: Large array in CGI slow ? (Q)
Message-Id: <93lik0$53q$1@nnrp1.deja.com>

In article <93li1o$4kd$1@nnrp1.deja.com>,
  mgrabens@popd.isinet.com wrote:
> 	I have a text file that looks like:
> Key:	Data
> ===============
> UT	1234
> NM	Mike
> AU	ABCD
> RN	2345
> AU	BCDE
> RN	3456
> AU	CDEF
> RN	4567
> ...
>
> The Keys RN and AU repeat about 3,000 more times each. Actual data in
> them may be much larger...
--------------------------------------

anytime you have "thousands" of lines of data, you really need to
rethink any design that jams all the data into a giant array. You are
just asking for memory problems. depending on what you are trying to do,
 you really should try to read thru line-by-line and keep counts or
generate results as you go rather than suck the whole thing into memory.

D


Sent via Deja.com
http://www.deja.com/


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

Date: 12 Jan 2001 00:50:06 GMT
From: damian@puma.qimr.edu.au (Damian James)
Subject: Re: MS Interdev Perl plugin???
Message-Id: <slrn95sl7s.mvl.damian@puma.qimr.edu.au>

In article <93kqg6$m4n$1@pheidippides.axion.bt.co.uk>, Mark Hamlin wrote:
>Does MS Interdev have a plugin to enable syntax hightlighting and the like
>for Perl?

AFAIK there isn't, but you might want to have a look at ActiveState's plugin
for Visual Studio, called (imaginatively), Visual Perl.

	http://www.activestate.com/Products/VisualPerl/index.html

Cheers,
Damian



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

Date: Fri, 12 Jan 2001 00:30:59 GMT
From: Mike Wescott <wescott@conterra.com>
Subject: Re: need help with getpwnam command
Message-Id: <os1yu9txv5.fsf@eriadne.sc.rr.com>

mr_potato_head@my-deja.com writes:

>    I'm using perl version 5.005_02 on solaris 2.6 and 2.7.  I wrote a
> small script that will force users to change their passwords every 30
> days in my NIS network.  My problem is when I use the getpwnam command
> to retrieve the user's info, the password and everything else comes
> back fine, but after I run a system command to have the user change
> their password, I run the getpwnam command again and it returns the
> user's old password and not the new.  Why?

Becuase you haven't really reread the date. Try an endpwent() before
the second getpwnam().

-- 
	Mike Wescott
	wescott@conterra.com


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

Date: Thu, 11 Jan 2001 17:23:01 -0800
From: Mike Cooper <mikec@country-life.com>
Subject: nsPerl5
Message-Id: <3A5E5C74.76C08BF2@country-life.com>

Hi

        I was wondering if any one knows where I may obtain the
following modules for HP-UX 11.0 for nsPerl5.

        Storable
        Convert-UU
        Getopt-ArgvFile

Thanks in advance

--
Michael Cooper
Network Administrator
mikec@country-life.com




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

Date: Thu, 11 Jan 2001 23:38:29 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: nsPerl5
Message-Id: <slrn95sgti.jgc.mgjv@verbruggen.comdyn.com.au>

On Thu, 11 Jan 2001 17:23:01 -0800,
	Mike Cooper <mikec@country-life.com> wrote:
> Hi
> 
>         I was wondering if any one knows where I may obtain the
> following modules for HP-UX 11.0 for nsPerl5.

What is nsPerl5? Something HP ships with HP-UX or so?

We tend to like to know versions a bit more precisely than 5, as well.
But that's something you can remember for the next time :) perl -v
will tell you.

>         Storable
>         Convert-UU
>         Getopt-ArgvFile
> 
> Thanks in advance

All these modules are available from CPAN. If your Perl is reasonably
standard, then you should be able to get and compile those.

http://www.cpan.org/
http://search.cpan.org/

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | In a world without fences, who needs
Commercial Dynamics Pty. Ltd.   | Gates?
NSW, Australia                  | 


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

Date: Thu, 11 Jan 2001 23:11:03 GMT
From: dtbaker_dejanews@my-deja.com
Subject: Re: OT: .htpasswd on Win32 build
Message-Id: <93lei0$1fl$1@nnrp1.deja.com>

In article <3A5E221F.710E5A3@torontonian.com>,

> I was wondering what can I do to make cyript or .htpasswd files to
work
> in win32 environment?
----------------------------

I dont think you can... I am not aware of any win32 webserver that
recognizes the .htaccess construct. It is ignored on win32 machines. If
you have code in place that checks for REMOTE_USER, one thing you can do
is check the OS, and step around it if you are running on win32.

D


Sent via Deja.com
http://www.deja.com/


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

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 V10 Issue 43
*************************************


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