[22199] in Perl-Users-Digest
Perl-Users Digest, Issue: 4420 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 17 11:06:55 2003
Date: Fri, 17 Jan 2003 08:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 17 Jan 2003 Volume: 10 Number: 4420
Today's topics:
*** HELP perl/cgi script help output~ <i.gabrie@mis.gla.ac.uk>
...sorry. my fault. <md0nilhe@mdstud.DIESPAMchalmers.se>
APL's relation to perl (ust\) a\(nother\)
Re: Append a text at the top an existing file <nobull@mail.com>
Re: Append a text at the top an existing file <jurgenex@hotmail.com>
code to read /var/mail/USER <rwbuentello@attbi.com>
Re: Code-page Browser Output <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Re: Code-page Browser Output <nobull@mail.com>
Re: Code-page Browser Output <flavell@mail.cern.ch>
Re: Code-page Browser Output <flavell@mail.cern.ch>
Re: Dereferencing a hashref? (Sara)
Re: Dereferencing a hashref? ctcgag@hotmail.com
duplicate check of composite hash key with sub field ra (qanda)
Re: Equivalent of /g for unpack? (jtd)
Extraction from variable <jon@rogers.tv>
Re: Extraction from variable (Tad McClellan)
Re: Extraction from variable <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
hi... Can't Compile Pernet (Elhanan Maayan)
Re: hi... Can't Compile Pernet <laocoon@eudoramail.com>
Re: HTML::Table conflict? <postmaster@127.0.0.1>
MAKE symbol missing (-)
Re: most popular unix scripting language (Sara)
Re: most popular unix scripting language (Juan C. Gil)
Re: newbie: Tk questions (a sensible and a stupid one) <olafdonk@wanadoo.nlQQQ>
Re: perl hashes seems to slow down (Sara)
poe and CloseEvent <david.zimmermann@icn.siemens.de>
poe and fork/ unknown parameters in POE::Wheel::Run <david.zimmermann@icn.siemens.de>
Re: poe and fork <david.zimmermann@icn.siemens.de>
Re: Question about high performance spidering in perl (Peter Scott)
thanks, but... <md0nilhe@mdstud.DIESPAMchalmers.se>
Uninitialised value in join or string issue <md0nilhe@mdstud.DIESPAMchalmers.se>
Re: Uninitialised value in join or string issue <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Re: Uninitialised value in join or string issue (Anno Siegel)
~ Urgently require a Webpage Hit counter script !!??~ <i.gabrie@mis.gla.ac.uk>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 17 Jan 2003 15:22:07 +0000
From: inderjit S Gabrie <i.gabrie@mis.gla.ac.uk>
Subject: *** HELP perl/cgi script help output~
Message-Id: <3E281F9F.B4B34FBC@mis.gla.ac.uk>
Hi all
I am writing a perl/cgi script which will display a simple counter on a
webpage and
will also put the output to a file but i can not get it going, it has
ssi enabled and i am
using perl installed on unix system...will i try to call it from my
.shtml file by <!--exec
cgi="/cgi-bin/count.cgi"--> etc etc i get the error " error processing
directive ", any
ideas where i am going wrong ...my script below, please feel free to
alster and give
me answers where i am might be going wrong...i also want to include the
option
where by i can not show it on webpage (invisible) and would also prefer
if the hits
can be emailed to me e.g. date - Ip no:..what page was viewed with time
stamp etc
etc...thanks in advance, can this be done ...thanks again...indy
my main script...
#!/usr/local/bin/perl
#######################################################
# Counter version 1.0 #
# #
# This counts the number of users that access your #
# page. #
#######################################################
#Change Variables
$count = '/mnt/web/guide/aestheticsurgerycenter/test/count.dat';
$base_url = 'http://www.aestheticsurgerycenter.com/test/';
$your_ip = "0.0.0.0";
$gif = '.gif';
##############################################
if ($ENV{'REMOTE_ADDR'} eq $your_ip) {
}
else {
print "Content-type: text/html\n\n";
open (COUNT, "$count");
$counter = <COUNT>;
close (COUNT);
open (COUNT, ">$count");
$counter += 1;
print COUNT "$counter";
@indivual = split(//, $counter);
foreach $number (@indivual) {
$output = "<img src=\"$base_url$number$gif\" alt=\"$CNum\">";
print $output;
}
close (COUNT);
}
Addional notes about my script..
count.cgi - chmod 755
counter.dat - chmod 766
################################
######################
#Changed the following#
######################
#This excludes YOUR computer from affecting the 'counter.dat' &
#the 'log.dat' files from being updated when you call the page.
#If so, enter your IP address. Otherwise, enter "0"
$your_ip = "000.000.000.000";
#This is the directory where your 'counter.dat'
#files will be kept.
$base_url = "/mnt/web/guide/aestheticsurgerycenter/";
#This 'counter.dat' file will only count the number of hits,
$count = "counter.dat";
#This is the URL of where you are keeping the graphics.
$base_url = "http://yourname.com/images/";
#This is for the '.gif' extension. DON'T TOUCH
###########################################
Also, you need to add the following line to your '.html' page,
and change the extension from '.html' to '.shtml'.
<!--#exec cgi="http://www.yourdoamin.com/count.cgi"-->
-or-
<!--#exec cgi="/count.cgi"-->
################################
I am getting the above when i include the above commands in my .shtml
file....any
ideas...please feel free to modify...thanks again...indy
------------------------------
Date: Fri, 17 Jan 2003 15:00:42 +0100
From: henrik nilsson <md0nilhe@mdstud.DIESPAMchalmers.se>
Subject: ...sorry. my fault.
Message-Id: <3E280C8A.8070402@mdstud.DIESPAMchalmers.se>
sorry. my fault. should have waited 5 more min with posting that
message. you were right.
thanks again,
henrik n
------------------------------
Date: Fri, 17 Jan 2003 11:16:39 GMT
From: "J\(ust\) a\(nother\) phet" <japhet@hushhushmail.com>
Subject: APL's relation to perl
Message-Id: <rCRV9.24893$ZE1.524843@news1.nokia.com>
Long lost cousins?
Has perl herited anything from APL?
If not should it?!
------------------------------
Date: 17 Jan 2003 12:13:42 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Append a text at the top an existing file
Message-Id: <u9vg0oas95.fsf@wcl-l.bham.ac.uk>
romuald_favre@hotmail.com (Romuald Favre) writes:
> Subject: Append a text at the top an existing file
This is FAQ: "How do I [...] append to the beginning of a file?"
> Thanks in advance for your help !
If you are going to do anything "in advance" it sould be check the FAQ.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 17 Jan 2003 15:16:47 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Append a text at the top an existing file
Message-Id: <z7VV9.7991$zH5.4465@nwrddc03.gnilink.net>
Romuald Favre wrote:
> Instead of appending a text at the bottom of file (with the statement
> open (FILE,'>> file.txt')) , I have to append this text at the top of
> a file.
>
> Is it another character than ">>" I could us in order to have the
> appending happening at the top of the file ?
Which part of PerlFAQ5 "How do I change one line in a file/delete a line in
a file/insert a line in the middle of a file/append to the beginning of a
file?" is unclear and needs improvement?
jue
------------------------------
Date: Fri, 17 Jan 2003 16:01:06 GMT
From: "Rich Buentello" <rwbuentello@attbi.com>
Subject: code to read /var/mail/USER
Message-Id: <6NVV9.593268$GR5.381437@rwcrnsc51.ops.asp.att.net>
Does anyone have any code to read /var/mail/USER. I need a way to determine
if mail bounced or had any other errors.
------------------------------
Date: Fri, 17 Jan 2003 12:17:18 +0100
From: Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Subject: Re: Code-page Browser Output
Message-Id: <newscache$ucvu8h$6db$1@news.emea.compuware.com>
Dale wrote (Friday 17 January 2003 12:00):
[snip]
> Here's the question. Is it possible to include the code-page
> information in the 'Content-type' line such as
>
> print "Content-type: application/x-msexcel Code-page:
> windows-1256\n\n";
>
> or something similar? Or is there another way of accomplishing what I
> want?
>
> Any help much appreciated
>
> DRE
What is your Perl question? You should be looking up the HTTP/HTML/whatever
specs at w3.org
--
KP
------------------------------
Date: 17 Jan 2003 12:06:43 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Code-page Browser Output
Message-Id: <u93cnsc758.fsf@wcl-l.bham.ac.uk>
desau@aisc.ac.cy (Dale) writes:
> Newsgroups: comp.lang.perl.misc
This is a Perl newsgroup. In this newsgroup we discuss things that
relate in some way to Perl. The fact that the question happened to
occur to you while you had a Perl program in front of you does not
make it a question about Perl any more than the fact that the question
happened to occur to you while you had a cup of coffee in front of you
would make it a question about coffee.
> Here's the question. Is it possible to include the code-page
> information in the 'Content-type' line such as
>
> print "Content-type: application/x-msexcel Code-page:
> windows-1256\n\n";
>
> or something similar?
This is purely a question about the syntax of the MIME Content-type
header and the definition of MIME type application/x-msexcel.
How could you even imagine if could have the slightest thing to do
with Perl?
BTW: did you try the obvious guess?
print "Content-type: application/x-msexcel; charset=windows-1256\n\n"
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 17 Jan 2003 12:55:13 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Code-page Browser Output
Message-Id: <Pine.LNX.4.40.0301171238430.26236-100000@lxplus072.cern.ch>
On Jan 17, Dale inscribed on the eternal scroll:
> Here's the question. Is it possible to include the code-page
> information in the 'Content-type' line such as
>
> print "Content-type: application/x-msexcel Code-page:
> windows-1256\n\n";
This appears to be intended as HTTP information included in a CGI
response header. For this, as it happens, you don't need the CGI
specification itself: HTTP is defined in RFC2616. Content types are
registered in the IANA registry. None of this has anything specific
to the Perl language, so you're in the wrong place and thus you risk
getting unreliable answers. YMMV.
But for my money, comma-separated values are not a Microsoft
proprietary application. Curiously, there is no registered
content-type for them, but by analogy with text/tab-separated-values
it might be opportune to call them text/x-comma-separated-values.
So if you're using windows-1256 (not that I'd want to encourage the
use of microsoft-proprietary character codings) that would then become
text/x-comma-separated-values; charset=windows-1256
It would remain to be seen whether your application is sufficiently
Internet-aware to be able to deal with that, though. Again I must
emphasise that this has nothing to do with Perl as a programming
language: it would be the same if you were programming in C or COBOL
or whatever. If you're interested in a WWW-wide answer, you should be
somewhere on comp.infosystems.www.* , whereas if you want a
Microsoft-specific answer maybe you should be asking in a
microsoft-specific hierarchy.
------------------------------
Date: Fri, 17 Jan 2003 13:33:14 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Code-page Browser Output
Message-Id: <Pine.LNX.4.40.0301171312310.26236-100000@lxplus072.cern.ch>
On Jan 17, Brian McCauley inscribed on the eternal scroll:
> print "Content-type: application/x-msexcel; charset=windows-1256\n\n"
Despite this being, as you said, off-topic for c.l.perl.* ...
There is an IANA-registered type, application/vnd.ms-excel
So it would seem improper to use an x- type for the proprietary excel
format, if indeed the proprietary format was the right one to use.
However, as I understand it, CSV is a portable text format, not a
proprietary ms-excel format, so in a WWW context it ought to be
properly announced as what it is, rather than trying to fool the
recipient into starting a particular application to process it.
Odd, though, that although tab-separated format has an IANA-registered
content type, comma-separated does not.
[x-posted and f'ups suggested]
------------------------------
Date: 17 Jan 2003 05:34:49 -0800
From: genericax@hotmail.com (Sara)
Subject: Re: Dereferencing a hashref?
Message-Id: <776e0325.0301170534.4f110596@posting.google.com>
Michael Budash <mbudash@sonic.net> wrote in message news:<mbudash-D8313B.23194216012003@typhoon.sonic.net>...
> In article <b08a8a$l9e$1@news6.svr.pol.co.uk>,
> "Jeff Snoxell" <Jeff@aetherweb.co.uk> wrote:
>
> > > Hi,
> > > > I've got a hashref (from a DBI fetchrow_hashref() call) and I want to
> take a
> copy of it. I'm currently doing this:
> > > > my %hashcopy = %$hashref;
> > > > Is this the 'correct' way to do this?
> > > > Thanks,
> > > > > Jeff Snoxell
> > > >
> >
> > why not just:
> > my $hashrefcopy = $hashref;
> > or did you have some reason for an actual hash rather than a ref?
> >
> > Yeah, the original ref is not stable (it's returned from a DBI
> > fetchrow_hashref request).
>
> not stable? sorry, that may be a term i haven't learned yet
> (seriously)... anybody else?
>
> > See my next post.
>
> i did... and i'm as curious as you about this...
>
> abigail!??
>
> hth-
He said he wanted a copy of the hash, not one of a reference to it.
Making a copy of the ref is pretty much useless isn't it? Unless he
things the reference itself can get changed.
By instability I suspect he meant that the hash values and keys are
subject to change and he wanted a snapshot of it at that particular
time...
------------------------------
Yes, you instantiated a copy properly -
my %h=%$href;
I like the way that was implemented don't you? It looks just as it
behaves. This, on the other hand, isn't so pretty
my $h=%{$_[0]};
Yeech..
As far as refs though- they are very nice to work with, and I avoid
instantaition whenever possible. Have you used anonymous hashes? Very
nice stuff-
my $href={};
$href->{cat}='dog';
You don't have to deal with %-syntax at all, and the ref can be passed
around as args just like any scalar.
Cheers,
Gx
------------------------------
Date: 17 Jan 2003 15:44:14 GMT
From: ctcgag@hotmail.com
Subject: Re: Dereferencing a hashref?
Message-Id: <20030117104414.453$Co@newsreader.com>
Michael Budash <mbudash@sonic.net> wrote:
> In article <b08a8a$l9e$1@news6.svr.pol.co.uk>,
> "Jeff Snoxell" <Jeff@aetherweb.co.uk> wrote:
>
> > > Hi,
> > > > I've got a hashref (from a DBI fetchrow_hashref() call) and I
> > > > want to
> > take a
> > > copy of it. I'm currently doing this:
> > > > my %hashcopy = %$hashref;
Yes, that is correct.
> >
> > Yeah, the original ref is not stable (it's returned from a DBI
> > fetchrow_hashref request).
>
> not stable? sorry, that may be a term i haven't learned yet
> (seriously)... anybody else?
I believe what he means is that DBI might not just pass back a hashref, but
also retain an internal hashref to the same hash, as well. This
means that DBI can go behind his back and diddle with the hash without
his permission, so he wants to make a defensive copy.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service New Rate! $9.95/Month 50GB
------------------------------
Date: 17 Jan 2003 05:31:00 -0800
From: fumail@freeuk.com (qanda)
Subject: duplicate check of composite hash key with sub field range
Message-Id: <62b4710f.0301170531.775211e3@posting.google.com>
Hi all, I've returned to some work on a previous post. I have the
following which works fine with the second __DATA__ set ...
#!/usr/bin/perl
use strict;
use warnings;
dup_chk();
sub dup_chk{
use Time::Local;
my %f1_keys;
my %f2_keys;
while( <DATA> ) {
my @flds = split( /,/, $_, -1 );
$flds[7] += 3; # Need to modify some fields.
my $f2 = $flds[2]; # Keep key fields.
my $f3 = $flds[3];
my $f5 = $flds[5];
my $rec = join ',', @flds; # Re-join split fields.
# Simulate 2 files using first field of __DATA__ lines.
if( $flds[0] eq "file1" ) {
if( exists $f1_keys{$f2,$f3,$f5} ) {
print STDOUT "Duplicate: $rec";
}
else {
chomp $rec;
$f1_keys{$f2,$f3,$f5} = $rec; # Load unique record.
}
}
else {
if( exists $f2_keys{$f2,$f3,$f5} ) {
print STDOUT "Duplicate: $rec";
}
else {
chomp $rec;
$f2_keys{$f2,$f3,$f5} = $rec; # Load unique record.
}
}
}
print STDOUT "File1 unique recs (key:value):-\n";
for my $key( keys %f1_keys ) {
print STDOUT "$key:$f1_keys{$key}\n";
}
print STDOUT "File2 unique recs (key:value):-\n";
for my $key( keys %f2_keys ) {
print STDOUT "$key:$f2_keys{$key}\n";
}
# Resolve records.
foreach my $key( keys %f1_keys ) {
if( exists $f2_keys{$key} ) {
print STDOUT "Resolved:$f1_keys{$key}-$f2_keys{$key}\n";
delete $f1_keys{$key};
delete $f2_keys{$key};
}
else {
print STDOUT "Unresolved file1:$f1_keys{$key}\n";
}
}
# Any records left in f2_keys are unresolved.
foreach my $key( keys %f2_keys ) {
print STDOUT "Unresolved file2:$f2_keys{$key}\n";
}
}
# Cut down version of original records.
=pod
__DATA__
file1,r1,c1,100,f5,200,f7,1,uniq
file1,r2,c2,130,f5,230,f7,3,uniq
file1,r3,c1,120,f5,220,f7,5,uniq
file1,r4,c1,100,f5,200,f7,7,dup_r1
file1,r5,c1,100,f5,210,f7,9,dup_r1
file1,r6,c1,110,f5,200,f7,11,dup_r1
file2,r1,c1,101,f5,202,f7,2,uniq,resolve_r1
file2,r2,c1,119,f5,221,f7,6,uniq,resolve_r3
file2,r3,c2,132,f5,233,f7,4,uniq,resolve_r2
file2,r4,c1,103,f5,201,f7,8,dup_r1
file2,r5,c1,101,f5,207,f7,10,dup_r1
file2,r6,c1,110,f5,203,f7,12,dup_r1
file2,r7,c1,140,f5,223,f7,12,dup_r2
=cut
__DATA__
file1,r1,c1,100,f5,200,f7,1,uniq
file1,r2,c2,130,f5,230,f7,3,uniq
file1,r3,c1,120,f5,220,f7,5,uniq
file1,r4,c1,100,f5,200,f7,7,dup_r1
file2,r1,c1,100,f5,200,f7,2,uniq,resolve_r1
file2,r2,c1,120,f5,220,f7,6,uniq,resolve_r3
file2,r3,c2,130,f5,230,f7,4,uniq,resolve_r2
file2,r4,c1,100,f5,200,f7,8,dup_r1
My problem is that I must now use a range factor for checking fields 4
and 6 in file2 records. The commented out DATA section shows the data
and desired result if we have a factor of 5. So in file2 records,
record 4 is a duplicate because field3 matches record1, field 4 +- 5
matches or field 6 +- 5 matches.
I could do with some help on adding these changes and also any
comments on the existing skeleton code. I was thinking of looping
through where I resolve the records to extract the sub-fields of the
key but don't know if this can be done, ie after after the key is
created at a later point break it back down into the 3 sub-fields. I
could then access the last 2 parts of the key to apply the factor
checking?
Again, any help would be greatly appreciated.
Thanks.
------------------------------
Date: 17 Jan 2003 07:25:36 -0800
From: adwser@hotmail.com (jtd)
Subject: Re: Equivalent of /g for unpack?
Message-Id: <c57c103.0301170725.bfd8533@posting.google.com>
Benjamin Goldberg <goldbb2@earthlink.net> wrote in message news:
> Reading from a file, then performing substr() on the data sounds rather
> innefficient.
>
> You probably want something like this:
Thanks, can I do something similar with strings in memory? I need to
separate unpacking from file access for a number of reasons.
------------------------------
Date: Fri, 17 Jan 2003 16:39:43 +0100
From: Jon Rogers <jon@rogers.tv>
Subject: Extraction from variable
Message-Id: <3E2823BF.C5AAC9E2@rogers.tv>
If I from
$var="abcdef12376&%%€%##56/)&";
would like to extract only the letters and the digits, how should I do what?
/ Jonas
------------------------------
Date: Fri, 17 Jan 2003 09:39:23 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Extraction from variable
Message-Id: <slrnb2g8tb.4lv.tadmc@magna.augustmail.com>
Jon Rogers <jon@rogers.tv> wrote:
> If I from
> $var="abcdef12376&%%€%##56/)&";
> would like to extract only the letters and the digits, how should I do what?
$var =~ s/[^a-zA-Z0-9]+//g;
or if you don't mind leaving underscores in:
$var =~ s/\W+//g;
or if you don't want to mangle the value of $var:
my $var1 = join '', $var =~ /([a-zA-Z0-9]+)/g;
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 17 Jan 2003 16:46:59 +0100
From: Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Subject: Re: Extraction from variable
Message-Id: <newscache$bu7v8h$ifb$1@news.emea.compuware.com>
Jon Rogers wrote (Friday 17 January 2003 16:39):
> If I from
> $var="abcdef12376&%%€%##56/)&";
> would like to extract only the letters and the digits, how should I do
> what? / Jonas
One possible solution is:
my $partly = join ("", $var =~ /\w/g );
Read "perldoc perlop" on "Regexp Quote-Like Operators" to for the /g option.
--
KP
------------------------------
Date: 17 Jan 2003 05:23:55 -0800
From: emaayan@hotmail.com (Elhanan Maayan)
Subject: hi... Can't Compile Pernet
Message-Id: <ec817d75.0301170523.1122d35d@posting.google.com>
hello
i'm trying to compile the folliwing using PLC with Perl Dev kit 5.
use namespace "System";
use PerNET qw(AUTOCALL);
Console->WriteLine("Hello World");
but the compilation failed with the following error:
PerNET.pm:
error: Can't locate PerNET.pm
refby: pnettest.pl
i reallly don't pernet.pm on my machine, even though i installed the dev kit
------------------------------
Date: Fri, 17 Jan 2003 16:16:02 +0100
From: Lao Coon <laocoon@eudoramail.com>
Subject: Re: hi... Can't Compile Pernet
Message-Id: <Xns9306A583D835CLaocoon@62.153.159.134>
emaayan@hotmail.com (Elhanan Maayan) wrote in
news:ec817d75.0301170523.1122d35d@posting.google.com:
> hello
>
> i'm trying to compile the folliwing using PLC with Perl Dev kit 5.
>
> use namespace "System";
> use PerNET qw(AUTOCALL);
>
> Console->WriteLine("Hello World");
>
> but the compilation failed with the following error:
>
> PerNET.pm:
> error: Can't locate PerNET.pm
> refby: pnettest.pl
>
>
> i reallly don't pernet.pm on my machine, even though i installed the
> dev kit
Besides that this isn't really on-topic here.. don't you mean "PerlNet" ?
------------------------------
Date: Fri, 17 Jan 2003 13:25:08 +0000
From: Anthony Peacock <postmaster@127.0.0.1>
Subject: Re: HTML::Table conflict?
Message-Id: <3E280434.CA8BA953@127.0.0.1>
noone@annon.com wrote:
>
> Anthony Peacock wrote:
> [snip]
> > Jurgen's advise is spot on. The first thing to look at is the server
> > log file for error messages. Next, when you say 'it doesn't render' do
> > you mean you get a blank browser window or do you get an error message?
> > If the window is blank, look at the page source, this will often give
> > you a clue as to which bit of the HTML document the browser barfed at.
>
> The server logs show nothing out of the ordinary.
>
> The webpage comes up blank, if I "view source" it's essentially HTML headers
> with nothing in the body.
OK! But that implies that your code runs beyond the snippet you
originally showed us, as that did not print anything out at all. And if
that snippet had failed at the 'use HTML::Table;' line I would have
expected you to get a '500 internal server error' message.
However, see my lack of knowledge about the server you are running
below...
> > If you manage to narrow this down, please post back your findings, in
> > case there is a dependency in HTML::Table that I can fix.
>
> The problem appears to be with the CGI server (Sambar V4.1). The work around
> is to put HTML/Table.pm in the directory with the Perl script.
I have not come acrosss a web/CGI server calle Sambar V4.1, so I cannot
comment on this.
> Why it doesn't work without this is a mystery:
>
> perl -e "print join \"\n\", @INC" gives
>
> C:/Program Files/Perl/lib
> C:/Program Files/Perl/site/lib
> .
>
> and HTML/Table.pm *is indeed* in site/lib. So how and why the script picks up
> Table.pm from site/lib when run from the command line, but NOT when executed
> by the CGI server is a mystery -- espcially given that the server picks up
> the other modules (DBI and CGI) without a problem.
>
> I realize this posting is off topic, but I am responding to Anthony's
> request about posting my findings. At this point I don't believe the problem
> is Perl or Table.pm.
I do think this is off topic, and it looks more like a permissions
problem to me at this stage. What user does your web/CGI server run
at? Is it the same as the one you log in interactively with? Does the
web/CGI server user have permission to view the HTML/Table.pm file and
directory?
------------------------------
Date: 17 Jan 2003 07:15:46 -0800
From: cbdeja@my-deja.com (-)
Subject: MAKE symbol missing
Message-Id: <611952a3.0301170715.7e913f2b@posting.google.com>
I'm trying to build perl 5.6.1 on Solaris 2.8 in 64 bit mode. All
seems fine until:
Run make depend now? [y]
sh ./makdepend MAKE=
./makdepend: clist: not found
Searching for .c files
..... <several "Finding depandancies" lines> .....
./makedepend: shlist: not found
Searching for .SH files...
Updating makefile...
test -s perlmain.c && touch perlmain.c
*** Error code 1 (ignored)
cd x2p; depend
sh: depend: not found
*** Error code 1
make: fatal error: command failed for target `depend'
It seems to start going wrong because the second line should end in
MAKE=make and not simply MAKE=
Subsequent errors occur because there is no longer a MAKE symbol, so
the line
cd x2p; depend
should read
cd x2p;make depend
and so on.
I thought that make was supposed to always set MAKE=make and so should
never be lost as in the above.
Does anyone know what is going wrong here?
P.S. I've just tried building it again, but have set an environment
variable MAKE=make in my shell before building. This seems to have
worked, but it should not be necessary. Perhaps there is a bug in the
perl installation scripts?
Thanks
Colin
------------------------------
Date: 17 Jan 2003 05:44:57 -0800
From: genericax@hotmail.com (Sara)
Subject: Re: most popular unix scripting language
Message-Id: <776e0325.0301170544.2ad99f94@posting.google.com>
claird@lairds.com (Cameron Laird) wrote in message news:<v2ekbhldaj4mf0@corp.supernews.com>...
> In article <f51c02db.0301161617.3622cfaa@posting.google.com>,
> dambalaMaster <dorli@hotmail.com> wrote:
> >does anyone know which is the most popular unix scripting language?
> >
> >xp829
>
> Yes. Several hundreds of thousands of people know, and,
> between them, they only come up with about two dozen
> different answers.
Accordind to DICE/monster, Perl IS the hands-down winner. Larry gets
the prize haha.. Although javascript is frightenly close. Take heart
though Perlistas- now that the DOJ ordered Mickeysoft to support java,
it'll be worthless to 90% of the technical community. The
business-geeks will love it though...
> monster.com dice.com %
>
> SQL 5000 2486 24.06%
>
> ASP 2156 2480 14.90%
>
> Java 2664 1862 14.55%
>
> C++ 2046 1480 11.33%
>
> Visual Basic 2037 1095 10.07%
>
> Perl 925 548 4.73%
>
> Javascript 914 489 4.51%
>
> Cobol 595 532 3.62%
>
> SAS 805 269 3.45%
------------------------------
Date: 17 Jan 2003 06:43:22 -0800
From: jgil@gmv.es (Juan C. Gil)
Subject: Re: most popular unix scripting language
Message-Id: <82d7542c.0301170643.1ff7ba64@posting.google.com>
>
> >:> >does anyone know which is the most popular unix scripting language?
>
> >:sh
> >
> > Are you measuring by:
> > A) number of scripts written,
> > B) enthusiasm level of script authors, or
> > C) number of distinct script authors?
>
>
> By length of the scripting language's name. :-)
>
> So sh is going to be hard to beat (because C is compiled) :-) :-)
>
Among two letters, I find it funny KA, the Klingon
academy scripting language
(http://solo14.abac.com/bmoler/missions_ka.html)
There is a promising D compiled language
(http://www.digitalmars.com/d/), but there is also
a "D scripting language"
(http://www.google.com/search?q=%22the+d+scripting+language%22).
Other one letter scripting languages include:
"E" (http://www.google.com/search?q=%22e+scripting+language%22),
"K" (www.hdiglobal.com/hdi.htm),
"L" (http://www.geocities.com/tablizer/L.htm),
"M" (http://www.google.com/search?q=%22m+scripting+language%22)
I quit here. What's my prize?
Juan Carlos---
------------------------------
Date: Fri, 17 Jan 2003 16:24:32 +0100
From: olaf <olafdonk@wanadoo.nlQQQ>
Subject: Re: newbie: Tk questions (a sensible and a stupid one)
Message-Id: <pan.2003.01.17.15.24.32.271023.1175@wanadoo.nlQQQ>
thanks all, problem solved, Olaf
------------------------------
Date: 17 Jan 2003 05:39:27 -0800
From: genericax@hotmail.com (Sara)
Subject: Re: perl hashes seems to slow down
Message-Id: <776e0325.0301170539.6fcf498c@posting.google.com>
Benjamin Goldberg <goldbb2@earthlink.net> wrote in message news:<3E277B9C.78A38283@earthlink.net>...
> nayeem wrote:
> >
> > fellow japhs,
> > ive been using perl hashes for a recent project, but it seems for some
> > reason it gives a speed issue when i am browsing through the hash.
> > the hash is roughly the following structure :
> >
> > $rs = {'SUGGESTED_WORDS' => [
> > {'NAME' => '...'},
> > {'NAME' => '...'},
> > {'NAME' => '...'},
> > {'NAME' => '...'},
> > ...
> > > any comments/suggestions/ideas/criticisms would be most appreciated.
>
> I would suggest:
>
> foreach my $word ( @{$rs->{SUGGESTED_WORDS}} ) {
> $word->{URL} = "abc";
> }
>
> A foreach loop is generally much faster than a C-style for(;;) loop.
>
> In addition, I would suggest profiling your code, using Devel::DProf,
> and finding out which parts actually *need* optomization, due to your
> program spending lots of time in them, rather than guessing what needs
> to be sped up.
tied hashes sure do- try a GDBM with like 50,000 values. Talk about SLOW!
------------------------------
Date: Fri, 17 Jan 2003 15:27:36 +0100
From: David Zimmermann <david.zimmermann@icn.siemens.de>
Subject: poe and CloseEvent
Message-Id: <3E2812D8.D1A9410A@icn.siemens.de>
Hello *,
I use the POE Module to fork
but when I use the CloseEvent Parameter,
my $task = POE::Wheel::Run->new
( Program => sub { do_stuff($next_task) },
StdoutFilter => POE::Filter::Reference->new(),
StdoutEvent => "task_result",
StderrFilter => POE::Filter::Reference->new(),
StderrEvent => "task_debug",
CloseEvent => "task_done",
<<<<<<<<<<<<<
);
i get an errormessage
unknown parameters in POE::Wheel::Run
#debuger
# Make sure the user didn't pass in parameters we're not aware of
146: if (scalar keys %params) {
147: carp( "unknown parameters in $type constructor call: ",
DB<14> x %params
0 'CloseEvent'
1 'task_done'
all forks works fine, but the CloseEvent don't work (execute)
plz help
thx
------------------------------
Date: Fri, 17 Jan 2003 14:02:13 +0100
From: David Zimmermann <david.zimmermann@icn.siemens.de>
Subject: poe and fork/ unknown parameters in POE::Wheel::Run
Message-Id: <3E27FED5.9A0C781C@icn.siemens.de>
Rocco Caputo wrote:
> On Tue, 14 Jan 2003 17:07:08 +0100, David Zimmermann wrote:
> > hello *,
>
> Hi, David! :)
>
> > I would like to execute a program on 100 computers
> >
> > someone can give me an example how i can fork with the poe module
> > (POE::Filter::Reference ??)
>
> I assume you're spawning 100 instances of ssh or something to execute
> remote commands. One of the examples in POE's "cookbook" might help.
>
> http://poe.perl.org/?POE_Cookbook
>
> In particular, one of these examples might help.
>
> http://poe.perl.org/?POE_Cookbook/Child_Processes_2
> http://poe.perl.org/?POE_Cookbook/Child_Processes_3
>
> Specifying the problem in more detail would help. You may contact me
> via e-mail if you cannot discuss the program's details in public.
>
> -- Rocco Caputo - troc@pobox.com - http://poe.perl.org/
Hello ,
if I execute the example
I get the following error message
#code
my $task = POE::Wheel::Run->new
( Program => sub { do_stuff($next_task) },
StdoutEvent => "task_result",
StderrFilter => POE::Filter::Reference->new(),
StderrEvent => "task_debug",
CloseEvent => "task_done",
);
errormeassage
POE::Wheel::Run needs either Filter or StdoutFilter
if I set a filter
my $task = POE::Wheel::Run->new
( Program => sub { do_stuff($next_task) },
StdoutFilter => POE::Filter::Reference->new(),
StdoutEvent => "task_result",
StderrFilter => POE::Filter::Reference->new(),
StderrEvent => "task_debug",
CloseEvent => "task_done",
);
I get again an error message
unknown parameters in POE::Wheel::Run constructor call: CloseEvent
what is wrong?
thx
David
------------------------------
Date: Fri, 17 Jan 2003 12:18:37 +0100
From: David Zimmermann <david.zimmermann@icn.siemens.de>
Subject: Re: poe and fork
Message-Id: <3E27E68D.21DE4D0@icn.siemens.de>
Rocco Caputo wrote:
> On Tue, 14 Jan 2003 17:07:08 +0100, David Zimmermann wrote:
> > hello *,
>
> Hi, David! :)
>
> > I would like to execute a program on 100 computers
> >
> > someone can give me an example how i can fork with the poe module
> > (POE::Filter::Reference ??)
>
> I assume you're spawning 100 instances of ssh or something to execute
> remote commands. One of the examples in POE's "cookbook" might help.
>
> http://poe.perl.org/?POE_Cookbook
>
> In particular, one of these examples might help.
>
> http://poe.perl.org/?POE_Cookbook/Child_Processes_2
> http://poe.perl.org/?POE_Cookbook/Child_Processes_3
>
> Specifying the problem in more detail would help. You may contact me
> via e-mail if you cannot discuss the program's details in public.
>
> -- Rocco Caputo - troc@pobox.com - http://poe.perl.org/
Hello ,
if I execute the example
I get the following error message
#code
my $task = POE::Wheel::Run->new
( Program => sub { do_stuff($next_task) },
StdoutEvent => "task_result",
StderrFilter => POE::Filter::Reference->new(),
StderrEvent => "task_debug",
CloseEvent => "task_done",
);
errormeassage
POE::Wheel::Run needs either Filter or StdoutFilter
if I set a filter
my $task = POE::Wheel::Run->new
( Program => sub { do_stuff($next_task) },
StdoutFilter => POE::Filter::Reference->new(),
StdoutEvent => "task_result",
StderrFilter => POE::Filter::Reference->new(),
StderrEvent => "task_debug",
CloseEvent => "task_done",
);
I get again an error message
unknown parameters in POE::Wheel::Run constructor call: CloseEvent
what is wrong?
thx
David
------------------------------
Date: Fri, 17 Jan 2003 14:05:08 GMT
From: peter@PSDT.com (Peter Scott)
Subject: Re: Question about high performance spidering in perl
Message-Id: <o4UV9.52286$sV3.2825305@news3.calgary.shaw.ca>
In article <sfrd2v8j72sh47f0mujm7v0ovsn9o953v0@4ax.com>,
Extended Partition <extendedpartition@NOSPAM.yahoo.com> writes:
><snip>
>>> EP> I considered that. But my client has some specialized requirements
>>> EP> that would require an almost total rewrite of an existing package.
>>
>>What specialized requirements does your client have that make you think
>>that it won't be easier to either use existing customization hooks in
>>Harvest-NG or to diddle its source?
>
>This particular client has a lot of "security" considerations and
>using an already developed open source package just doesn't appeal to
>them. I called them up this morning and brought it up and their answer
>was a simple "absolutely not". I might, however, use Harvest-NG as a
>base for my own project to get ideas, algorithms, etc.
I am really curious. Can you share some of these considerations? The only
requirements I can imagine being imposed on crawling that are not addressed
by existing products and deserve the label "security" would be an
environment where the resources have access controls on them which have to
be somehow ascertained and stored as metadata by the crawler. Or where
you have to determine accessibility from a variety of domains and
integrate this information in the global metadata. But this would only be
useful if it also had to be known by a query engine and you haven't
suggested that there even is a query engine for this application.
>>What he said. I haven't written a crawler, but I have spent several
>>years evaluating, tuning, customizing, integrating, and hacking a number
>>of different crawlers running in a large application. Crawling is far
>>more involved than most people suspect.
>
>I'm learning that. To be honest when I accepted this project I was
>under the assumption that I was facing a few weeks worth of work. Now
>I realize it'll be more like several months if I'm lucky.
Try person-years.
What I am trying to figure out is what you were asking us for. You wanted
references to Perl code and techniques for web crawling. Yet somehow you
have requirements so different from the usual ones that you cannot use a
highly configurable open source package. This suggests that you are doing
something sufficiently different from the general notion of web crawling
as to render any answer to your question useless without specific
information on your unique requirements, which you are rather coy about.
Your client isn't the NSA/CIA/Dept of Homeland Security, is it?
--
Peter Scott
http://www.perldebugged.com
------------------------------
Date: Fri, 17 Jan 2003 14:54:34 +0100
From: henrik nilsson <md0nilhe@mdstud.DIESPAMchalmers.se>
Subject: thanks, but...
Message-Id: <3E280B1A.9050305@mdstud.DIESPAMchalmers.se>
Thank you both for your kind replies. I see the problem now: empty is
not the same as undefined. Surprisingly, I still cannot get rid of the
problem.
Just to make things clear:
1. unless the user has specified $authorcode from the beginning (i.e.,
filled out the html form), the script exits. This works nicely with
unless ($authorcode) { ...}
2. i then remove illegal characters (everything not from the alphabet)
from $authorcode. works.
3. i then wish to check if there's ANY characters left in $authorcode
after the removal of illegal characters (without having error messages
written to my apache log).
4. of course, to test it, i use only illegal characters in $authorcode,
so that all characters are removed.
and i seem to be unable to accomplish this seemingly trivial task. do
you know why? again, there is no error in the HTML output.
this is what i have tried, after cleaning $authorcode from illegal
characters:
unless (length $authorcode) {print "html known to be good"; exit;}
->
Use of uninitialised ...
unless ($authorcode) { ... same as above ... }
->
Use of unitial...
As it turns out, it passes the following:
unless (defined $authorcode) { ... exit; }
as you pointed out, this is expected to happen. $authorcode is defined
all right. However, the next line:
if (length $authorcode <=2) { ... exit;}
now returns the Use of unintlialised ... message. i just pushed the
error message one line down. I want to stop the code from continuing if
there are no characters in $authorcode.
Thanks for your kind help,
Henrik N
------------------------------
Date: Fri, 17 Jan 2003 12:13:57 +0100
From: henrik nilsson <md0nilhe@mdstud.DIESPAMchalmers.se>
Subject: Uninitialised value in join or string issue
Message-Id: <3E27E575.2060407@mdstud.DIESPAMchalmers.se>
When I run these lines from a CLI window, everything works fine.
(it is a cgi script. $authorcode is normally specified by the user)
my $authorcode = 333;
$authorcode =~ tr/ABCDEFGHIJKLMNOPQRSTUVWXYZ/-/c;
$authorcode =~ s/-//g;
if (!$authorcode) {print "...some html...\n"; exit; }
but when I run the script in Apache, this is what I get:
Use of uninitialised value in join or string at ...script... line 102
(corresponding to the last line above).
The script still carries out its task, but leaves the error message in
the log file.
$authorcode is obviously empty when the last line is read. But if so,
shouldn't the (!$authorcode) test be true?
Thanks for your time,
Henrik N
------------------------------
Date: Fri, 17 Jan 2003 14:11:08 +0100
From: Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Subject: Re: Uninitialised value in join or string issue
Message-Id: <newscache$km0v8h$6eb$1@news.emea.compuware.com>
henrik nilsson wrote (Friday 17 January 2003 12:13):
> When I run these lines from a CLI window, everything works fine.
>
> (it is a cgi script. $authorcode is normally specified by the user)
>
> my $authorcode = 333;
^^^
(Hey, the value for $authorcode is hardcoded. Hmmm... lets see what goes
on...)
> $authorcode =~ tr/ABCDEFGHIJKLMNOPQRSTUVWXYZ/-/c;
> $authorcode =~ s/-//g;
> if (!$authorcode) {print "...some html...\n"; exit; }
>
> but when I run the script in Apache, this is what I get:
>
> Use of uninitialised value in join or string at ...script... line 102
> (corresponding to the last line above).
This warning is generated by the
> if (!$authorcode) {print "...some html...\n"; exit; }
^^^^^^^^^^^^^^^^^^
part. Check for any variables inside this string which remain uninitialized.
> The script still carries out its task, but leaves the error message in
> the log file.
>
> $authorcode is obviously empty when the last line is read. But if so,
^^^^^
The correct wording is undef. And undef is not the same as "".
> shouldn't the (!$authorcode) test be true?
No. You can only check for a "not" value it there is a value. If there isn't
a value at all (read: undef) there is no value to check against. So your
statement should be rewritten to:
if ( defined $authorcode ) {print "...some html...\n"; exit; }
Read "perldoc -f undef" for the nitty gritty.
> Thanks for your time,
>
> Henrik N
HTH
--
KP
------------------------------
Date: 17 Jan 2003 13:25:17 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Uninitialised value in join or string issue
Message-Id: <b0907t$5d3$1@mamenchi.zrz.TU-Berlin.DE>
henrik nilsson <md0nilhe@mdstud.DIESPAMchalmers.se> wrote in comp.lang.perl.misc:
> When I run these lines from a CLI window, everything works fine.
>
> (it is a cgi script. $authorcode is normally specified by the user)
>
> my $authorcode = 333;
> $authorcode =~ tr/ABCDEFGHIJKLMNOPQRSTUVWXYZ/-/c;
> $authorcode =~ s/-//g;
tr/// can do the job in one step:
$authorcode =~ tr/A-Z//cd;
> if (!$authorcode) {print "...some html...\n"; exit; }
Instead of "if ( ! ... )", "unless ( ... )" is usually preferable.
Also, to test if a string has become empty, better check its length
instead of its boolean value. "0" is false, but not empty. So:
unless ( length $authorcode ) {
# ...
}
> but when I run the script in Apache, this is what I get:
>
> Use of uninitialised value in join or string at ...script... line 102
> (corresponding to the last line above).
The code above will not render $authorcode undefined. Are you inter-
polating any variables in ""...some html...\n"?
Anno
------------------------------
Date: Fri, 17 Jan 2003 15:28:39 +0000
From: inderjit S Gabrie <i.gabrie@mis.gla.ac.uk>
Subject: ~ Urgently require a Webpage Hit counter script !!??~
Message-Id: <3E282127.978DD144@mis.gla.ac.uk>
Hi all
I am looking for a simple text webpage hit counter that would keep
track of hits
into a file or possible email them to me with e.g. date/time of hit,
webpage
accessed,users Ip no etc etc can this be done or does anyone have a
script...thanks
in advnace...indy
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 4420
***************************************