[18055] in Perl-Users-Digest
Perl-Users Digest, Issue: 215 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 5 14:11:21 2001
Date: Mon, 5 Feb 2001 11:10:27 -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: <981400227-v10-i215@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 5 Feb 2001 Volume: 10 Number: 215
Today's topics:
Grep error in Perl program... <ncheung@draper.com>
Re: Grep error in Perl program... (Anno Siegel)
hash with multiple values for 1 key <boussard@my-deja.com>
Re: hash with multiple values for 1 key egwong@netcom.com
Re: hash with multiple values for 1 key <occitan@esperanto.org>
Re: having problems w/ $( $) ...or... :( with $( chains@yahoo.com
Help w/ Win32::ChangeNotify <anonymous@anonymous.anonymous>
Help with < <jlavergne@drs.ca>
How does sysopen function? <Dave@inner-realm.co.uk>
Re: Initial Caps <mischief@velma.motion.net>
Integrating PERL into win9x shell taylorj@vapo2.him.unisys.com
Re: Integrating PERL into win9x shell dtbaker_dejanews@my-deja.com
Re: Integrating PERL into win9x shell <somewhere@planet.earth>
Re: JAPH <amonotod@netscape.net>
Re: JAPH <godzilla@stomp.stomp.tokyo>
Re: Keyword Search <rworth5@home.com>
Mail::Mailer <jonni@ifm.liu.se>
Re: Modules/Constants. <dorsettest@uk.insight.com>
Need advice: choosing between C++ CGI, Java servlets, o <c.manley@spamsux.nl>
Need Help Searching for keywords jgs2283@my-deja.com
New posters to comp.lang.perl.misc <gbacon@cs.uah.edu>
newbie: Conditional statements <epiphany1@my-deja.com>
Perl implementation of UNIX tools jbenshet@my-deja.com
Re: Perl implementation of UNIX tools <sariq@texas.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 05 Feb 2001 09:52:36 -0500
From: "Nicholas C. Cheung" <ncheung@draper.com>
Subject: Grep error in Perl program...
Message-Id: <3A7EBE34.1B3C3D8A@draper.com>
There was a time that this particular segment of code worked, but now,
it constantly gives me the following error message:
grep: RE error 41: No remembered search string.
Here is the segment of code which is the problem:
open CHECK_PROG_RUN, "ps -e -opid,fname | grep \"$program\" |";
Now I still want to pipe the output of that into the CHECK_PROG_RUN
filehandle, using grep or egrep, but various ways have failed, including
using ' and \' in place of \". With egrep (using egrep -e), it complains
of a syntax error.
Are there any alternative ways of accomplishing this without the errors?
Thanks in advance!
Nick
------------------------------
Date: 5 Feb 2001 15:38:12 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Grep error in Perl program...
Message-Id: <95mhd4$k42$1@mamenchi.zrz.TU-Berlin.DE>
Nicholas C. Cheung <ncheung@draper.com> wrote in comp.lang.perl.misc:
>There was a time that this particular segment of code worked, but now,
>it constantly gives me the following error message:
>
>grep: RE error 41: No remembered search string.
>
>Here is the segment of code which is the problem:
>
>open CHECK_PROG_RUN, "ps -e -opid,fname | grep \"$program\" |";
>
>Now I still want to pipe the output of that into the CHECK_PROG_RUN
>filehandle, using grep or egrep, but various ways have failed, including
>using ' and \' in place of \". With egrep (using egrep -e), it complains
>of a syntax error.
>
>Are there any alternative ways of accomplishing this without the errors?
Yes. Don't use an external program for selection, use a perl regex.
That way you have quotemeta() (q.v.) to make your regex safe against
unexpected meta-characters appearing in the program name.
Anno
------------------------------
Date: Mon, 05 Feb 2001 17:15:30 GMT
From: boussard <boussard@my-deja.com>
Subject: hash with multiple values for 1 key
Message-Id: <95mn35$3mb$1@nnrp1.deja.com>
Hi All,
I am trying to make a hash that has multiple values for 1 key. Would you
suggest doing an array of a hash or a hash of an array? What are the
main advantages of one or the other?
Here is what I was doing, but of course I was only getting the last
value
open (MYFILE, "$logsdir/myfile.txt") || die "Can't open file
$logsdir/myfile.txt!!\n\n";
while (<MYFILE>){
chomp;
if (/ID:(\d+)/){
$myID=$1;
}
if (/DFG:(\d+)/){
$valueID=$1;
}
$hashTmp{$myID}=$valueID;
return %hashTmp;
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Mon, 05 Feb 2001 17:51:45 GMT
From: egwong@netcom.com
Subject: Re: hash with multiple values for 1 key
Message-Id: <RKBf6.4910$tv5.364370@news.flash.net>
boussard <boussard@my-deja.com> wrote:
> I am trying to make a hash that has multiple values for 1 key. Would you
> suggest doing an array of a hash or a hash of an array? What are the
> main advantages of one or the other?
It depends what you want to do with it. If you need O(1) (or *nearly*
O(1)) lookup, use a hash, otherwise use an array.
> Here is what I was doing, but of course I was only getting the last
> value
> open (MYFILE, "$logsdir/myfile.txt") || die "Can't open file
> $logsdir/myfile.txt!!\n\n";
Think about adding $! (see perlvar) in the die statement to give you
a more detailed error message.
> while (<MYFILE>){
> chomp;
> if (/ID:(\d+)/){
> $myID=$1;
> }
> if (/DFG:(\d+)/){
> $valueID=$1;
> }
push( @{$hashTemp{$myID}}, $valueID );
------------------------------
Date: Mon, 05 Feb 2001 17:47:31 GMT
From: Daniel Pfeiffer <occitan@esperanto.org>
Subject: Re: hash with multiple values for 1 key
Message-Id: <95movg$5hn$1@nnrp1.deja.com>
In article <95mn35$3mb$1@nnrp1.deja.com>,
boussard <boussard@my-deja.com> wrote:
> Hi All,
> I am trying to make a hash that has multiple values for 1 key. Would
you
> suggest doing an array of a hash or a hash of an array? What are the
> main advantages of one or the other?
> Here is what I was doing, but of course I was only getting the last
> value
> open (MYFILE, "$logsdir/myfile.txt") || die "Can't open file
> $logsdir/myfile.txt!!\n\n";
>
> while (<MYFILE>){
> chomp;
> if (/ID:(\d+)/){
> $myID=$1;
> }
> if (/DFG:(\d+)/){
> $valueID=$1;
> }
> $hashTmp{$myID}=$valueID;
> return %hashTmp;
An array (preferably a list) of hashes would be extremely cumbersome,
since you'd have to check each hash. A hash of whatever would seem to
be the way to go. whatever might be an array, i.e. a list-reference, or
a string with some seperator, i.e. ':'.
Your choice would depend on your usage, if you only want the result once
at the end, a string would be fine. If you want to add and delete often
a list-reference or even a hash-reference would be fine. The latter
could keep a count of valueIDs. Adding something to such a reference is
exmplified by:
$ perl -e '$x=[1..6]; push @$x, 9; print "@$x\n"'
1 2 3 4 5 6 9
$ perl -e '$x={1..6}; $$x{9}++; print "$_ $$x{$_}\n" for keys %$x'
9 1
1 2
3 4
5 6
hope this helps -- Daniel
--
Bring text-docs to life! Erwecke Textdokumente zum Leben!
http://beam.to/iPerl/
Vivigu tekstodokumentojn!
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Mon, 05 Feb 2001 18:04:03 GMT
From: chains@yahoo.com
Subject: Re: having problems w/ $( $) ...or... :( with $(
Message-Id: <95mpub$6kp$1@nnrp1.deja.com>
DUH!!!
Gee, I *KNEW* that... Thanx for pointing it out.
In article <u97l38dk2b.fsf@wcl-l.bham.ac.uk>,
nobull@mail.com wrote:
> You are forgetting that you must always cut out the branch you are
> standing on last.
>
> Once you've dropped superuser priviledge (by making $< and $>
> non-zero) you can't alter $( or $).
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Mon, 05 Feb 2001 12:50:34 -0500
From: Anonymous <anonymous@anonymous.anonymous>
Subject: Help w/ Win32::ChangeNotify
Message-Id: <bgpt7t8dn2kieoloocric89sg2htqd5mqf@4ax.com>
I'm trying to get a script working w/ Win32::ChangeNotify. It works OK, but the code that runs when
a change occurs gets run twice and I can't figure out why:
use IO::File;
use Win32::ChangeNotify;
use Win32::NetResource;
use Win32;
use Getopt::Std;
use Proc::Simple;
use Mail::Sendmail;
use PedUtil;
$LOG = IO::File->new(">C:\\TEMP\\log") || die "$!\n";
$LOG->autoflush(1);
getopts('p:u:a:');
$PATH = $opt_p || die;
$USERID = $opt_u || ($PATH =~ /\$/) ? die : "";
$PW = $opt_a || ($PATH =~ /\$/) ? die : "";
$SERVER = Win32::NodeName;
if ( $PATH =~ /\$/ ) {
my (@server,undef) = split(/\\/,$PATH);
$SERVER = $server[2];
$DRIVE = FreeDrive();
($SHARE,$PATH) = split(/\$/,$PATH);
$SHARE .= "\$";
$PATH = $DRIVE . $PATH;
%NETRESOURCE = (LocalName => $DRIVE, RemoteName => $SHARE);
die if (!Win32::NetResource::AddConnection(\%NETRESOURCE,$PW,$USERID));
$notify = Win32::ChangeNotify->new($PATH,0,"LAST_WRITE") || die "$!\n";
while ( 1 ) {
$notify->wait();
$i++;
print $LOG "Wait Over at " . localtime(time) . "\n";
$MAIL{Subject} = "Dr. Watson Detected on Server $SERVER at " . localtime(time);
sendmail %MAIL || print "$!\n";
print $LOG "Mail Sent\n";
$notify->reset();
sleep 2;
}
Win32::NetResource::CancelConnection($DRIVE,0,1) if ($DRIVE != "");
--------== Posted Anonymously via Newsfeeds.Com ==-------
Featuring the worlds only Anonymous Usenet Server
-----------== http://www.newsfeeds.com ==----------
------------------------------
Date: Mon, 05 Feb 2001 17:58:19 GMT
From: "Joelle Lavergne" <jlavergne@drs.ca>
Subject: Help with <
Message-Id: <%QBf6.412$f5.86148@news>
Hello all. I have no experience with perl. I am trying to understand a
script that I found on the internet. Everything is going pretty well except
for a few statment that I cannot figure out.
Here goes:
$x = 0;
$y = 9;
$z = 0;
$x < < $y;
Here is another one
if ($z < 7){
$x |= @$table[$z++]
}
what is the meaning of this " |= " ?
Thanks for your help!
------------------------------
Date: Mon, 05 Feb 2001 16:11:18 +0000
From: Dave Clews <Dave@inner-realm.co.uk>
Subject: How does sysopen function?
Message-Id: <3A7ED0A6.C190007C@inner-realm.co.uk>
HELP!
I am trying to get an uploaded document to be stored into a new file
which can then have an active link generated, which is stored on a page
enabling the user to view the document. However I cannot seem to get
the file to be created, I have given the directories to where the file
is stored 777 permisions. Still I am unable to create or open the file,
please tell me where I should be looking. The $! tells me that the
file or directory dosen't exist, this is pantz because I know they do I
have even checked the spelling to see if that was the error and no it
wasn't.
The main part of the code is as follows, please please please help
*grovels and starts weeping*
$file = "$path/$FORM{'title'}.rtf";
$active = "$path/$FORM{'title'}.rtf";
# Open file or create a new file
# commented out as file don't exist open(DOCUMENT, "> $file")
|| die "Cannot open file. \n";
sysopen(DOCUMENT, $file, O_RDONLY|O_CREAT) || die "Unable to create
file $!\n"; # have tried O_WRONLY and O_RDWR
# open file form form and write to the newly created file
open(FORMDOC "< $FORM{'doc'}") || die "Cannot open the forms document.
$!\n";
print DOCUMENT FORMDOC;
close(FORMDOC);
close(DOCUMENT);
Cheers
Dave Clews
------------------------------
Date: Mon, 05 Feb 2001 17:50:43 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Initial Caps
Message-Id: <t7tpvjc41a4ia9@corp.supernews.com>
Rudolf Polzer <rpolzer@web.de> wrote:
> shanmughom_sivasubra@my-deja.com <shanmughom_sivasubra@my-deja.com> schrieb Folgendes:
>> You can try
>>
>> $value = s/(\w)(\w|\s)/\u$1/g;
> He could have solved the problem himself: he could also prepend his string
> with a space, apply his re, and remove the space using sub. Of course,
> your solution is cleaner, but I think newbies should think, too.
The above doesn't seem to work. Besides using '=' instead of '=~',
after correcting the operator I only get the first letter in $value.
This would be better:
$value =~ s/(\w+)/\u$1/g;
The following non-substituion method works too, and it might be
slightly easier to understand but benchmarks at approximately 2/3
slower. TMTOWTDI, but they aren't always equivalent.
@value = split(/ /, $value);
foreach( @value ) {
$_ = ucfirst;
}
$value = join('', @value);
On the other hand, if you needed to just change the first character
of the whole string, ucfirst benchmarks about 25% faster than the
substitution ( not surprising when you find out the '\u' in the
substitution operator is implemented with ucfirst ).
$value = s/(^\w+)/\u$1/;
vs
$value = ucfirst( $value );
But wait!
If you really do need to uppercase all words in string and are thinking
"Why is it that the loop is slower and all, even though the operator
is faster?", then you need to read up on map(). Using map(), the ucfirst
method can be faster than the substitution.
#####################
use Benchmark;
$value1 = 'hello world';
$value2 = $value1;
timethese -10, {
'sub' => \&sub,
'ucf' => \&ucf
};
sub sub {
$value1 =~ s/(\w+)/\u$1/g;
}
sub ucf {
$value2 = join(' ', ( map( ucfirst, split( / /, $value2 ) ) ) );
}
print $value1 . " is value1\n";
print $value2 . " is value2\n";
#####################
Benchmark: running sub, ucf, each for at least 10 CPU seconds...
sub: 9 wallclock secs @ 57901.10/s (n=579011)
ucf: 10 wallclock secs @ 78632.04/s (n=829568)
Hello World is value1
Hello World is value2
That shows the ucfirst() and map() version is about 43% faster.
The speed advantage seems to disappear ( although not entirely gone,
it becomes insignifigant ) when the value of $value1 and the value
of $value2 is changed to a string with more space-separated words,
though.
Since the OP is using this for HTML forms, and since I can't imagine
why ( other than stupid management ) you'd want to capitalize all the
words in a feedback comment or a form mailer, I would think we're
talking about personal names, company names, and addresses. With that
kind of data, your field should have only a few words, and the map()
and ucfirst() method above could become a quite signifigant savings
with 100,000 form submissions a day with up to 43% savings on processing
the case of the data. In low-volume applications, it's not much of
an issue, with larger data sets it's not much of an issue, and I don't
have a way to tell you which will take up more memory off the top of my
head.
With much larger data sets, it seems the substitution even pulls
ahead. Using the following paragraph from perlop as the value of
both $value1 and $value2, I get the substitution method being 20%
faster:
Like C, Perl does a certain amount of expression
evaluation at compile time, whenever it determines that
all arguments to an operator are static and have no side
effects. In particular, string concatenation happens at
compile time between literals that don't do variable
substitution. Backslash interpretation also happens at
compile time.
There is more than one way to do it, and not only are they not
exactly equivalent in performance, but the difference in performance
can vary based on what data is processed. Generality is usually a
good thing compared to a specific fix, but if you can get a generally
applicable solution that has performance bonuses for your site's most
common type of application, that's a Good Thing. All this performance
talk might not be important to your needs, but one line vs. one line
with 20% or 40% speed differences for one or the other can warrant a
little data set research if you do need the speed.
Chris
--
Christopher E. Stith
You can never entirely stop being what you once were. That's
why it's important to be the right person today, and not put
it off till tomorrow. -- Larry Wall, 3rd State of the Onion
------------------------------
Date: Mon, 05 Feb 2001 15:20:05 GMT
From: taylorj@vapo2.him.unisys.com
Subject: Integrating PERL into win9x shell
Message-Id: <95mgap$snb$1@nnrp1.deja.com>
I want to integrate PERL scripts into a win9x environment. I have an
association between .pl files and perl.exe. In NT there is a pathext
environment variable. How do I tell the shell to treat .pl files as
executables and search the path for them.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Mon, 05 Feb 2001 15:31:36 GMT
From: dtbaker_dejanews@my-deja.com
Subject: Re: Integrating PERL into win9x shell
Message-Id: <95mh0p$tcu$1@nnrp1.deja.com>
In article <95mgap$snb$1@nnrp1.deja.com>,
taylorj@vapo2.him.unisys.com wrote:
> I want to integrate PERL scripts into a win9x environment. I have an
> association between .pl files and perl.exe. In NT there is a pathext
> environment variable. How do I tell the shell to treat .pl files as
> executables and search the path for them.
-----------------
the same way you "associate" any file type.
in an explorer window, go to View->FolderOptions->FileTypes
and define the .pl extension to open the perl.exe
Dan
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Mon, 5 Feb 2001 17:07:26 +0100
From: "Dimitri Gunsing" <somewhere@planet.earth>
Subject: Re: Integrating PERL into win9x shell
Message-Id: <95mj35$enu$1@list.pbnec.nl>
> How do I tell the shell to treat .pl files as
> executables and search the path for them.
In NT go to Control Panel/System/Environment. In System Variables, add .PL
to PATHEXT.
You can then start .PL files like any other executable files in a cmd shell.
Greetz,
Dimitri
------------------------------
Date: Mon, 05 Feb 2001 16:40:54 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: JAPH
Message-Id: <95ml2k$1k6$1@nnrp1.deja.com>
In article <3A7C42B4.3B42484E@stomp.stomp.tokyo>,
"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
> Just when you think your Just Another Perl Hacker
> signature file is the ultimate, along comes Godzilla!
<snip>
> Godzilla! Just Amazing Perl Hacker
> --
<snip some "obfuscated" code>
You are such a moronzilla. That is not a JAPH.
From the Perl FAQ:
http://theoryx5.uwinnipeg.ca/CPAN/perl/pod/perlfaq1/What_is_a_JAPH_.html
As described by Abigail:
http://x68.deja.com/[ST_rn=ps]/getdoc.xp?AN=663707134&CONTEXT=981390637.
1910243439&hitnum=18
amonotod
--
`\|||/ amonotod@
(@@) netscape.net
ooO_(_)_Ooo________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Mon, 05 Feb 2001 10:32:52 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: JAPH
Message-Id: <3A7EF1D4.B2D28E67@stomp.stomp.tokyo>
Anno Siegel wrote:
> Godzilla! <godzilla@stomp.stomp.tokyo> wrote in comp.lang.perl.misc:
> [...]
> >So tell me, why are you boys investing so much time
> >and effort into negative commentary about my unique
> >JAPH script and, you don't do this to others, those
> >who bend the knee and are accepted?
> Excessive gloating over a small accomplishment invites
> this kind of commentary.
A notion which well explains why we women often
refer to men as being little brained.
Godzilla!
------------------------------
Date: Mon, 05 Feb 2001 18:32:22 GMT
From: "Richard & Stacy" <rworth5@home.com>
Subject: Re: Keyword Search
Message-Id: <WkCf6.11661$wI1.850256@news1.rdc1.mb.home.com>
Weblog keeps track of all keywords used when accessing a site from a search
engine. I am trying to do the exact same thing. I want to log all the
keywords that were used when someone has found my site from a search engine
then extract the keyword/s from the query.
If the found keyword is new, add a new entry, else increment.
I having alot of difficulty trying to get this to happen without errors.
Tony Curtis <tony_curtis32@yahoo.com> wrote in message
news:87ae82483x.fsf@limey.hpcc.uh.edu...
> >> On Sun, 04 Feb 2001 05:49:42 GMT,
> >> "Richard & Stacy" <rworth5@home.com> said:
>
> > I am trying to figure out how to extract keywords from
> > the URL when someone visits my site and keep a log of
> > all keywords.
>
> What do you mean by "keyword"?
> What is "the URL"?
>
> > When they are extracted from URL, I want to increment if
> > it already exists or if it is a new keyword add to the
> ^^
> Increment what? And what is "it"?
>
> Your question is far too vague for anyone to even guess
> what you're trying to do.
>
> hth
> t
> --
> Eih bennek, eih blavek.
------------------------------
Date: Mon, 5 Feb 2001 16:51:30 +0100
From: "Jonas Nilsson" <jonni@ifm.liu.se>
Subject: Mail::Mailer
Message-Id: <95mi5d$9m3$1@newsy.ifm.liu.se>
Hello.
I'm trying make the header field "From:" to work but it doesn't. Can anybody
help?
$mail = new Mail::Mailer;
$mail->open({'Subject' => $subject1, 'To' => $recipient1, 'From' =>
$from1});
print $mail $mailcontent1;
$mail->close;
And the mail recieved:
Received: (from nobody@localhost)
by ifm.liu.se (8.11.0/8.11.0) id f15FJa519028
for jonni; Mon, 5 Feb 2001 16:19:36 +0100 (MET)
Date: Mon, 5 Feb 2001 16:19:36 +0100 (MET)
From: nobody@ifm.liu.se
Message-Id: <200102051519.f15FJa519028@ifm.liu.se>
To: jonni@ifm.liu.se
Subject: Your order
Content-Length: 151
How can I make the From field to be what I wan't?
/jN
--
_____________________ _____________________
| Jonas Nilsson | | |
|Linkoping University | | Telephone |
| IFM | | --------- |
| Dept. of Chemistry | | work: +46-13-285690 |
| 581 83 Linkoping | | fax: +46-13-281399 |
| Sweden | | home: +46-13-130294 |
|_____________________| |_____________________|
------------------------------
Date: Mon, 05 Feb 2001 18:51:56 +0000
From: Kelly Dorset <dorsettest@uk.insight.com>
Subject: Re: Modules/Constants.
Message-Id: <3A7EF64C.E4F5D5AD@uk.insight.com>
Garry Williams wrote:
>
> On Mon, 05 Feb 2001 00:26:22 +0000, Kelly Dorset
> <dorsettest@uk.insight.com> wrote:
>
> >> Incidently, I've just realised that having the constants in a seperate
> >> file and useing them isn't working :( Where abouts in the module do
> >> they need to be declared?
> >>
> >To clarify (managed to get rid of using Deja :) ),
>
> Hooray! Your posts will likely be more visible, now.
*grins*
> >I get this error:
> >
> >Argument "CONSTANT" isn't numeric in pack at include/COMSINCLUDE.pm
>
> That's a warning.
>
> >Could this be because of the I'm using the include twice, as previously
> >mentioned?
>
> If you mean that you are not exporting the constants and that you
> include the constants module in two different files, and the two files
> define different packages, yes.
>
> That was nobull's point.
>
> The second time the module is use'd the compiler knows it's already
> loaded, so it just calls its import method in the new file. Hmm. If
> it doesn't export anything, there will be no names defined in the
> second file's name space.
>
> You would see this more clearly, if you used strict.
>
> The only way around this is to explicitly make everything the same
> name space. That's probably a Bad Thing. If you do that, why divide
> things into separate files?
>
> By the way, have you considered use strict?
I thought I was... (i was in the main script, but had commented it out
in the coms script)
Ok, put use script back in, and put all of the constant names into the
exporter thingy in the constants script but I'm still getting error when
trying to use them.
Here is a chunk:
------
sub BEGIN {
print "Const module imported\n";
require Exporter;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
@ISA = qw(Exporter);
@EXPORT = qw(
C_SYSTEM
C_HELLO
C_PING_REQ
C_PING_REPLY
etc etc for 70 others..
C_SYSTEM);
@EXPORT_OK = ();
%EXPORT_TAGS = ( );
}
When that script is used by the coms modules, here is the error:
Bareword "C_LOGIN" not allowed while "strict subs" in use at
/scripts/include/coms.pm line 95 (#1)
(F) With "strict subs" in use, a bareword is only allowed as a
subroutine identifier, in curly brackets or to the left of the "=>"
symbol.
Perhaps you need to predeclare a subroutine?
Bareword "C_MSG_SEND" not allowed while "strict subs" in use at
/scripts/include/coms.pm line 120 (#1)
etc etc for each of the constants exported.
I'm guess it must be a problem in the way I'm using exported here.. but
I have no clue really..
Thank!
k
--
------------------------------
Date: Mon, 05 Feb 2001 18:55:56 +0100
From: Craig Manley <c.manley@spamsux.nl>
Subject: Need advice: choosing between C++ CGI, Java servlets, or perl_mod CGI for simple high load web app.
Message-Id: <3A7EE92C.3C37FE82@spamsux.nl>
Hi all,
I know similar questions are asked a lot but I've got a specific
question and need advice:
I've got a Perl CGI script (on Linux, Apache webserver) that per web
request appends some short strings to about 20 files and returns a
simple response. Nothing big deal, but we expect that once only and for
a short period of about 15 minutes about 150000 requests will be made.
Now I need to know what will most likely be faster for the webserver to
execute:
1. My simple Perl script running under perl_mod.
2. A simple CGI executable made with C/C++.
3. A Java servlet (has threading as advantage but slower code execution
as disadvantage).
or......
4. choose NT and IIS and build an ISAPI DLL with C/C++/Delphi (threading
as advantage - possibly slower OS as disadvantage).
I hope I've provided enough details - it's really a simple script that
does no heavy string processing or anything big deal, just logging.
-Craig Manley.
------------------------------
Date: Mon, 05 Feb 2001 17:09:42 GMT
From: jgs2283@my-deja.com
Subject: Need Help Searching for keywords
Message-Id: <95mmoc$36o$1@nnrp1.deja.com>
Please be patient with me...I'm new to posting... I am trying to
search 'search engine' type of sites for keywords that a user types
in. I'm able to query the sites, but I don't know how to search for
the keywords. This is the snippet of code that I have that queries the
site...
use LWP;
use URI::Escape;
$webhost = 'www.whatever.com';
$webpage = '/results/ResultPage';
$refpage = '/Main/Mainpage.htm';
$PageUrl = 'http://' . $webhost . $webpage;
$RefererUrl = 'http://' . $webhost . $refpage;
$ua = LWP::UserAgent->new();
$ua->agent($UserAgentName);
$ua->from($FromUser);
$ua->timeout($Timeout);
$rqst = HTTP::Request->new('GET', $PageUrl);
$rqst->referer($RefererUrl);
$rqst->header(%RequestHdrs);
$rspn = $ua->request($rqst);
$rspn->is_success || print("ERROR!\n");
print "Status: %s\n", $rspn->status_line();
print "CONTENT====\n%s====\n", $rspn->content();
This is working to get to the site...but how would you search for a
keyword on a site. For example, altavista.com something of that
nature... I'm trying to pull results. Also, right now I'm getting the
page in HTML format, is there a way to put it into XML format? I would
appreciate any incite.... thanks in advance!
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Mon, 05 Feb 2001 16:08:38 -0000
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: New posters to comp.lang.perl.misc
Message-Id: <t7tk06jscmad87@corp.supernews.com>
Following is a summary of articles from new posters spanning a 7 day
period, beginning at 29 Jan 2001 16:07:25 GMT and ending at
05 Feb 2001 14:29:15 GMT.
Notes
=====
- A line in the body of a post is considered to be original if it
does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
- All text after the last cut line (/^-- $/) in the body is
considered to be the author's signature.
- The scanner prefers the Reply-To: header over the From: header
in determining the "real" email address and name.
- Original Content Rating (OCR) is the ratio of the original content
volume to the total body volume.
- Find the News-Scan distribution on the CPAN!
<URL:http://www.perl.com/CPAN/modules/by-module/News/>
- Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
- Copyright (c) 2001 Greg Bacon.
Verbatim copying and redistribution is permitted without royalty;
alteration is not permitted. Redistribution and/or use for any
commercial purpose is prohibited.
Totals
======
Posters: 180 (40.0% of all posters)
Articles: 283 (23.1% of all articles)
Volume generated: 467.9 kb (21.0% of total volume)
- headers: 219.5 kb (4,411 lines)
- bodies: 241.8 kb (8,396 lines)
- original: 170.9 kb (6,241 lines)
- signatures: 6.2 kb (131 lines)
Original Content Rating: 0.707
Averages
========
Posts per poster: 1.6
median: 1.0 post
mode: 1 post - 126 posters
s: 2.0 posts
Message size: 1692.9 bytes
- header: 794.4 bytes (15.6 lines)
- body: 875.0 bytes (29.7 lines)
- original: 618.3 bytes (22.1 lines)
- signature: 22.5 bytes (0.5 lines)
Top 10 Posters by Number of Posts
=================================
(kb) (kb) (kb) (kb)
Posts Volume ( hdr/ body/ orig) Address
----- -------------------------- -------
15 28.8 ( 13.4/ 13.7/ 3.4) grauezellen@gibts.net
6 10.5 ( 5.0/ 5.6/ 3.1) "B McDonald" <motivusNO@SPAMhotmail.com>
5 8.6 ( 3.5/ 5.1/ 1.6) "georg_a_k" <georg_a_k@gnuage.com>
5 5.4 ( 3.5/ 1.9/ 0.7) "Jason Wong" <wo_ah_ho@yahoo.com>
5 12.9 ( 4.1/ 8.8/ 4.4) Steve <pawsindoors@hotmail.com>
5 7.3 ( 4.2/ 3.0/ 1.7) jean@ematic.com
5 8.5 ( 4.0/ 4.5/ 2.1) delanthear@my-deja.com
4 11.9 ( 4.1/ 7.7/ 7.3) "Stephen Deken" <shutupsteve@aNwOdSaPnAgM.com>
4 9.8 ( 3.9/ 4.3/ 3.6) Ray.DeGennaro@eaglerock-is.com
4 5.0 ( 2.9/ 2.1/ 1.4) "MAW" <maw@markaw.com>
These posters accounted for 4.7% of all articles.
Top 10 Posters by Volume
========================
(kb) (kb) (kb) (kb)
Volume ( hdr/ body/ orig) Posts Address
-------------------------- ----- -------
28.8 ( 13.4/ 13.7/ 3.4) 15 grauezellen@gibts.net
12.9 ( 4.1/ 8.8/ 4.4) 5 Steve <pawsindoors@hotmail.com>
11.9 ( 4.1/ 7.7/ 7.3) 4 "Stephen Deken" <shutupsteve@aNwOdSaPnAgM.com>
10.5 ( 5.0/ 5.6/ 3.1) 6 "B McDonald" <motivusNO@SPAMhotmail.com>
9.8 ( 3.9/ 4.3/ 3.6) 4 Ray.DeGennaro@eaglerock-is.com
8.6 ( 3.5/ 5.1/ 1.6) 5 "georg_a_k" <georg_a_k@gnuage.com>
8.5 ( 4.0/ 4.5/ 2.1) 5 delanthear@my-deja.com
7.9 ( 2.9/ 5.0/ 2.1) 3 "Terry" <dcs@ntlworld.com>
7.3 ( 4.2/ 3.0/ 1.7) 5 jean@ematic.com
6.2 ( 1.9/ 4.3/ 3.6) 2 "Tim Gaverth" <gaverth@home.com>
These posters accounted for 5.0% of the total volume.
Top 10 Posters by OCR (minimum of three posts)
==============================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
1.000 ( 0.5 / 0.5) 3 "hauhau" <hauhau@seed.net.tw>
0.942 ( 7.3 / 7.7) 4 "Stephen Deken" <shutupsteve@aNwOdSaPnAgM.com>
0.867 ( 1.7 / 2.0) 3 "Steve Yates" <steve@teamITS.com>
0.835 ( 3.6 / 4.3) 4 Ray.DeGennaro@eaglerock-is.com
0.671 ( 2.1 / 3.1) 3 jimjim123@my-deja.com
0.670 ( 1.4 / 2.1) 4 "MAW" <maw@markaw.com>
0.656 ( 1.6 / 2.4) 3 Ilmari Karonen <usenet11353@itz.pp.sci.fi>
0.610 ( 1.0 / 1.7) 3 "Marc P. Steel" <mpsteel@bellatlantic.net>
0.596 ( 2.0 / 3.4) 3 "B McDonald" <motiNOvus@hotSPAMmail.com>
0.562 ( 1.8 / 3.1) 3 "Don Bremer" <rushbuff@netaddress.net>
Bottom 10 Posters by OCR (minimum of three posts)
=================================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
0.551 ( 1.7 / 3.0) 5 jean@ematic.com
0.527 ( 1.3 / 2.5) 3 "Stefan Bach" <stefan.bach@web.de>
0.500 ( 4.4 / 8.8) 5 Steve <pawsindoors@hotmail.com>
0.491 ( 0.8 / 1.6) 3 donz30@my-deja.com
0.471 ( 1.7 / 3.7) 3 k9boy@my-deja.com
0.471 ( 2.1 / 4.5) 5 delanthear@my-deja.com
0.426 ( 2.1 / 5.0) 3 "Terry" <dcs@ntlworld.com>
0.359 ( 0.7 / 1.9) 5 "Jason Wong" <wo_ah_ho@yahoo.com>
0.308 ( 1.6 / 5.1) 5 "georg_a_k" <georg_a_k@gnuage.com>
0.247 ( 3.4 / 13.7) 15 grauezellen@gibts.net
21 posters (11%) had at least three posts.
Top 10 Targets for Crossposts
=============================
Articles Newsgroup
-------- ---------
30 alt.perl
12 comp.lang.perl
5 comp.lang.perl.moderated
3 comp.os.linux.misc
3 comp.lang.misc
3 comp.unix.questions
2 comp.answers
2 news.answers
1 nl.comp.os.ms-windows
1 de.comp.lang.perl.misc
Top 10 Crossposters
===================
Articles Address
-------- -------
5 jean@ematic.com
3 kurt elmiger <ke@idm.ch>
2 "Don Bremer" <rushbuff@netaddress.net>
2 "Yves Delaunois" <yves.delaunois@village.uunet.be>
2 "Tim Gaverth" <gaverth@home.com>
1 smnsn@my-deja.com
1 "salukibob" <salukibob@hotmail.com>
1 niski <niski@niski.com>
1 nospam_nomail@usa.net
1 Friedrich Dominicus <frido@q-software-solutions.com>
------------------------------
Date: Mon, 05 Feb 2001 18:51:56 GMT
From: Epiphany <epiphany1@my-deja.com>
Subject: newbie: Conditional statements
Message-Id: <95mso7$9he$1@nnrp1.deja.com>
I'm having a hard time with and "if else" statement. I think I
remember reading somewhere while I was browsing in a bookstore that
perl has different rules for conditional statements. Could someone give
me a brief summary of these rules, or point me out to a webpage that
can help me?
Thanks.
--
Epiphany
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Mon, 05 Feb 2001 17:15:03 GMT
From: jbenshet@my-deja.com
Subject: Perl implementation of UNIX tools
Message-Id: <95mn2b$3kh$1@nnrp1.deja.com>
I recall that there is an effort to implement many standard UNIX tools
in Perl so they are available on other platforms. As I'm stuck on NT
right now, I'd love to find some of these. Where can I get them?
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Mon, 05 Feb 2001 17:39:46 GMT
From: "Tom Briles" <sariq@texas.net>
Subject: Re: Perl implementation of UNIX tools
Message-Id: <CzBf6.124780$Df2.9195675@news3.aus1.giganews.com>
<jbenshet@my-deja.com> wrote in message news:95mn2b$3kh$1@nnrp1.deja.com...
> I recall that there is an effort to implement many standard UNIX tools
> in Perl so they are available on other platforms. As I'm stuck on NT
> right now, I'd love to find some of these. Where can I get them?
Google knows.
http://www.google.com/search?q=perl+unix+tools
- Tom
------------------------------
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 215
**************************************