[17900] in Perl-Users-Digest
Perl-Users Digest, Issue: 60 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jan 14 18:05:40 2001
Date: Sun, 14 Jan 2001 15:05:13 -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: <979513513-v10-i60@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 14 Jan 2001 Volume: 10 Number: 60
Today's topics:
$ENV{QUERY_STRING} and using the command Prompt <mpsilva@gps.caltech.edu>
Re: $ENV{QUERY_STRING} and using the command Prompt <tony_curtis32@yahoo.com>
Re: $ENV{QUERY_STRING} and using the command Prompt <vikingrscup@rogue-spear.com>
Re: Archive::Zip - any user comments? <jwollner@earthlink.net>
Re: Can't associate .PL files in Win98 <glburton@mindspring.com>
Re: Can't associate .PL files in Win98 <glburton@mindspring.com>
escape single quotes on command line? <stef@sos.ethz.ch>
Re: escape single quotes on command line? <stef@sos.ethz.ch>
Re: File info on win32 <carvdawg@patriot.net>
Re: HTTP::Request encoding query iain_hogg@my-deja.com
Re: Make fails <x-mstrong@zeta.org.au>
Make Screenshots on Win32 with Perl <schelling@bluewin.ch>
Need Help - Cookies vs. Browser (browser leads 2-1) <mike@customautotrim.com>
One line file doesn't work... <br@centurytel.net>
Re: One line file doesn't work... <tony_curtis32@yahoo.com>
Re: One line file doesn't work... <br@centurytel.net>
Re: One line file doesn't work... <tony_curtis32@yahoo.com>
Re: overload not autogenerating as expected mintcake@my-deja.com
Re: overload not autogenerating as expected <uri@sysarch.com>
Perl working with Java??? <nlee@mediashell.net>
Re: perlscript: can't figure out what's wrong <steve+usenet@[24.1.75.184]>
Price Comparison script? <stevec@ntlworld.com>
Re: Price Comparison script? <stevec@ntlworld.com>
Re: Price Comparison script? (Rich Lafferty)
Re: Regexp for XML (Alan Barclay)
Re: Regexp for XML (Tad McClellan)
Regular Expression Question <bob_simon@my-deja.com>
Re: Regular Expression Question <bob_simon@my-deja.com>
Regular Expression... can I use a $var to represent it? <julius_mong@hotmail.com>
Re: Regular Expression... can I use a $var to represent (Tad McClellan)
Re: Regular Expression... can I use a $var to represent mintcake@my-deja.com
Re: Replacing the "\" character in Perl. <steve+usenet@[24.1.75.184]>
Re: What do you call the => operator? <steve+usenet@[24.1.75.184]>
Re: What do you call the => operator? <usequity@mindspring.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 14 Jan 2001 13:16:30 -0800
From: "Matias P. Silva" <mpsilva@gps.caltech.edu>
Subject: $ENV{QUERY_STRING} and using the command Prompt
Message-Id: <3A62172E.9D3A7A49@gps.caltech.edu>
Hello to All,
How Do I Simulate $ENV{QUERY_STRING} using the command Prompt?
I'm using Winblows2000 with Activestate Perl
Thanks,
Matias
--
_____________________________________________________________________________
Matias P. Silva
U.S. Geological Survey Office : 626.583.6798
525 S. Wilson Ave. Office Email: mpsilva@usgs.gov
Pasadena, CA 91106 Pager : 818.372.6460
Pager Email : mpsilva@myairmail.com
_____________________________________________________________________________
------------------------------
Date: 14 Jan 2001 15:21:00 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: $ENV{QUERY_STRING} and using the command Prompt
Message-Id: <87k87x4ypv.fsf@limey.hpcc.uh.edu>
>> On Sun, 14 Jan 2001 13:16:30 -0800,
>> "Matias P. Silva" <mpsilva@gps.caltech.edu> said:
> Hello to All, How Do I Simulate $ENV{QUERY_STRING} using
> the command Prompt?
"perldoc CGI"
See the DEBUGGING section.
hth
t
--
Eih bennek, eih blavek.
------------------------------
Date: Sun, 14 Jan 2001 22:32:10 +0100
From: "Viking" <vikingrscup@rogue-spear.com>
Subject: Re: $ENV{QUERY_STRING} and using the command Prompt
Message-Id: <93t5rq$p5o$1@news0.skynet.be>
"Matias P. Silva" <mpsilva@gps.caltech.edu> wrote in message
news:3A62172E.9D3A7A49@gps.caltech.edu...
> Hello to All,
>
> How Do I Simulate $ENV{QUERY_STRING} using the command Prompt?
>
> I'm using Winblows2000 with Activestate Perl
If you're using the CGI module for parsing parameters, it will ask you for
name=value pairs when running from the command prompt.
If not, you can either insert a $ENV{QUERY_STRING} =
'this=that&second=this'; etc.. on the top of your script, or use your
shell's way of defining an environment variable. Not really sure what it is
for Windows 2000 though.
Per Einar Ellefsen
>
> Thanks,
> Matias
> --
>
____________________________________________________________________________
_
> Matias P. Silva
>
> U.S. Geological Survey Office : 626.583.6798
> 525 S. Wilson Ave. Office Email: mpsilva@usgs.gov
> Pasadena, CA 91106 Pager : 818.372.6460
> Pager Email : mpsilva@myairmail.com
>
____________________________________________________________________________
_
------------------------------
Date: Sun, 14 Jan 2001 16:28:21 -0500
From: "JKW" <jwollner@earthlink.net>
Subject: Re: Archive::Zip - any user comments?
Message-Id: <93t541$lbi$1@nntp9.atl.mindspring.net>
I had to make a small change to the module (to accommodate double slashes in
server names), but it works great. The only issue I have is that it won't
do encryption like the "commercial" version.
"Geoff Winkless" <geoff-at-farmline-dot-com@127.0.0.1> wrote in message
news:93kj9s$sdv$1@soap.pipex.net...
> Has anyone any idea how good Archive::Zip is - it's only at 0.09 which
> doesn't instil huge amounts of confidence, but then it hasn't changed
since
> May - which probably either means it's working ok or the author has given
up
> on it (!!)
>
> Ta
>
> Geoff
>
>
------------------------------
Date: Sun, 14 Jan 2001 12:40:35 -0800
From: Gary Burton <glburton@mindspring.com>
To: efflandt@xnet.com
Subject: Re: Can't associate .PL files in Win98
Message-Id: <3A620EC3.A2DCE993@mindspring.com>
The association still would not work in Windows 98. An opinion on one of the discussion groups was that it can't be done for shell (DOS) programs in Win95 or Win98, although it works fine in Windows NT. Unfortunately, that seems to be correct because I carefully reviewed the instructions in ActiveState's perlwin32faq4 FAQ called "How do I associate Perl scripts with Perl?" and followed them precisely.
It acts like it isn't even finding the Perl executable. I tried putting "Sleep 10" and <stdin> in my script, and neither kept the window open.
I did find a solution, although I don't like it much. I created a batch file called perl.bat in my c:\bat\ folder. Then I associated the .plx extension with c:\bat\perl.bat. Perl.bat only contains one line:
c:\Perl\bin\perl5.6.0.exe %1 %2
That works, but I don't like it because I don't like throwing programs in just to run programs, and the window doesn't close after the application finishes.
Related questions:
* Have you ever actually SEEN the association work in Windows 98? If so, I will continue to fight the battle. By the way, I have the first edition of Win98; but I don't think that matters.
* My c:\Perl\bin folder contains both Perl.exe and perl5.6.0.exe. Is there a difference? If so, what is it?
* "Learning Perl on Win32 Systems" recommends assigning a .PLX extension to the scripts as opposed to the .PL extension to avoid confusion with the Perl libraries. Yet, the FAQ "How do I associate Perl scripts with Perl?" and all the examples show the .PL extension. What do you think?
David Efflandt wrote:
>
> On Sat, 13 Jan 2001 12:39:37 -0800, Gary Burton <glburton@mindspring.com> wrote:
> > I am a newbie using Win98. I am using ActivePerl v5.6, and working from
> > the ActivePerl online documentation. I can run my example programs from
> > a DOS window by typing in "Perl filename"; but when I associate the .PL
> > extension as the literature suggest, all I get is a DOS window that
> > closes so quickly that I can't read the error message.
>
> Your computer is too fast. 8^) Seriously it has been awhile since I have
> done Perl in Windows (Perl5 before Activestate), but file association
> should work. If you want to see the result, you either need to put a
> sleep at the end or something that waits for input like this:
>
> <STDIN>;
>
> Then just hit the enter key after reading the result.
>
> > I followed the instructions in "How do I associate Perl scripts with
> > perl?" found in perlwin32faq4. I believe I followed the instructions
> > precisely. I researched the archived mail subscription site
> > "perl-win32-users" and found a comment to the effect that this will not
> > work in Win95 or Win98 although it does work in WinNT.
>
> It did work the last time I tried it in Win95. I could double click on a
> Perl script in Explorer (not to be confused with MSIE), to run it. But
> that does not allow you to add commandline parameters.
>
> --
> David Efflandt efflandt@xnet.com http://www.de-srv.com/
> http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
> http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/
------------------------------
Date: Sun, 14 Jan 2001 12:44:55 -0800
From: Gary Burton <glburton@mindspring.com>
To: dtbaker_dejanews@my-deja.com
Subject: Re: Can't associate .PL files in Win98
Message-Id: <3A620FC7.E154E053@mindspring.com>
No, I can't figure out why one computer uses the current directory and the other uses the perl directory. Perhaps you are using Windows NT, which I know very little about.
The association still would not work in Windows 98. An opinion on one of the discussion groups was that it can't be done for shell (DOS) programs in Win95 or Win98, although it works fine in Windows NT. Unfortunately, that seems to be correct because I carefully reviewed the instructions in ActiveState's perlwin32faq4 FAQ called "How do I associate Perl scripts with Perl?" and followed them precisely.
It acts like it isn't even finding the Perl executable. I tried putting "Sleep 10" and <stdin> in my script, and neither kept the window open.
I did find a solution, although I don't like it much. I created a batch file called perl.bat in my c:\bat\ folder. Then I associated the .plx extension with c:\bat\perl.bat. Perl.bat only contains one line:
c:\Perl\bin\perl5.6.0.exe %1 %2
That works, but I don't like it because I don't like throwing programs in just to run programs, and the window doesn't close after the application finishes.
Related questions:
* Have you ever actually SEEN the association work in Windows 98? If so, I will continue to fight the battle. By the way, I have the first edition of Win98; but I don't think that matters.
* My c:\Perl\bin folder contains both Perl.exe and perl5.6.0.exe. Is there a difference? If so, what is it?
* "Learning Perl on Win32 Systems" recommends assigning a .PLX extension to the scripts as opposed to the .PL extension to avoid confusion with the Perl libraries. Yet, the FAQ "How do I associate Perl scripts with Perl?" and all the examples show the .PL extension. What do you think?
dtbaker_dejanews@my-deja.com wrote:
>
> In article <3A60BD09.B0DAA9F6@mindspring.com>,
> Gary Burton <glburton@mindspring.com> wrote:
> > I am a newbie using Win98. I am using ActivePerl v5.6, and
> working from the ActivePerl online documentation. I can run my example
> programs from a DOS window by typing in "Perl filename"; but when I
> associate the .PL extension as the literature suggest, all I get is a
> DOS window that closes so quickly that I can't read the error message.
> >
> -----------------
> this *probably* means you have it working correctly actually... try
> putting a
> sleep 10;
> at the end of your script. when running a script by double-click, the
> DOS window only stays open while the script runs, then closes.
>
> on a related note though, I have installed the same version of
> ActivePerl on two different PCs, and one of them I have the double-click
> working and it uses the dir the script is in as the current working dir,
> and on the other it uses the dir where perl.exe is?!
>
> if you figure THAT one out, let me know!
>
> Dan
>
> Sent via Deja.com
> http://www.deja.com/
------------------------------
Date: 14 Jan 2001 21:37:48 +0100
From: Stef <stef@sos.ethz.ch>
Subject: escape single quotes on command line?
Message-Id: <3a620e1c@pfaff.ethz.ch>
Hi there
How do I escape single quotes in something like this:
find . -type f | xargs grep blabla | xargs perl -p -i.BACKUP -0777
's|blabla|'blabla'|gi' ?
I tried to escape the single quotes with a backslash, but that didn't
work...
Any suggestion welcome!
Stef
--
IT freelancer
President SOS-ETH
ETH Zurich
stef@hoes.li http://hoes.li
------------------------------
Date: 14 Jan 2001 22:03:40 +0100
From: Stef <stef@sos.ethz.ch>
Subject: Re: escape single quotes on command line?
Message-Id: <3a62142c@pfaff.ethz.ch>
Stef <stef@sos.ethz.ch> wrote:
: Hi there
: How do I escape single quotes in something like this:
: find . -type f | xargs grep blabla | xargs perl -p -i.BACKUP -0777
: 's|blabla|'blabla'|gi' ?
Hm, the problem was somewhere else: I also have ( and ) in my string,
which had to be escaped as well...
Stef
--
IT freelancer
President SOS-ETH
ETH Zurich
stef@hoes.li http://hoes.li
------------------------------
Date: Sun, 14 Jan 2001 18:09:40 -0500
From: H C <carvdawg@patriot.net>
Subject: Re: File info on win32
Message-Id: <3A6231B4.76862318@patriot.net>
perlfunc stat
Rob wrote:
> Does anyone know how to get the created, accessed and modified times
> for a file on NT 4? I checked deja and the Perl documentation but
> didn't find anything.
>
> Thanks,
> Rob
--
Q: Why is Batman better than Bill Gates?
A: Batman was able to beat the Penguin.
------------------------------
Date: Sun, 14 Jan 2001 20:40:03 GMT
From: iain_hogg@my-deja.com
Subject: Re: HTTP::Request encoding query
Message-Id: <93t2r2$u0j$1@nnrp1.deja.com>
In article <m366jj1e4o.fsf@mumonkan.sunstarsys.com>,
Joe Schaefer <joe+usenet@sunstarsys.com> wrote:
>
> RFC 2396 applies to the query string as well. Section 3.4 gives the
> specification, but it's quite brief. Here is a excerpt from the intro
> to section 3:
>
> This "generic URI" syntax consists of a sequence of four main
> components:
>
> <scheme>://<authority><path>?<query>
>
You're right, I didn't spot this, sorry.
> When this happens, you aren't necessarily powerless to "fix" the
> problem yourself. If the code is OO, by identifying the offending
> subroutine/data structure and "overriding" it, you can usually solve
> the problem. In your case it's a twisty path, but you could try
> something like this
>
[solutions cut]
Thanks, your first solution works fine, I'll probably move to the second
solution long term. My dirty solution was to modify the URI::Escape source
so the %escapes hash had '|' hashing to '|' and reinstalled the package,
obviously a bad idea. I wrongly assumed that the character escaping of the
request would be done immediately before sending it, it didn't occur to me
that modifying the request directly would work.
Again, thanks for your help.
--
Iain
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Mon, 15 Jan 2001 08:10:52 +1100
From: Mark Strong <x-mstrong@zeta.org.au>
Subject: Re: Make fails
Message-Id: <3A6215DC.C373520C@zeta.org.au>
old version of libc6-dev, thats all.
Mark Strong wrote:
> Trying to install a newish perl (5.6) on a debian linux 2.2.1 system, I
> get a blow up when its trying to compile the dynaloader
>
> see below
> -----------------------------------------
> Making DynaLoader (static)
> Processing hints file hints/linux.pl
> Writing Makefile for DynaLoader
> make[1]: Entering directory `/home/mstrong/perl-5.6.0/ext/DynaLoader'
> mkdir ../../lib/auto/DynaLoader
> make[1]: Leaving directory `/home/mstrong/perl-5.6.0/ext/DynaLoader'
> make[1]: Entering directory `/home/mstrong/perl-5.6.0/ext/DynaLoader'
> ../../miniperl -I../../lib -I../../lib -I../../lib -I../../lib
> DynaLoader_pm.PL DynaLoader.pm
> ../../miniperl -I../../lib -I../../lib -I../../lib -I../../lib
> XSLoader_pm.PL XSLoader.pm
> cp XSLoader.pm ../../lib/XSLoader.pm
> cp DynaLoader.pm ../../lib/DynaLoader.pm
> AutoSplitting ../../lib/DynaLoader.pm (../../lib/auto/DynaLoader)
> rm -f DynaLoader.xs
> cp dl_dlopen.xs DynaLoader.xs
> ../../miniperl -I../../lib -I../../lib ../../lib/ExtUtils/xsubpp
> -noprototypes -typemap ../../lib/ExtUtils/typemap DynaLoader.xs >
> DynaLoader.xsc && mv DynaLoader.xsc DynaLoader.c
> cc -c -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
> -O2 -DVERSION=\"1.04\" -DXS_VERSION=\"1.04\" -I../.. -DPERL_CORE
> -DLIBC="/lib/libc-2.1.3.so" DynaLoader.c
> rm -rf ../../lib/auto/DynaLoader/DynaLoader.a
> /usr/bin/ar cr ../../lib/auto/DynaLoader/DynaLoader.a DynaLoader.o && :
> ../../lib/auto/DynaLoader/DynaLoader.a
> chmod 755 ../../lib/auto/DynaLoader/DynaLoader.a
> make[1]: Leaving directory `/home/mstrong/perl-5.6.0/ext/DynaLoader'
> cc -L/usr/local/lib -rdynamic -o perl perlmain.o
> lib/auto/DynaLoader/DynaLoader.a libperl.a `cat ext.libs` -lnsl -lndbm
> -ldb -ldl -lm -lc -lposix -lcrypt
> /usr/lib/libdl.a(dlsym.o): In function `doit.2':
> dlsym.o(.text+0x22): undefined reference to `_dl_default_scope'
> dlsym.o(.text+0x4c): undefined reference to `_dl_default_scope'
> make: *** [perl] Error 1
>
> -------------
>
> Anyone have any idea what's wrong (some sort of library problem, but
> which one, is it something I haven't included, or an incompatible
> version).
>
> Regards
> Mark Strong
>
> mstrong@zeta.org.au
------------------------------
Date: Sun, 14 Jan 2001 23:38:10 +0100
From: Bernhard Schelling <schelling@bluewin.ch>
Subject: Make Screenshots on Win32 with Perl
Message-Id: <3A622A52.FD749731@bluewin.ch>
Hi All!
Is there a way to capture the whole screen or a area of the screen with
perl and save it as a file (gif/jpeg/bmp/whatever) or put it in memory
in a GD Picture or something like this?
Thanks a lot!
bye
------------------------------
Date: Sun, 14 Jan 2001 19:29:57 GMT
From: Mike <mike@customautotrim.com>
Subject: Need Help - Cookies vs. Browser (browser leads 2-1)
Message-Id: <3A61FE2D.3907B1EB@customautotrim.com>
We are going to be using cookies that we will be setting via Perl
cgi-scripts. We have 3 problems though:
1. Netscape doesn't seem to recognize our cookies when we set the
domain= to our domain which is customautotrim.com.
2. we use multiple domains for our web site i.e. customautotrim.com,
factorywooddash.com, etc., how do we keep each domain from leaving a
different cookie
3. if the person surfing our web site doesn't have cookies on in their
browser, how do we determine that?
#!/usr/bin/perl
if ($ENV{'HTTP_COOKIE'}) {
print "Content-type: text/html\n\n";
print <<"HTML code";
<html>
<head>
<title>Untitled Document</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Cookie already exists</p>
</body>
</html>
HTML code
}
else {
##leave a cookie and create a pop-up window
print "Set-Cookie:name=ezine4; expires=Wed, 17-Jan-2001 00:00:00 GMT;
path=/cgi-bin\n";
print "Content-type: text/html\n\n";
print <<"HTML code";
<html>
<head>
<title>Untitled Document</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Cookie has been set.</p>
</body>
</html>
HTML code
}
------------------------------
Date: Sun, 14 Jan 2001 15:39:36 -0600
From: "br__" <br@centurytel.net>
Subject: One line file doesn't work...
Message-Id: <W%o86.2404$SJ2.1434679@feed.centurytel.net>
I have this in my CGI file
#!/usr/local/bin/perl
I'm trying to figure out why it won't execute and have taken everything out
except that one header. I have given the directory and file 755 permission.
What am I doing wrong?
Thanks,
brettr
------------------------------
Date: 14 Jan 2001 15:43:36 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: One line file doesn't work...
Message-Id: <87k87xq06v.fsf@limey.hpcc.uh.edu>
>> On Sun, 14 Jan 2001 15:39:36 -0600,
>> "br__" <br@centurytel.net> said:
> I have this in my CGI file
> #!/usr/local/bin/perl
> I'm trying to figure out why it won't execute and have
> taken everything out except that one header. I have
> given the directory and file 755 permission. What am I
> doing wrong?
It's probably one or more of:
1. location of perl
$ which perl
/usr/bin/perl
Are you sure perl is in /usr/local/bin ?
2. PATH
If you are trying to run the program as
$ myprogram
it may be that "." is not in your PATH. Try
$ ./myprogram
hth
t
--
Eih bennek, eih blavek.
------------------------------
Date: Sun, 14 Jan 2001 15:50:34 -0600
From: "br__" <br@centurytel.net>
Subject: Re: One line file doesn't work...
Message-Id: <dap86.2405$SJ2.1435642@feed.centurytel.net>
After adding something like this:
print "Content-type: text/html \n\n";
print "show me the monkey";
it works. Guess I took out to much for testing the cause.
Thanks,
brettr
"Tony Curtis" <tony_curtis32@yahoo.com> wrote in message
news:87k87xq06v.fsf@limey.hpcc.uh.edu...
> >> On Sun, 14 Jan 2001 15:39:36 -0600,
> >> "br__" <br@centurytel.net> said:
>
> > I have this in my CGI file
> > #!/usr/local/bin/perl
>
> > I'm trying to figure out why it won't execute and have
> > taken everything out except that one header. I have
> > given the directory and file 755 permission. What am I
> > doing wrong?
>
> It's probably one or more of:
>
> 1. location of perl
>
> $ which perl
> /usr/bin/perl
>
> Are you sure perl is in /usr/local/bin ?
>
> 2. PATH
>
> If you are trying to run the program as
>
> $ myprogram
>
> it may be that "." is not in your PATH. Try
>
> $ ./myprogram
>
>
>
> hth
> t
> --
> Eih bennek, eih blavek.
------------------------------
Date: 14 Jan 2001 16:03:30 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: One line file doesn't work...
Message-Id: <87g0ilpz9p.fsf@limey.hpcc.uh.edu>
[ please put your new text after what you're replying to ]
>> On Sun, 14 Jan 2001 15:50:34 -0600,
>> "br__" <br@centurytel.net> said:
> After adding something like this: print "Content-type:
> text/html \n\n"; print "show me the monkey";
Check out the CGI module, it will make your life easier
(much easier). header() will generate the content-type
for you (and do it correctly).l
#!/usr/bin/perl -w
use strict;
use CGI qw(:standard);
print header();
print h1('a header');
print "\n";
> it works. Guess I took out to much for testing the
> cause.
Well, if you don't tell anyone you're writing CGI
programs...
t
--
Eih bennek, eih blavek.
------------------------------
Date: Sun, 14 Jan 2001 21:40:07 GMT
From: mintcake@my-deja.com
Subject: Re: overload not autogenerating as expected
Message-Id: <93t6bm$pg$1@nnrp1.deja.com>
I wasn't going to dignify Art's last message with a reply. However, I
really do want an intelligent response to my original query and I can
see it slipping down the list. Is there anybody really serious out
there?
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Sun, 14 Jan 2001 22:17:48 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: overload not autogenerating as expected
Message-Id: <x7ely522yb.fsf@home.sysarch.com>
>>>>> "m" == mintcake <mintcake@my-deja.com> writes:
m> Operation `eq': no method found,
m> left argument in overloaded package Foo,
m> right argument has no overloaded magic at foo.pl line 10.
well, you don't provide and eq method, so that error is correct.
m> package Foo;
m> use overload qw("") => sub { '*' . $_[0]->{key} . '*' };
m> sub new { bless {key => 'value'} }
m> my $x = Foo->new();
m> print "$x\n";
m> print "ok\n" if $x eq '*value*';
m> I would have thought that the autogeneration mechanism would have come
m> into play here, simply employing the stringification function to
m> evaluate the left hand operand. I suspect that my understanding of
m> what is going on here is a bit flaky. Can anyone explain?
i am not an expert on overload but in rereading the docs it seems that
only "" explicitly stringifies. since perl sees $x is overloaded, it
looks for an eq method in your class. it does not have the brains to
stringify first and just use internal eq. whereas it can convert an eq
to a cmp call which you figured out.
m> In order to get around the problem I have had to specify a 'cmp'
m> overload function something like...
m> cmp => sub { "$_[0]" cmp "$_[1]" }
m> ...which explicitly stringifies both operands (to be safe) before
m> performing the comparison.
you could just make an eq method if you want. but what is so complex
about that extra one line of code?
as those values are inside your overloaded class, you can do whatever
you want to them. i don't think the extra "" is needed. cmp should
stringify them just by itself as it is perl's cmp and not your
overloaded one.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Sun, 14 Jan 2001 17:46:45 -0500
From: EN <nlee@mediashell.net>
Subject: Perl working with Java???
Message-Id: <3A622C54.F8C236D5@mediashell.net>
Hi,
I need to write a Perl program to do some stuff. Most of the stuff
that the program has to do is already written in Java. Can anyone
suggests some ways or point me to some resources that makes Perl work
with Java?
Two methods come to my mind:
1) Translate Java code into Perl code
2) Somehow embed a JVM in the Perl program
I haven't been able to find a Java-2-Perl translator, and I haven't
been able to find a way to embed JVM in Perl. Hope someone can help
me.
Any help is greatly appreciated,
Nick
------------------------------
Date: Sun, 14 Jan 2001 20:36:01 GMT
From: "Steve Hancock" <steve+usenet@[24.1.75.184]>
Subject: Re: perlscript: can't figure out what's wrong
Message-Id: <R4o86.126633$A06.4022825@news1.frmt1.sfba.home.com>
> Can anyone try to help debugging the script? As I see it it has to be a
> minor mistake in syntax. perl script --> look below.>
I think the problem is the line
($day, $stock) = @($row);
The @ is probably swallowing the ( and making a punctuation variable.
Do you mean something like
( $day, $stock ) = @$row;
?
Steve
------------------------------
Date: Sun, 14 Jan 2001 22:10:39 -0000
From: "stevec" <stevec@ntlworld.com>
Subject: Price Comparison script?
Message-Id: <Erp86.2264$ye3.64637@news2-win.server.ntlworld.com>
Has anyone worked on or knows of a perl (or any other) script that will
search other web sites and compare prices, amalgamate them and list the
different prices on a web page?
Thanks
Stevec
------------------------------
Date: Sun, 14 Jan 2001 22:07:44 -0000
From: "stevec" <stevec@ntlworld.com>
Subject: Re: Price Comparison script?
Message-Id: <Vop86.2256$ye3.64377@news2-win.server.ntlworld.com>
Has anyone worked on or knows of a perl (or any other) script that will
search other web sites and compare prices, amalgamate them and list the
different prices on a web page?
Thanks
Stevec
------------------------------
Date: 14 Jan 2001 22:59:57 GMT
From: rich@bofh.concordia.ca (Rich Lafferty)
Subject: Re: Price Comparison script?
Message-Id: <slrn964brd.mde.rich@bofh.concordia.ca>
In comp.lang.perl.misc,
stevec <stevec@ntlworld.com> wrote:
> Has anyone worked on or knows of a perl (or any other) script that will
> search other web sites and compare prices, amalgamate them and list the
> different prices on a web page?
Yes, I have. I can't help but think you meant to ask more than that,
though.
-Rich
--
Rich Lafferty ----------------------------------------
Nocturnal Aviation Division, IITS Computing Services
Concordia University, Montreal, QC
rich@bofh.concordia.ca -------------------------------
------------------------------
Date: 14 Jan 2001 19:35:35 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: Regexp for XML
Message-Id: <979500827.400868@elaine.furryape.com>
In article <3A61D754.E55BFB3A@freenet.de>,
Christopher Kleinheitz <c-kleinheitz@freenet.de> wrote:
>Hi,
>
>I have some newbie-questions:
>
>Is there a Regexp for checking if a string contains valid XML?
No. Use XML::Parser.
------------------------------
Date: Sun, 14 Jan 2001 11:42:04 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Regexp for XML
Message-Id: <slrn963lms.9t6.tadmc@tadmc26.august.net>
Christopher Kleinheitz <c-kleinheitz@freenet.de> wrote:
>
>Is there a Regexp for checking if a string contains valid XML?
No.
It is impossible to validate XML with a regex. You need a real parser.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 14 Jan 2001 21:07:25 GMT
From: Bob Simon <bob_simon@my-deja.com>
Subject: Regular Expression Question
Message-Id: <93t4e9$vas$1@nnrp1.deja.com>
I'm told that the experts on regular expressions can be
found here so I hope one of you folks can answer a question
for me. I'm teaching myself unix (RH7) and cannot reconcile
the following behavior:
a) .* means zero or more occurrences of any character and
matches everything between ^ and $ (the entire line).
b) [A-Za-z]* means zero or more occurrences of any capital
or small letter and appears to match the null string.
For consistency, it seems like [A-Za-z]* should match the
first n letters in a line, up to the first space, or
non-alphabetic char. Where is the error in this logic?
--
Please address private email replies to bsimon at ATT dot Net.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Sun, 14 Jan 2001 21:23:20 GMT
From: Bob Simon <bob_simon@my-deja.com>
Subject: Re: Regular Expression Question
Message-Id: <93t5c2$vta$1@nnrp1.deja.com>
In article <93t4e9$vas$1@nnrp1.deja.com>,
Bob Simon <bob_simon@my-deja.com> wrote:
> I'm told that the experts on regular expressions can be
> found here so I hope one of you folks can answer a question
> for me. I'm teaching myself unix (RH7) and cannot reconcile
> the following behavior:
>
> a) .* means zero or more occurrences of any character and
> matches everything between ^ and $ (the entire line).
>
> b) [A-Za-z]* means zero or more occurrences of any capital
> or small letter and appears to match the null string.
>
> For consistency, it seems like [A-Za-z]* should match the
> first n letters in a line, up to the first space, or
> non-alphabetic char. Where is the error in this logic?
Never mind. It's working now as expected. I have no idea why
this didn't work earlier today.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Sun, 14 Jan 2001 19:17:16 -0000
From: "Dr Joolz" <julius_mong@hotmail.com>
Subject: Regular Expression... can I use a $var to represent it?
Message-Id: <L6n86.1682$ye3.49450@news2-win.server.ntlworld.com>
Dear all, I have a little test program to see if something like "0 0 800
200" (basically 4 numbers separated by spaces or/and commas) would match:
print "Please enter string: ";
chomp ($regexp = <STDIN>);
my $reg =
"[+-]?[0-9]+(\.[0-9]+)?(\s*,\s*|\s+,?\s*|\s*,?\s+)[+-]?[0-9]+(\.[0-9]+)?(\s*
,\s*|\s+,?\s*|\s*,?\s+)[+-]?[0-9]+(\.[0-9]+)?(\s*,\s*|\s+,?\s*|\s*,?\s+)[+-]
?[0-9]+(\.[0-9]+)?";
if ($regexp =~ /^$reg$/) {
print "\nMatched";
} else {
print "\nUnmatched";
}
Strange thing happens here, it won't match! But IF I remove $reg, and put
the regexp directly into /^ and $/ in the if statement, it will... so does
it mean I can't have the regexp stored in a $var and use it whenever I need
to somewhere else in the same program? I've tried with many other simpler
regexps but still no luck...
Please help this newbie... THANX a million times!!!
Annoyed and puzzled,
Jules
***24 hours in a day...24 beers in a case...coincidence?***
------------------------------
Date: Sun, 14 Jan 2001 13:47:31 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Regular Expression... can I use a $var to represent it?
Message-Id: <slrn963t23.a6g.tadmc@tadmc26.august.net>
Dr Joolz <julius_mong@hotmail.com> wrote:
>Dear all, I have a little test program to see if something like "0 0 800
>200" (basically 4 numbers separated by spaces or/and commas) would match:
>
>chomp ($regexp = <STDIN>);
^^^^^^
You should not call it 'regexp' when it is not a regular expression!
Very misleading name.
>
>my $reg =
>"[+-]?[0-9]+(\.[0-9]+)?(\s*,\s*|\s+,?\s*|\s*,?\s+)[+-]?[0-9]+(\.[0-9]+)?(\s*
^ ^
^ ^
What happens to backslashes in a double quoted string?
>,\s*|\s+,?\s*|\s*,?\s+)[+-]?[0-9]+(\.[0-9]+)?(\s*,\s*|\s+,?\s*|\s*,?\s+)[+-]
>?[0-9]+(\.[0-9]+)?";
print "\$reg is:\n/$reg/\n"; # see for yourself what is wrong
You should write it so that you can easily read what you have written;
my $reg = '[+-]?[0-9]+(\.[0-9]+)?' . # floating point number
'(\s*,\s*|\s+,?\s*|\s*,?\s+)' . # separator
'[+-]?[0-9]+(\.[0-9]+)?' . # floating point number
...
>Strange thing happens here, it won't match!
Strange thing happened there, you ran perl without warnings enabled!
It makes about 20 warning messages for your code above.
Ask for all the help you can get!
Enable warnings on every single Perl program that you ever write.
>it mean I can't have the regexp stored in a $var and use it whenever I need
>to somewhere else in the same program?
You can do that, but you have to put the Right Thing into the variable :-)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 14 Jan 2001 20:59:12 GMT
From: mintcake@my-deja.com
Subject: Re: Regular Expression... can I use a $var to represent it?
Message-Id: <93t3ut$ut5$1@nnrp1.deja.com>
In article <L6n86.1682$ye3.49450@news2-win.server.ntlworld.com>,
"Dr Joolz" <julius_mong@hotmail.com> wrote:
> Dear all, I have a little test program to see if something like "0 0
800
> 200" (basically 4 numbers separated by spaces or/and commas) would
match:
Use single quotes (apostophes) instead of double quotes for the $reg
literal. What is happening is that the compiler is translating the
escaped characters (e.g. \. \s etc.) before the regexp processor gets
to see them. Single quoted string literals are not subject to escaped
character translation (except \' or fourse)
>
> print "Please enter string: ";
> chomp ($regexp = <STDIN>);
>
> my $reg =
> "[+-]?[0-9]+(\.[0-9]+)?(\s*,\s*|\s+,?\s*|\s*,?\s+)[+-]?[0-9]+(\.[0-9]
+)?(\s*
> ,\s*|\s+,?\s*|\s*,?\s+)[+-]?[0-9]+(\.[0-9]+)?(\s*,\s*|\s+,?\s*|\s*,?
\s+)[+-]
> ?[0-9]+(\.[0-9]+)?";
>
> if ($regexp =~ /^$reg$/) {
> print "\nMatched";
> } else {
> print "\nUnmatched";
> }
>
> Strange thing happens here, it won't match! But IF I remove $reg, and
put
> the regexp directly into /^ and $/ in the if statement, it will... so
does
> it mean I can't have the regexp stored in a $var and use it whenever
I need
> to somewhere else in the same program? I've tried with many other
simpler
> regexps but still no luck...
>
> Please help this newbie... THANX a million times!!!
>
> Annoyed and puzzled,
> Jules
>
> ***24 hours in a day...24 beers in a case...coincidence?***
>
>
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Sun, 14 Jan 2001 20:50:57 GMT
From: "Steve Hancock" <steve+usenet@[24.1.75.184]>
Subject: Re: Replacing the "\" character in Perl.
Message-Id: <Rio86.126655$A06.4020412@news1.frmt1.sfba.home.com>
In article <93q8b0$sfg$1@nnrp1.deja.com>, shiloam@my-deja.com wrote:
> I desperately need to replace the "\" character in a string variable.
How about this:
$a = q#c:\junk1\junk2\logfile#;
print "$a\n";
$a =~ s#\\#/#g;
print "$a\n";
which gives:
c:\junk1\junk2\logfile
c:/junk1/junk2/logfile
Steve
------------------------------
Date: Sun, 14 Jan 2001 19:52:08 GMT
From: "Steve Hancock" <steve+usenet@[24.1.75.184]>
Subject: Re: What do you call the => operator?
Message-Id: <Irn86.126575$A06.4020436@news1.frmt1.sfba.home.com>
In article <slrn95g6gf.59d.ben-fuzzybear@Odin.Thor>,
ben-fuzzybear@geocities.com wrote:
> I was just glancing through Ellie Quigley's "Perl Programming Guide",
> and spied the following horror:
>
> "Perl 4 used the comma to separate the key and value items; Perl5 uses
> =>
> (digraph symbol)."
>
>
> Does anyone know the actual name for this thing, though? _Is_ there one?
>
It is called the "comma arrow" in the Perl Cookbook by Christiansen and
Torkington.
Steve Hancock
------------------------------
Date: Sun, 14 Jan 2001 20:10:38 GMT
From: "Henry" <usequity@mindspring.com>
Subject: Re: What do you call the => operator?
Message-Id: <2Jn86.45453$ge4.17653622@news2.rdc2.tx.home.com>
It is also called the arrow operator and the arrow comma in Perl in a
Nutshell
JAPH,
Henry
Steve Hancock <steve+usenet@[24.1.75.184]> wrote in message
news:Irn86.126575$A06.4020436@news1.frmt1.sfba.home.com...
> In article <slrn95g6gf.59d.ben-fuzzybear@Odin.Thor>,
> ben-fuzzybear@geocities.com wrote:
>
> > I was just glancing through Ellie Quigley's "Perl Programming Guide",
> > and spied the following horror:
> >
> > "Perl 4 used the comma to separate the key and value items; Perl5 uses
> > =>
> > (digraph symbol)."
> >
> >
> > Does anyone know the actual name for this thing, though? _Is_ there one?
> >
> It is called the "comma arrow" in the Perl Cookbook by Christiansen and
> Torkington.
> Steve Hancock
------------------------------
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 60
*************************************