[8693] in Perl-Users-Digest
Perl-Users Digest, Issue: 2310 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 13 17:07:24 1998
Date: Mon, 13 Apr 98 14:00:23 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 13 Apr 1998 Volume: 8 Number: 2310
Today's topics:
Re: [Q] find largest value in key of associative array? (brian d foy)
Re: arrays of arrays and loop constructs <danboo@negia.net>
Re: arrays of arrays and loop constructs (Greg Bacon)
Re: File download problem in IE4.0 bidyut@yahoo.com
Re: General Rudeness, e.g. Re: Need a web login script (Stuart McDow)
Re: help with delimiters <scott@rappahannock-web.com>
Re: How to upload multiple graphic files at once ? (brian d foy)
Re: How to upload multiple graphic files at once ? (Abigail)
Re: HTTP server written in perl? <westmj@esvax.dnet.dupont.com>
Ideas for installations <mbunks@coincnx.com>
Re: Info Regarding Perl 5.005 <merlyn@stonehenge.com>
Re: Intermittent Perl problems <Scott_LeWarne@BigFoot.com>
Re: Intermittent Perl problems <Scott_LeWarne@BigFoot.com>
Re: looking for a good win32 perl editor. <cee123@ibm.net>
Re: looking for a good win32 perl editor. <jdf@pobox.com>
Re: Perl Compiler for NT (Stuart McDow)
Re: split problem (Craig Berry)
Re: split problem (Al Thomas)
Re: split problem (Douglas Wilson)
Re: Subtle syntax error with "print" and sub references <jdporter@min.net>
Tip: How to selectively quiet warnings (Kevin Reid)
where are the examples in the newer (blue) camel book? <digital_puer@hotmail.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 13 Apr 1998 15:16:34 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: [Q] find largest value in key of associative array?
Message-Id: <comdog-ya02408000R1304981516340001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6gtla7$lvv$1@monet.op.net>, mjd@op.net (Mark-Jason Dominus) posted:
>In article <comdog-ya02408000R1304981339320001@news.panix.com>,
>brian d foy <comdog@computerdog.com> wrote:
>>why is everyone trying to sort?
>
>Because it leads to smaller code.
you'd have to define "smaller", then justify why that would be an
advantage. i think it was Jonathon who posted a each-key-once
snippet that had as few characters as the sort examples.
i think the real reason is that people don't realize what sort
really does, and that some functions take a lot longer to do their
thing than others.
>> you only need to look at each key once!
>
>I posted the each-key-once solution too, but I think there's a place
>for the sort solution.
that's nice. care to say which place that might be? i tend to avoid
unnecessary work when possible. :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: Mon, 13 Apr 1998 14:16:52 -0400
From: Dan Boorstein <danboo@negia.net>
Subject: Re: arrays of arrays and loop constructs
Message-Id: <35325694.BC322CB8@negia.net>
Ross Becker wrote:
>
> I've been playing with perl for a while now, lately, I have been
> doing some stuff
> where I generated arrays of anonymous arrays, as in:
> push @mylist, [$foo, $bar];
>
> now, when I wish to unroll this list of lists, I have found there to be
> very little in
> terms of a "natural" expression, for pulling out those values as I
> looped...
> what *I* reguarded as natural was this:
>
> foreach ($foo, $bar) (@mylist) {
> dosomething;
> }
>
[snip]
> I am assuming that there was a concious decision to not allow the first
> syntax I
> expressed, but what I was wondering, was if someone who's more intimate
> with perl than I could point out why the first syntax would be a bad
> idea, or if it
> would actually be something useful.
if i saw the above expression in a script i would expect it to be pulling
two elements off of @mylist for each iteration, instead of pulling one
element and then expanding as an array reference. your suggestion would
be some pretty serious "magic" in my opinon.
--
dan boorstein
------------------------------
Date: 13 Apr 1998 20:41:29 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: arrays of arrays and loop constructs
Message-Id: <6gtt9p$65j$4@info.uah.edu>
In article <35324328.41EFDAD7@softrends.com>,
Ross Becker <beckerr@softrends.com> writes:
: what *I* reguarded as natural was this:
:
: foreach ($foo, $bar) (@mylist) {
: dosomething;
: }
Many people (most notably Abigail) have called for this sort of syntax,
but, judging by the number of patches that would modify perl to
recognize syntax similar to the above, the demand doesn't seem to be
sufficiently high. :-)
: but, that simply does not work... I ended up being forced into the
: following:
:
: while (($foo, $bar) = @{shift @mylist}) {
: dosomething;
: }
:
: which I reguard as being less than entirely natural.
I agree--it is a little painful on the eyes.
: I know that I
: could use foreach
: to drop into a scalar, and pull the scalar apart in the first statement
: of the loop,
: but as a perl hacker(tm), that solution is less than appealing to me.
I've always found code like
for (@list) {
my($elt0, $elt1, $elt2, ..., $eltn-1) = @$_;
...;
}
to be an easy read (and easily maintainable) because it reinforces the
fact that Perl arrays are arrays of scalars and you can look down a
line to examine the contents of each scalar (which avoids the sort of
information overload exhibited by the last snippet).
: I am assuming that there was a concious decision to not allow the first
: syntax I
: expressed, but what I was wondering, was if someone who's more intimate
: with perl than I could point out why the first syntax would be a bad
: idea, or if it
: would actually be something useful.
Like I said, insufficient demand. Patches are always welcome. :-)
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: Mon, 13 Apr 1998 15:15:18 -0600
From: bidyut@yahoo.com
Subject: Re: File download problem in IE4.0
Message-Id: <6gtrom$sh0$1@nnrp1.dejanews.com>
Hi guys,
thanks for fighting on the post. i am sorry if posted it in the wrong news
group. Thanks to Kenner for supporting me. Anyway, as Kenner pointed out..
that i am confused, whether the problem lies in Perl site or IE site, i
thought best to put it in Perl, beacuse, i Know a lot of people work on these
issue and there must be some answer for this.
Well, as Tom said, i have to look into protocls, isn't that all the browsers
support same protocols when download comes into picture.
To Eric, well, i tried changing the media type too, but no help. It still
provides the same problem.
What i see is that the same problem what i am facing has been raised in the
news group.. and i don't think anybody has found out a solution!!
Rest about fighting whether the question should go to which group, I feel,
when somebody is panicked, it doesnot matter where he is posting the question,
it's the point, whether he gets the answer or not!!
Anyway, thanks for answering to the problem.. i am still in the dark room!!!
regards
Bidyut
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 13 Apr 1998 20:02:04 GMT
From: smcdow@arlut.utexas.edu (Stuart McDow)
Subject: Re: General Rudeness, e.g. Re: Need a web login script
Message-Id: <6gtqvs$ao4$1@ns1.arlut.utexas.edu>
tmornini@netcom.com (Tom Mornini) writes:
>
> It does amaze me how some people, who understand everything
> technical, understand so little socially.
It sounds like you haven't been reading the Usenet for very long. In
the 12 or so years I've been reading it, I've never known it *not* to
be rude.
Comes with the territory. I don't know of any newsgroups where
rudeness isn't pervasive. Some are better than others, but rudeness is
everywhere in the Usenet. Those who cannot handle rudeness shouldn't
be reading the Usenet at all. That may suck, but that's the way it is.
Part of the problem here in clpm is that some of us miss the halcyon
days of early comp.lang.perl, when most of the questions were
pertinent, not FAQs, and at least posters had made *some* sort of
effort to solve the problem on their own before posting. Oh, and those
were the days before the world-wide-web came into existance, too. I
think a lot of people don't realize that perl was around a long time
before the web was. At any rate, now we're frustrated with what
clp.misc has become.
Hopefully, clp.moderated will bring back some of the
interestingness. Hopefully the S/N ratio will be high enough that
Larry Wall will post (which is always a treat), as he used to do
regularly in early comp.lang.perl.
--
Stuart McDow Applied Research Laboratories
smcdow@arlut.utexas.edu The University of Texas at Austin
"It is obvious that about 750,000 people ago, Austin was a wonderful City."
------------------------------
Date: Mon, 13 Apr 1998 15:01:18 +0000
From: scott <scott@rappahannock-web.com>
To: James Ludlow <ludlow@us.ibm.com>
Subject: Re: help with delimiters
Message-Id: <3532287F.E8459DE7@rappahannock-web.com>
James Ludlow wrote:
>
> Nick Bradaschia wrote:
> >
> > I am stuck! (and a newbie too!)
> > I am trying to read just a certain data from a file.
> > i.e.
> > from the string:
> > log:name:connect:transmit:receive:protocol
> > I want to obtain only the "connect" value (which happens to be bounded by 2
> > ":"'s). I have attempted to do a split
> > procedure, but it does not appear to work!
> > here is my code:
> >
> > open (DATA, "data");
>
> It's common practice to always check the return values of an open...
> open (DATA, "data") or die "Couldn't open data $!";
>
> > while ($line=<DATA>) {
> > ($rx)=split((':'),$line);
> ^^^^^
> You're actually pretty close. The return value of split is a list (an
> array). You are assigning this list to the list ($rx), which only
> stores the first value passed to it. The other values from the split
> are there, but you're effectively throwing them away. You could
> accomplish your goals in a couple different ways.
>
> ($log,$name,$connect,$transmit,$receive,$protocol) = split /:/, $line;
> - OR -
> $connect = (split /:/, $list)[2];
>
> Items to read about in the docs/faqs:
> split
> slice
> list
> scalar
> array
>
> --
> James Ludlow (ludlow@us.ibm.com)
> This isn't tech support, and all opinions are my own.
why does this work?
($log,$name,$connect,$transmit,$receive,$protocol) = split /:/, $line;
and this wants to return the number of items in $line?
($log,$name,$connect,$transmit,$receive,$protocol) = split (/:/, $line);
--
Scott Prince
scott@rappahannock-web.com
--
------------------------------
Date: Mon, 13 Apr 1998 15:17:39 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: How to upload multiple graphic files at once ?
Message-Id: <comdog-ya02408000R1304981517390001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6gtjiv$elo$1@nnrp1.dejanews.com>, krzych@altavista.net posted:
>Hi Does anybody know how to upload many graphic files at the push of a
>button? 100 pictures or so? Can I do it in Perl?
probably. have you tried a combination of PerlTk and Net::FTP?
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: 13 Apr 1998 20:12:04 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: How to upload multiple graphic files at once ?
Message-Id: <6gtrik$r5p$1@client3.news.psi.net>
krzych@altavista.net (krzych@altavista.net) wrote on MDCLXXXVI September
MCMXCIII in <URL: news:6gtjiv$elo$1@nnrp1.dejanews.com>:
++ Hi Does anybody know how to upload many graphic files at the push of a
++ button?
Yes.
++ 100 pictures or so?
Yes.
++ Can I do it in Perl?
Yes.
Your question isn't Perl specific. Please ask in the relevant
newsgroup. alt.button.play
Abigail
--
perl -wle '$_ = 1; (1 x $_) !~ /^(11+)\1+$/ && print while $_ ++'
------------------------------
Date: 13 Apr 1998 20:19:23 GMT
From: Mike West <westmj@esvax.dnet.dupont.com>
Subject: Re: HTTP server written in perl?
Message-Id: <6gts0b$pkq@topgun.es.dupont.com>
In article <352E5D84.5AEC61C4@mail.mcoe.k12.ca.us> Mcoe NT,
root@mail.mcoe.k12.ca.us writes:
>
>Has anyone seen a HTTP server written only in perl?
>
>
I think a few of the web-centric modules have httpd servers in them;
check CPAN.
I have also seen: http://eagle.eku.edu:4000/PERL/mhttpd
and you could look for a recent copy of the following, or email
me for the source code, which the margin is too small to contain...
(mwest@nyx.net)
#!/usr/local/bin/perl -s
# <pre>
# <b>HTTP Server Ver 1.2</b>
#
# Written by George Vanecek Jr. June/1993
# with some code grabbed from Michael McLay.
#
or this:
#
# pHTTPd 1.0
# is a simple HTTP server.
#
# Use of this script is without warranty and may be freely distributed
# provided this copyright message is left intact.
#
# (C) Pratap Pereira
# pereira@ee.eng.ohio-state.edu
# 12/10/94
# Send bug reports, comments and enhancements to be incorporated for later
# releases.
#
------------------------------
Date: Mon, 13 Apr 1998 15:15:18 -0500
From: Mark Bunkowske <mbunks@coincnx.com>
Subject: Ideas for installations
Message-Id: <35327256.74B7514A@coincnx.com>
Im fairly new to CGI but am really only looking for a basic algorithm or
idea about the following problem:
Our company needs an automatic copy protection system via our web site.
We would like to use a CGI script to give our clients a "password" to
finish their install automatically. This needs to be done in such a way
so that the client cannot copy our installation
files and give them to someone else and have them go through the same
installation procedure.
I have a couple ideas however I keep running into the same problem:
How do I stop someone from giving out copies of our software and keep
the owner of the pirated copy from going through the exact same process?
I have thought of having a file of clients that have been sold and their
corresponding passwords (to finish their installation) and after the CGI
program sends their password,
if the email doesnt come back (they submitted the wrong email address)
(is this possible for a CGI program to find out?) then their user id and
password is deleted from the text file so nobody else could go through
the same process later.
Im not really looking for code, I just need a plan of action where I can
start and feedback to make sure Im going in the right direction..
Any comments are welcome
Mark
------------------------------
Date: Mon, 13 Apr 1998 19:07:09 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
To: Brian Mathis <brianm@kodak.com>
Subject: Re: Info Regarding Perl 5.005
Message-Id: <8c67kdsfrc.fsf@gadget.cscaper.com>
>>>>> "Brian" == Brian Mathis <brianm@kodak.com> writes:
Brian> It seems like the general concensus is not not report this until 5.005
Brian> comes out, otherwise, every "stable" version of perl will be
Brian> CERTified... We can't have that now, can we...
Right, we'll turn in the 5.004 taint bug as soon as 5.005 is out.
And 5.005 is about to hit Beta, so it won't be long.
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 140 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Mon, 13 Apr 1998 12:27:29 -0700
From: "Scott LeWarne" <Scott_LeWarne@BigFoot.com>
Subject: Re: Intermittent Perl problems
Message-Id: <6gtptg$l65@news.or.intel.com>
Sorry, I guess that was pretty vague.
My biggest problem is that I'm not very familiar with Perl and I did not
write the script. Unfortunatly, I get the task of figuring out why it's
producing errors.
Here's what I do know, also I've included the code at the bottom.
The script looks through a directory tree and provides a graphical interface
for navigating through the tree, listing all the files and their types and
other info about them.
The script works most of the time which leads me to believe that the script
itself is ok. When the error occurs, I have checked just about every aspect
of the server that I can think of to try and find something that's not
right, memory problems things like that. Everything appears to be normal.
The fact that I have to reboot the server to fix the problem leads me to
believe that I'm putting the server into some sort of bad state. I'm not
sure if it's the web server or the server itself. Stopping and restarting
the web server has no effect, I have to reboot the entire server.
I have spent a lot of time on Microsoft's support site and gotten nowhere.
Could it be some sort of timing problem? The fact that the error is saying
that the script didn't return the proper headers and that it doesn't list
anything for the headers that it did return leads me to believe that the
server never gets anything back from the script at all.
Unfortunatly, I don't know much else about how exactly this script works.
Here is the code if it helps at all.
Thanks for any help.
Scott LeWarne
The Code:
#!\Perl\bin\perl.exe -w
use Win32::File;
#
# print standard html header
print <<"HERE";
Content-type: text/html
<html>
<head>
<title>ESG MIMS</title>
</head>
<BODY BGCOLOR="#FFFFFF">
<!-- Start of Client Side Image Map information -->
<MAP NAME="header">
<AREA SHAPE=RECT COORDS="119,0,177,13"
HREF="http://esg-marketing.intel.com/" TARGET="_top" ALT="">
<AREA SHAPE=RECT COORDS="182,0,254,14"
HREF="http://esg-marketing.intel.com/contents.htm" TARGET="body" ALT="">
<AREA SHAPE=RECT COORDS="260,0,323,14"
HREF="http://esg-marketing.intel.com/faq/admin/admin.cfm" TARGET="body"
ALT="">
<AREA SHAPE=RECT COORDS="327,0,409,14"
HREF="http://esg-marketing.intel.com/feedback.cfm" TARGET="body" ALT="">
<AREA SHAPE=RECT COORDS="414,0,459,14"
HREF="http://www.intel.com/tradmarx.htm" ALT="">
<AREA SHAPE=RECT COORDS="0,8,117,37" HREF="http://esg-marketing.intel.com/"
TARGET="_top" ALT="">
<AREA SHAPE=RECT COORDS="128,18,195,32"
HREF="http://esg-marketing.intel.com/search.htm" TARGET="body" ALT="">
<AREA SHAPE=RECT COORDS="306,19,367,34" HREF="http://circuit.intel.com"
ALT="">
<AREA SHAPE=RECT COORDS="371,18,464,33" HREF="http://www-esg.intel.com"
ALT="">
<AREA SHAPE=RECT COORDS="469,1,549,39" HREF="http://www.intel.com" ALT="">
<AREA SHAPE=RECT COORDS="205,19,297,34" HREF="http://www.intel.com" ALT="">
</MAP>
<!-- End of Client Side Image Map information -->
<IMG SRC="/images/esg_header.gif" USEMAP="#header" ALT="ESG Marketing
Header" ISMAP BORDER=0 width=550 height=45>
<br>
<table width=580 cellspacing=0 cellpadding=3 border=0>
HERE
#
$headermessage = "This Intel Confidential material is ONLY approved<br> for
Tier 1/2 OEMS under NDA/CITR!<hr>";
$contact = "Bob Wallace (677 5427)";
$spacer = "\n<tr>\n<td width=75> </td>\n";
$upload = "\n<img src = \"/images/upload.gif\" border = 0>";
$dirhelp = "<font face=\"arial\" size=2>Readme file";
$thisprog = "pitches.pl";
$thisdir = "/docscripts";
$drive = "f:";
$webpath = "www-fcp.co.intel.com";
$rootdir = "\/FCTWeb\/Pitches";
$top_dir = "";
$title = "Marketing Document File System <br> Blue Badge Access Area";
$help="<a href=\"/docscripts/pitchhelp.htm\" target = \"body\"><img src =
\"/images/help.gif\" border=0 alt=\"help\"></a>";
print "<TR><TD COLSPAN=3><center><font face=\"Arial\" size=+1
color=red><b>$headermessage</b></font></center></TD></TR>";
if ($ENV{'QUERY_STRING'})
{
# debug print "directory passed in $ENV{'QUERY_STRING'}<br>";
$top_dir = $ENV{'QUERY_STRING'};
$top_dir =~ s/%20/\ /g; # restore any spaces to the string
$top_dir =~ s/\/\//\//g; # clean up any double slashes
$top_dir =~ s/\.\///g; # clean up any ./
$top_dir =~ s/\*/\ /g; # clean up any *
}
#
# debug print
"root: $rootdir <br>";
# debug print "top_dir: $top_dir<br>";
# start of main processing
#
# convert names to dos formats
#
$savepath = $top_dir;
$dospath = Win32::GetShortPathName("$drive.$rootdir.$top_dir");
# debug print "<p>dos pathname: $dospath <p>\n";
# debug print "<p>full pathname: $drive$rootdir$top_dir<p>\n";
#
#
if (opendir(DIR,$dospath)) #start processing the file and directory names
#debug print "[opened directory]$dospath<br>\n";
local(@temp)=readdir(DIR);
closedir(DIR);
#
# see if there is a readme.ppt or a readme.txt file in the list
#
foreach $file (@temp)
{
if ($file =~ m/README/i) # print links to any readme files
{
$temp = &Win32::GetShortPathName($dospath."/".$file);
$img = &getimg($file);
$sizeoffile = int((-s $temp)/1024);
$temp = substr($temp,3);
print "\n<td colspan=2 width=200> <a href=\"http://$webpath/$temp\">$img
$dirhelp</a> </td>\n";
}
else
{
push(@allfiles,$file);
#debug print "readdir entry: $file<br>\n";
}
}
DIRENTRY: while (defined($file=shift(@allfiles))) # loop through the
directory structure
$temp = &Win32::GetShortPathName($dospath."\/".$file); # temp holds
the full pathname with filename in dos format
$temp1 = substr($temp,3); # path and file name without disk letter
# debug print "\nfile or directory
name:$file<br>$temp<br>$temp1<br><hr>\n";
if ( -f $temp ) # it is a file print out the file name and link
# debug print "dospath: $temp<br>\n";
$img = &getimg($file);
$sizeoffile = int((-s $temp)/1024);
$ageoffile = int(-M $temp);
$font = "<font face=\"Arial\"size=1>";
if ($ageoffile < 10) {$font = "<font face=\"Arial Black\" size=1
color=\"green\">";}
print "$spacer\n<td><font face=\"Arial\"size=2><a
href=\"http://$webpath//$temp1\">$img $file</a>\n</td>\n";
print "<td align=right valign=bottom><font face=\"Arial\"
size=2>$sizeoffile K<\/font><\/td><td valign=bottom>$font modified
$ageoffile days ago</font></td>\n</tr>\n";
next DIRENTRY;
}
if ( -d $temp) # it is a directory name (including . and ..)
# debug print "directory: [$file]<br>\n";
print $spacer;
$img = "<img src=\"/images/closedir.gif\" border=0>\n";
if ($file eq '.')
{
print "\n<td>\n";
#debug print "found . directory $top_dir:<br> \n";
$temp = $top_dir;
$temp =~ s/\ /\*/g; $temp = substr($temp,0,length($temp)-1); $temp1 =~
s/\/\//\//;
if ($top_dir ne "\/" && $top_dir ne "")
{
print "<font face=\"Arial\" size =
4><b>$savepath</b></font></td>\n<td>$help</td>\n";
} else
{
print "<font face=\"Arial\" size =
4><b>$title</b></font></td>\n<td>$help</td>\n";
}
print "<\/table>\n<table border=0 width=520>\n";
next DIRENTRY;
}
if ($file eq '..')
{
print "\n<td>\n";
#debug print "found .. directory $temp1<br> \n";
$img = "<img src=\"/images/uppoint.gif\" border=0 width=31 height=21>";
@dirs = split("\/",$savepath); pop(@dirs); $temp1 = join("/",@dirs)."\/";
$temp1 =~ s/\ /%20/g;
#debug print "found .. directory $temp1<br> \n";
print "<a href=\"$thisdir/$thisprog?$temp1";
print "\">$img <font face=\"Arial\"size=2>Up one
directory</a><\/font>\n";
print "</td>\n "; print "\n</tr>\n ";
next DIRENTRY;
} # end of processing .. directory entries
#
# if we get here, then we must be processing a normal directory entry
#
$temp = $savepath."/".$file;
$temp =~ s/\ /%20/g;
print "\n<td>\n<a href=\"$thisdir\/$thisprog?$temp\/\">";
$file =~ s/%20/\ /g;
$img = "<img src=\"/images/closedir.gif\" border=0 width=40
height=21><font face=\"Arial\"size=2>\n";
print "$img$file<\/font><\/a> \n";
print "</td>\n "; print "\n</tr>\n ";
next DIRENTRY;
} # end of directory if statement
} # End of while statement
} # end of open directory if statement
else # open directory failed
{
print "<br> unable to open directory: $drive$rootdir$top_dir<br>";
print <<"HERE";
<p> This may be caused by your not having read permission to the directory.
Contact $contact for assistance.
HERE
}
# End of main processing loop
print <<"HERE";
</table>
</body>
</html>
HERE
###########################
sub getimg
{
local($str) = @_;
$type = substr($str,length($str)-3,3);$type =~ tr /A-Z/a-z/;
local(@ext) = ('ppt','txt','xls','doc','htm','zip');
@value = grep(/$type/,@ext);
return "<img src=\"/images/spacer.gif\" border=0 width=13 height=25><img src=\"/images/icons/small/@value.gif\" border=0 width=25 height=24>\n";
}
#
Jerome O'Neil wrote in message <35325D75.C69735BF@cks.ssd.k12.wa.us>...
>Scott LeWarne wrote:
>
>> Line 17? You don't even know what is on line 17 of my script?
>> Are you trying to be funny? I don't get it?
>>
>
>I think that's the whole point, Scott. To sum up your complaint:
>
>I have a web server that barfs occasionaly with some CGI scripts written in
>Perl.
>
>Not much to go on there. What is your script supposed to do? How about some
>code? If you realy want to impress us, tell us what you have done to
>troubleshoot and debug up to this point. It's much easier to debug when you
>aren't asked to use the psychic method.
>
>
>> >I think you have an error in line 17.
>
>---
>Jerome O'Neil (joneil@cks.ssd.k12.wa.us)
>Seattle Public Schools (http://www.ssd.k12.wa.us)
>Information Services (Who I don't speak for)
>
>
------------------------------
Date: Mon, 13 Apr 1998 13:30:06 -0700
From: "Scott LeWarne" <Scott_LeWarne@BigFoot.com>
Subject: Re: Intermittent Perl problems
Message-Id: <6gttit$oc7@news.or.intel.com>
Problem solved!
Turns out it was the screen saver on the server causing the problem. When
it came on, the script stopped working. go figure!
Thanks for your responses, sorry for being so vague.
I will be more descriptive of my problems in the future.
thanks
Scott LeWarne
------------------------------
Date: Mon, 13 Apr 1998 16:02:04 -0400
From: Charles Engelke <cee123@ibm.net>
Subject: Re: looking for a good win32 perl editor.
Message-Id: <35326F3C.4C5@ibm.net>
James wrote:
>
> Hello all,
>
> I'm ready to pull my hair out.
>
> Any suggestions?
>
> jamesht@idt.net
The GWD Text Editor, available at http://www.iridis.com/gwd/ is
excellent. It includes Perl syntax coloring, regular expressions,
multiple windows, and C as its macro language. It's lightning fast, and
shareware. Registration is only $20, and very inexpensive site licenses
are available.
Charlie
------------------------------
Date: 13 Apr 1998 16:51:51 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: looking for a good win32 perl editor.
Message-Id: <7m4te6fc.fsf@mailhost.panix.com>
James <jamesht@idt.net> writes:
> Hello all,
>
> I'm ready to pull my hair out.
>
> Any suggestions?
Hi, James. I suggest that you get a good, firm grasp, as near to the
roots as possible, and then give a swift, hard tug. Hope this helps.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: 13 Apr 1998 18:56:40 GMT
From: smcdow@arlut.utexas.edu (Stuart McDow)
Subject: Re: Perl Compiler for NT
Message-Id: <6gtn58$agp$1@ns1.arlut.utexas.edu>
"Grinch" <grinch@whoville.com> writes:
>
> I choose to use the term "interpreter" because it comes closest to
> describing how perl works internally. The bytecodes used internally do not
> have a 1:1 correspondence to any machine language instructions with which I
> am familiar. Therefore, the bytecodes are being interpreted, and I choose to
> describe perl as an interpreter.
I know that this is getting into splitting hairs, but here goes
anyway. I consider an interpreter, like sh, rc, or however .bat files
work, something that executes the script one line at a time. It looks
at a line, parses it and tries to execute it, then moves on to the
next line. The interpeter has no knowledge of what is coming up
further in the script, be it a syntax error, valid code, or
gibberish. Perl, OTOH, compiles the entire script down to an internal
blob, and then runs the blob. If there's a syntax error (for instance)
in the script, you know about it *before* any functions or commands
are executed (ie, during the compilation phase). Not so with
interpreters. This is why 'perl -cw' works for code
checking. Compilation is also why perl scripts run many times faster
that interpreted scripts. That's the distinction. Very, very
different that /bin/sh.
> Maybe we need a new word? How about "perler?" Obviously, a "perler," would
> be a program that perls, and "perling" would be the act of executing a Perl
> script. Or is that a Perl program... damn... :-)
Maybe. :-)
--
Stuart McDow Applied Research Laboratories
smcdow@arlut.utexas.edu The University of Texas at Austin
"It is obvious that about 750,000 people ago, Austin was a wonderful City."
------------------------------
Date: 13 Apr 1998 18:56:12 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: split problem
Message-Id: <6gtn4c$rci$1@marina.cinenet.net>
scott (scott@rappahannock-web.com) wrote:
: Can anyone tell me what's going on with this...
[snip]
: while ($dbrows = <DATABASE>){
: ($one, $two, $three, $four, $five) = split (/\|/,$dbrows) || &Error;
:
: print "$dbrows<br>\n"; #this works ok, returns each record.
: print "$one<br>\n"; #this returns the number of fields.???? what i expected
: was the contents of the first field.
:
: print "$two<br>\n"; #this returns nothing
|| has higher precedence than =, so you're in effect doing a list
assignment to (split ... || &Error). Split in a scalar context (which it
is, since it is being used as a boolean value) returns the number of
fields. Since the number of fields is nonzero, this evaluates as 'true'
and short-circuits away evaluation of &Error, returning the field count as
the result of the || expression. This scalar value in the list context of
the assignment turns into a list of just that single scalar. Thus the
behavior you're seeing.
Use 'or' rather than || and your problem will go away.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Mon, 13 Apr 1998 19:27:44 GMT
From: althomas@together.net (Al Thomas)
Subject: Re: split problem
Message-Id: <353264f2.5200630@news.together.net>
On Mon, 13 Apr 1998 14:30:44 +0000, scott <scott@rappahannock-web.com>
wrote:
>Can anyone tell me what's going on with this...
>
>The DATABASE has five pipe delimited fields, each record separated by a newline.
>I wanted to split the records into fields, but all I can get is a count of the fields.
>
>
>open (DATABASE,"$db_file");
> while ($dbrows = <DATABASE>){
> ($one, $two, $three, $four, $five) = split (/\|/,$dbrows) || &Error;
^^^^^^^^
____________________ what happens if you alter this construct? Why?
>
<snip>
alt wei wu wei
------------------------------
Date: Mon, 13 Apr 1998 19:38:32 GMT
From: dgwilson@gte.net (Douglas Wilson)
Subject: Re: split problem
Message-Id: <6gtpbr$h8p$1@gte1.gte.net>
On Mon, 13 Apr 1998 14:30:44 +0000, scott <scott@rappahannock-web.com>
wrote:
>Can anyone tell me what's going on with this...
> ($one, $two, $three, $four, $five) = split (/\|/,$dbrows) || &Error;
you mean:
($one, $two, $three, $four, $five) = split (/\|/,$dbrows) or &Error;
but since you know there are only five fields, then it would
be more efficient as:
($one, $two, $three, $four, $five) = split (/\|/,$dbrows,5)
or &Error;
hope that helps,
Douglas Wilson
------------------------------
Date: Mon, 13 Apr 1998 19:19:06 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Subtle syntax error with "print" and sub references
Message-Id: <353266A7.6A4D@min.net>
William Annis wrote:
>
> print $fh &{$filter}("Cool"); # 2. Syntax error
I think perl's interpreting the ampersand as a bitwise 'and'.
John Porter
------------------------------
Date: Mon, 13 Apr 1998 16:55:39 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Tip: How to selectively quiet warnings
Message-Id: <1d7f2p3.hiuhth1m7w5k2N@slip-32-100-246-210.ny.us.ibm.net>
I have noticed the occasional wish for a way to select which -w warnings
you want. Well, if the warnings are generated at run-time, you can say
this:
{
local $^W = 0;
...warning-producing code...
}
If you want to quiet compile-time warnings, then:
BEGIN {$^W = 0}
...warning-producing code...
BEGIN {$^W = 1}
This works because BEGIN statements are executed as soon as the compiler
reaches them.
--
Kevin Reid. | Macintosh.
"I'm me." | Think different.
------------------------------
Date: Mon, 13 Apr 1998 12:14:16 -0700
From: Digital Puer <digital_puer@hotmail.com>
Subject: where are the examples in the newer (blue) camel book?
Message-Id: <35326408.7DAF556F@hotmail.com>
This is probably old hat. I just bought the blue camel book
"Programming Perl" after owning the older edition for the
longest time (I had gotten my perl 5 info off the net). I was
greatly disappointed that the new edition does not have a
section of examples like the older edition. The examples
of "common problems" was what got me into perl in the first
place. Are these examples in the new "Learning Perl" book?
If not, are they online somewhere?
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 2310
**************************************