[10480] in Perl-Users-Digest
Perl-Users Digest, Issue: 4071 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 26 12:54:20 1998
Date: Mon, 26 Oct 98 09:05:30 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 26 Oct 1998 Volume: 8 Number: 4071
Today's topics:
Re: Objects -vs- packages & hashes <jhoglund@mirage.skypoint.net>
Re: Objects -vs- packages & hashes (Martien Verbruggen)
Re: passing associative arrays (Sam Holden)
Re: Perl & Y2K - booby trap code <mpersico@erols.com>
Re: Perl & Y2K - booby trap code (Ronald J Kimball)
Re: Perl & Y2K - booby trap code finsol@ts.co.nz
Re: Perl & Y2K - booby trap code (Matt Knecht)
Re: Perl Cookbook - is this the best perl book? <mpersico@erols.com>
Perl Insert or Update Command <suh@jupiter.cs.wayne.edu>
Re: Perl Insert or Update Command dave@mag-sol.com
Perl script calling another cgi program eliottQYHHYC@ukonline.co.uk
Perl work <tad21@dial.pipex.com>
pipes to an external program Marc @ box . com
Re: pipes to an external program <m.v.wilson@erols.com>
Re: pipes to an external program (Tad McClellan)
Re: PLEASE HELP SOON!!! (McG)
Re: PLEASE HELP SOON!!! (Joergen W. Lang)
Probelm with LWP:Simple & Strings hate_nazis286@my-dejanews.com
Re: Probelm with LWP:Simple & Strings (Martien Verbruggen)
Re: Probelm with LWP:Simple & Strings (Tad McClellan)
problem with file test -e (Barry G Reville)
Problem with starting perl script. <Alexei.Karpov@sonycom.com>
Re: Problems with plus sign in perl script <erhmiru@erh.ericsson.se>
Q: Opinions on Perl/Qt? (Dave)
Re: Q: Opinions on Perl/Qt? <m.v.wilson@erols.com>
Re: Regular Expression Problem ??? (r j huntington)
Re: Regular Expression Problem ??? (Ronald J Kimball)
Re: Sherlock module to search www.perl.com (Rich Morin)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 26 Oct 1998 03:51:25 GMT
From: Jamie Hoglund <jhoglund@mirage.skypoint.net>
Subject: Re: Objects -vs- packages & hashes
Message-Id: <710rjt$5ng$1@shadow.skypoint.net>
Justin B. Harvey <jbharvey@auspex.net> wrote:
: I don't really understand why you're doing all this, creating functions
: that are done in perl, however you can bless an anonymous hash, and then
: put your information in it like:
The functions that open files might do other things, (such as open indices
read headers and things related to that particular file)
: package Foo::Bar;
: sub new {
: my ($class, $this) = @_;
: $this = { };
: bless $this, $class;
: return $this;
: }
: # That code above makes it so you now have an anonymous hash object.
: # So to set things in the caller script:
Ah! So $self->{variable} *is* a hash element?! Sort of back to the
keyed double hashes that I already am using? (I was thinking $self->{var};
was the scalar $var in instance "$self" of package (or class?)
"mypackage") The anonymous hash was just something it could "grip".
: $f = new Foo::Bar;
: $f->{key1} = "information";
: # Simple.
: But let's say you want to open up a file with it, you can store
: variables or handles (I think) in the hash, whatever you want.
Yea, that seems to work (storing everything in hashes), but I look at what
it does and see all this
$var->funcname("parameters"); stuff everyone else uses, and think hmm..
maybe I'm doing manually what perl does with objects automatically.
If $f->{key}; is a hash element, then I'd just be chasing my tail to
convert everything to objects. (I think anyway) It would look a little
nicer than: $State[$fh]{variable};
It's been a _long_ time since I visited C++ and that was only a brief
tour, but isn't there something *like* (I know the syntax isn't right)
classname a; // I forgot how, but create two instances of "classname" as
classname b; // a and b.
a.function(param);
b.function(param);
Where b.function and a.function are the same function, except that a and b
have different variable pools? I was thinking there was a way to get perl
to do that automatically.
The $self->{variable}; being a hash element is a revelation to me, thanks!
Jamie
------------------------------
Date: Mon, 26 Oct 1998 03:55:02 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Objects -vs- packages & hashes
Message-Id: <qoSY1.49$4V4.250584@nsw.nnrp.telstra.net>
In article <710rjt$5ng$1@shadow.skypoint.net>,
Jamie Hoglund <jhoglund@mirage.skypoint.net> writes:
> The $self->{variable}; being a hash element is a revelation to me, thanks!
You might want to have a read of the perltoot document that comes with
perl. It will explain a lot about how OO is implemented in perl.
# perldoc perltoot
This will refer you to other documentation such as:
# perldoc perlmod
# perldoc perlref
# perldoc perlobj
# perldoc perlbot
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 26 Oct 1998 00:34:58 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: passing associative arrays
Message-Id: <slrn737gti.qe4.sholden@pgrad.cs.usyd.edu.au>
On Sat, 24 Oct 1998 22:40:54 -0700, Tobin Fricke <tobin@sji.org> wrote:
>On 25 Oct 1998, Sam Holden wrote:
>
>> something(\%data,'hello);
>
>Thanks -- it's that \%data notation that I was looking for.
Obviously me bad... I think I may have missed a quote...
--
Sam
You can blame it all on the internet. I do...
--Larry Wall
------------------------------
Date: Sun, 25 Oct 1998 22:52:17 -0500
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <3633F1F1.E94B2F41@erols.com>
Hmmm. "Tom" and "context" in the same posting? Kinda like mixing matter
and anti-matter eh?
Randal Schwartz wrote:
[snip]
> Russ> I think you need to read Tom's rant about Y2K again. :)
>
[snip]
> There is *always* a context for any data.
--
Matthew O. Persico
Nothing even remotely clever at the moment.
------------------------------
Date: Sun, 25 Oct 1998 23:25:06 -0500
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <1dhh8yx.1khchyc188rvp9N@bay1-115.quincy.ziplink.net>
Jim Brewer <jimbo@soundimages.co.uk> wrote:
> rjk@coos.dartmouth.edu (Ronald J Kimball) writes:
>
> >
> > What a ridiculous analogy. We can argue with analogies all day, but it
> > will be completely futile if our analogies map so poorly onto reality.
> >
> > Is that analogy any better? Who cares. The fact remains, returning the
> > year - 1900 is not intuitive. Simply returning the year would have been
> > simpler and less likely to lead to programmer error.
> >
>
> Agreed. I will never use analogy again. For the record, your analogy
> does not map onto reality that much better.
As I said, "who cares?" Neither analogy was that great. :-)
> Reading a note in the
> glove box is NOT the same as reading the owners manual that the
> manufaturer provides with the car. If the owners manual states a set
> of procedures to ensure safe use of the hand brake, well that is a
> different matter. If the owner fails to read the manual for the proper
> use of the hand brake, isn't that the responsibility of the owner? If
> the owner fails to read the manual for the proper and safe use of the
> vehicle, should they be surprised when the vehicle fails in use that
> deviates from that as prescribed in the manual?
An improved analogy, then, based on your comments above.
Suppose I sell a car. I happen to know that the parking brake on
this car only works if you twist the handle. I write a chapter in the
Owner's Manual, dedicated entirely to the parking brake and how to
operate it properly.
Suppose further that the purchaser of the car neglects to read that
chapter of the Owner's Manual, and makes the assumption that the parking
brake works by simply pulling on the handle. The owner parks on a hill
and pulls on the parking brake handle without twisting.
The car rolls down the hill and smashes into a store front. Perhaps we
will agree that it is the fault of the car's owner for not reading the
manual. That is little consolation to the store owner, however, whose
shop has been destroyed either way. Even worse, suppose a bystander was
struck and killed by the driverless car.
Imagine if, instead, I had simply manufactured the parking brake to work
by just pulling on the handle.
So, the car's owner is at fault, but the entire tragedy could have been
avoided if the parking brake had worked as expected.
Obviously, the results of a Y2K programming error are unlikely to be so
drastic. But the point is the same in either case, that a more logical
or intuitive implementation will cause fewer errors.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Mon, 26 Oct 1998 09:43:24 GMT
From: finsol@ts.co.nz
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <711g7r$n9q$1@nnrp1.dejanews.com>
In article <70vmnj$15g$2@marina.cinenet.net>,
cberry@cinenet.net (Craig Berry) wrote:
> Matt Knecht (hex@voicenet.com) wrote:
> : Abigail <abigail@fnx.com> wrote:
> : >There isn't any problem having localtime return numbers in base 17. Or the
> : >number of years since 1666 squared, minus 1024.
> : >
> : >It doesn't make it easy for the programmer though.
> :
> : It makes it easy for the C programmer migrating to Perl.
>
> And therein lies the summary, which we can continue to go 'round and
> 'round on ad nauseum without resolving. I think most of us would agree
> that having localtime return y-1900 was a bad idea on the part of the
> Unix/C designers; it's both unnecessary and a potential pitfall for clue-
> challenged programmers. Now that we have 25 years of existing practice
> with localtime-as-it-is behind us, though, it's more valuable to stick
> with the de facto and de jure convention than to make a misguided attempt
> to 'fix' it. If we want a localtime-ish func that returns year in raw
> form (and 1-12 month, perhaps), add one with a new name.
>
Who's suggesting that Perl localtime be fixed?How can you fix it if it isn't
broken? If you fix it then you 'break' the code that got it right and have
little chance of fixing the code that got it wrong!
What I can't understand is that that the designers of Perl set out to make
localtime work the same as tm_year in C - they gave it a different name - why
not give a new (and more sensible) way of working.
Still, what is done is done. It can't be changed. What is necessary though is
to realise that Perl has major potential for falling over with the Y2K
problem. Trying to lay blame, name calling or suggesting certain people should
not be programmers is not going to change that fact. Instead of wasting
energy going around in circles or creating illogical justifications for a need
for such problematic year handling functionality, effort is better spent just
fixing the problems before they happen. That is what Y2K work is about -
preventing the worst from happening.
Yes, you can suggest all sorts of non-Y2K problems that could occur and
perhaps should be checked for as well, but these types of glitches happen all
the time. The Y2K problem is different in that we know when its going to
happen, we know what to check for, we know that there is a lot of work to be
done, we know that we are not going to get it all finished, we know we are
going to miss a lot of the bugs and we know that the Y2K problems we miss are
going to cause a lot of pain, perhaps sending some companies out of business.
So give your employers and clients a break - fix it for them so they have one
less thing to worry about re Y2K.
If you are still uncertain about the nature of the Y2K problem, check out my
first article on the subject:
http://www.idg.co.nz/nzweb/a526.html
Jocelyn Amon
--
Financial Solutions Limited
http://www.ts.co.nz/~finsol/
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Mon, 26 Oct 1998 15:23:54 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <eu0Z1.3$1g4.1552797@news2.voicenet.com>
finsol@ts.co.nz <finsol@ts.co.nz> wrote:
>Yes, you can suggest all sorts of non-Y2K problems that could occur and
>perhaps should be checked for as well, but these types of glitches happen all
>the time. The Y2K problem is different in that we know when its going to
>happen, we know what to check for, we know that there is a lot of work to be
>done, we know that we are not going to get it all finished, we know we are
>going to miss a lot of the bugs and we know that the Y2K problems we miss are
>going to cause a lot of pain, perhaps sending some companies out of business.
>So give your employers and clients a break - fix it for them so they have one
>less thing to worry about re Y2K.
I can honostly say, I've never programmed a century bug. I've never had
to deal with legacy code that had a century bug (In Perl, anyway. It
seems like all the shell scripts I find have century bugs).
So, from my personal experience, I just dont' see it. Of course, I'm
also one of the people that claimed time_t wasn't a problem that
bothered me at all. :)
Wheny ou say we're not going to get it all finished, and mistakes will
be made, who are you refering to? Does anybody reading this group have
the misfortune to work in a shop where this is a concern?
--
Matt Knecht - <hex@voicenet.com>
------------------------------
Date: Sun, 25 Oct 1998 22:33:32 -0500
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: Perl Cookbook - is this the best perl book?
Message-Id: <3633ED8C.F4C9C02C@erols.com>
The book is worth the price for psgrep alone!
--
Matthew O. Persico
Nothing even remotely clever at the moment.
------------------------------
Date: Mon, 26 Oct 1998 04:12:22 -0500
From: Sudheer Havaligi <suh@jupiter.cs.wayne.edu>
Subject: Perl Insert or Update Command
Message-Id: <Pine.SUN.3.91.981026041143.26623D-100000@jupiter.cs.wayne.edu>
Hi all,
I'm trying to run a perl insert command. Please someone give me
the systax for the perl insert command with "where" clause.
I'm able to insert, but without 'where' clause. If i'm trying to put
'where' clause i'm getting problems. I mean i'm not getting any errors
but the database is not being updated.
Also please give me a sample code for 'update' command with 'where'
clause. Because i'm having the same problem for the 'update' command too.
I mean when i'm trying to put 'where' clause i'm getting errors. some
times i'm not getting errors, but the database is not being updated. I'm
using Access'97 Database and ActivePerl5.0 on windowsNT machine with IIS
web server.
Please someone Help me.
-sudheer havaligi
suh@cs.wayne.edu
havalgi@hotmail.com
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
SUDHEER HAVALIGI
Home# (313) 833 7555
Off # (313) 993 7739
E-Mail :- 1. suh@cs.wayne.edu
2. sudheer.havaligi@wayne.edu
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
------------------------------
Date: Mon, 26 Oct 1998 11:34:52 GMT
From: dave@mag-sol.com
Subject: Re: Perl Insert or Update Command
Message-Id: <711mos$uco$1@nnrp1.dejanews.com>
Sudheer,
Perl doesn't have an insert command. I assume you're using one of the
database extensions, but without knowing which one it's difficult to help.
Perhaps you could post a stripped down vversion of your script that
illustrates the problem.
hth,
Dave...
In article <Pine.SUN.3.91.981026041143.26623D-100000@jupiter.cs.wayne.edu>,
Sudheer Havaligi <suh@jupiter.cs.wayne.edu> wrote:
> Hi all,
> I'm trying to run a perl insert command. Please someone give me
> the systax for the perl insert command with "where" clause.
> I'm able to insert, but without 'where' clause. If i'm trying to put
> 'where' clause i'm getting problems. I mean i'm not getting any errors
> but the database is not being updated.
>
> Also please give me a sample code for 'update' command with 'where'
> clause. Because i'm having the same problem for the 'update' command too.
> I mean when i'm trying to put 'where' clause i'm getting errors. some
> times i'm not getting errors, but the database is not being updated. I'm
> using Access'97 Database and ActivePerl5.0 on windowsNT machine with IIS
> web server.
> Please someone Help me.
>
> -sudheer havaligi
> suh@cs.wayne.edu
> havalgi@hotmail.com
--
dave@mag-sol.com
London Perl M[ou]ngers: <http://london.pm.org/>
[Note Changed URL]
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 26 Oct 1998 09:31:41 GMT
From: eliottQYHHYC@ukonline.co.uk
Subject: Perl script calling another cgi program
Message-Id: <711fht$3s0$1@morse.news.easynet.net>
Hello
I have a Perl CGI script that outputs an HTML page (nothing surprising
there) and another CGI program written in C that does the same thing.
I need to include some of the output from the C program in the output
of the Perl script. I have made adjustments to the C program in order
that it doesn't return any header information when called by the Perl
script.
Using a pipe I've redirected the Perl scripts STDIN to the C program
so that it has access to the environment variables (I assume it
wouldn'thave access to the variables otherwise). I then need the C
program toreturn it's output to the Perl scripts STDOUT. Can I pipe
from one STDOUT to another STDOUT or will the C program have the same
STDOUT as the Perl script anyway even though it was called by a child
process ?
I'm a bit confused. Can anybody point out any issues when calling CGI
programs from other CGI programs as far as STDIN and STDOUT are
concerned.
Many thanks
Please remove the QYHHYC before replying by email.
***** Posted via the UK Online online newsreader *****
Go to http://www.ukonline.co.uk to find out
about other online services we offer our subscribers.
------------------------------
Date: 26 Oct 1998 13:43:24 GMT
From: "Ralph Windsor" <tad21@dial.pipex.com>
Subject: Perl work
Message-Id: <01be00e6$58ac0860$e64a95c1@ralph>
We need someone to help out our client in Alderny (Channel Islands, Europe)
for an on-site contract for about three months. The required skills are
Perl, Red Hat Linux, and X-Forms.
We also would like to meet anyone based in London who is able to help us
with small Perl/CGI projects either on or off-site.
Anyone interested?
E-mail your CV with to work@daydream.co.uk
------------------------------
Date: 25 Oct 1998 22:01:27 GMT
From: Marc @ box . com
Subject: pipes to an external program
Message-Id: <363b9f9e.1823732@news.euronet.be>
I need to call a program from a perl script, passing it some datas
through its STDIN and reading from its STDOUT.
I'm trying to open 2 pipes to this program; one to its STDIN and one
to its STDOUT. But I can only make one.
Here the code I wrote:
connection to "progname" STDIN:
...
$file='|./progname params ';
open (HDL,$file);
...
connection to "progname" STDOUT:
...
$file='./progname params |';
open (HDL,$file);
...
but
$file='|./progname params |';
doesn't work (sh syntax error)
What should I do? Can I manually open the second pipe after the
"open" statement ? Should I use another function instead of "open" ?
Keep in mind that I can't use temporary file (no permissions).
Thanks,
Marc
------------------------------
Date: Mon, 26 Oct 1998 02:21:06 +0000
From: WMWilson <m.v.wilson@erols.com>
Subject: Re: pipes to an external program
Message-Id: <3633DC92.667E1956@erols.com>
Marc, @, box, ., com wrote:
>
> I need to call a program from a perl script, passing it some datas
> through its STDIN and reading from its STDOUT.
>
> I'm trying to open 2 pipes to this program; one to its STDIN and one
> to its STDOUT. But I can only make one.
>
> Here the code I wrote:
>
> connection to "progname" STDIN:
> ...
> $file='|./progname params ';
> open (HDL,$file);
> ...
>
> connection to "progname" STDOUT:
> ...
> $file='./progname params |';
> open (HDL,$file);
> ...
>
> but
> $file='|./progname params |';
> doesn't work (sh syntax error)
>
> What should I do? Can I manually open the second pipe after the
> "open" statement ? Should I use another function instead of "open" ?
>
> Keep in mind that I can't use temporary file (no permissions).
>
> Thanks,
> Marc
While I'm only beginning to learn Perl, I think I know, but hopefully
someone more knowledgable will also reply to confirm or deny this.
It's true that you cannot open the filehandle like that (i.e. open FH,
"| /t/d |"). If you need to read/write simultaneously I believe "pipe"
or possibly something like: open FH, "+>/t/d" is what you're looking
for. You can also read, close the handle re-open it and write to it, if
that works for your program.
Again though, I'm new at this, so...take it for what it's worth.
--
Just Another Newbie Wannabe Perl Hacker....or something.
------------------------------
Date: Sun, 25 Oct 1998 21:33:43 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: pipes to an external program
Message-Id: <niq017.kk2.ln@flash.net>
Marc@box.com wrote:
: I need to call a program from a perl script, passing it some datas
: through its STDIN and reading from its STDOUT.
: What should I do?
How about reading the solution to your Frequently Asked Question
in the aptly named Perl Frequently Asked Questions?
Perl FAQ, part 8,
"How can I open a pipe both to and from a command?"
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 25 Oct 1998 23:11:46 GMT
From: Michael-Joel@worldnet.att.net*** (McG)
Subject: Re: PLEASE HELP SOON!!!
Message-Id: <710b7i$ji5@bgtnsc02.worldnet.att.net>
It worked for me....
------------------------------
Date: Mon, 26 Oct 1998 14:28:50 +0100
From: jwl@_munged_worldmusic.de (Joergen W. Lang)
Subject: Re: PLEASE HELP SOON!!!
Message-Id: <1dhgq0p.1vi6h0vlwxsxqN@host006-210.seicom.net>
Sarah Crawford <bast2657@sssnet.com> wrote:
> Hello. I have been recently installing CGI scripts to my web site.
> Each three of them are not working. The URLS are:
> http://server7.hypermart.net/sarahpc/wwwboard/wwboard.html
> http://server7.hypermart.net/sarahpc/orderform12.html
> http://server7.hypermart.net/sarahpc/userpages/index.html
> Help would be greatly appreciated, and I would be glad to give you free
> services from my site for your help! Please relpy soon, I really need
> to have these problems fixed by Tuesday!! Thanks
>
> Sarah
Dear Sarah,
not all of us are as psychic as you. ;-)
If you had included some pieces of the code you were experiencing
trouble with and the error messages, there might be more of a chance.
My crystal ball tells me that the wwwboard script does not seem to be
installed at all and the other two scripts are experiencing a "premature
end of script headers" - problem.
<turning a card>
It is not easy to tell though what these errors mean in detail. Oh - but
wait - ooooohhhh - ah, yes - the medium says, fortune may be good if you
ask for help in a cgi-newsgroup.
<turning another card>
Oh - now I can see it !! Try "comp.infosystems.www.authoring.cgi" but
use it with care <turning "The Flame"> you might experience some
unexpected warmth....
Thank you ! Good luck !
Joergen
--
To reply by email please remove _munged_ from address Thanks !
-------------------------------------------------------------------
"Everything is possible - even sometimes the impossible"
HOELDERLIN EXPRESS - "Touch the void"
------------------------------
Date: Sun, 25 Oct 1998 23:13:06 GMT
From: hate_nazis286@my-dejanews.com
Subject: Probelm with LWP:Simple & Strings
Message-Id: <710ba2$fd7$1@nnrp1.dejanews.com>
Ok...
This code works:
use lib '/home/ammar/perl/lib';
use LWP::Simple;
$target = 'http://www.host.com/cgi-bin/test?symbol=GM';
$doc = get $target;
print $doc
but when I try to compose $target variable with:
$target = 'http://www.host.com/cgi-bin/test?symbol=','GM';
it doesen't work :( That is, he misinterprets the GM symbol
What am I doing wrong?
Dem
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Sun, 25 Oct 1998 23:36:05 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Probelm with LWP:Simple & Strings
Message-Id: <FBOY1.22$4V4.117392@nsw.nnrp.telstra.net>
In article <710ba2$fd7$1@nnrp1.dejanews.com>,
hate_nazis286@my-dejanews.com writes:
> $target = 'http://www.host.com/cgi-bin/test?symbol=','GM';
^
should be a .
You should really have checked what was in $target.
# perldoc perlop
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: Sun, 25 Oct 1998 21:28:17 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Probelm with LWP:Simple & Strings
Message-Id: <h8q017.kk2.ln@flash.net>
hate_nazis286@my-dejanews.com wrote:
: This code works:
: use lib '/home/ammar/perl/lib';
: use LWP::Simple;
: $target = 'http://www.host.com/cgi-bin/test?symbol=GM';
: $doc = get $target;
: print $doc
: but when I try to compose $target variable with:
: $target = 'http://www.host.com/cgi-bin/test?symbol=','GM';
^
^
: it doesen't work :( That is, he misinterprets the GM symbol
It is correctly interpreting the GM "symbol".
Try the assignment to $target above with -w warnings enabled,
and see what it says...
: What am I doing wrong?
Not running with warnings enabled, for one ;-)
$target = 'http://www.host.com/cgi-bin/test?symbol=GM';
or
$target = 'http://www.host.com/cgi-bin/test?symbol='.'GM'; # use a dot
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 26 Oct 1998 14:02:56 GMT
From: breville@uoguelph.ca (Barry G Reville)
Subject: problem with file test -e
Message-Id: <711veg$s63$1@testinfo.uoguelph.ca>
I have a program that uses the -e file test several times to
check if a file exists before opening the file to write to.
Unfortunately it doesn't seem to work consistently - sometimes it gives
the exact opposite answer I expect and overwrites the files.
Here's an example:
if (!-e $tempfile){
$temp = -e $tempfile;
print "-e = '$temp' ::";
$temp = (!-e $tempfile);
print "!-e = '$temp' \n";
open(VALUEFILE,">$tempfile") or die "Couldn't open $tempfile\n";
}
Now , even though $tempfile exists it reports "-e = ''" and
"!-e = '1'" with the result that it overwrites the file.
In other parts of my program I use it again but it sometimes
works and sometimes not - what am I missing?
Barry Reville
University of Guelph
Computing and Communications Services
breville@uoguelph.ca
------------------------------
Date: Mon, 26 Oct 1998 17:24:44 +0100
From: Alexei Karpov <Alexei.Karpov@sonycom.com>
Subject: Problem with starting perl script.
Message-Id: <3634A24B.D307E9C0@sonycom.com>
Hi,
I have next situation : I use Cygwin32 and I have to port
makefile's system from Unix to NT. I have problem with next string :
perl /y/aaa/bbb/ccc.perl. I got next error :
Cannot open perl script : perl /y/aaa/bbb/ccc.perl : No such file or
dir.
where /y - mounted network drive.
When I use cat command it string works properly. What's happened ?
May be anybody had the similar problem ?
Regards,
--
Alexei Karpov
SONY Platform Software Development Center - Belgium ( PSDC-B )
Sint Stevens Woluwestraat 55 ( Rue de Woluwe-Saint-Etienne )
1130 Brussel ( Bruxelles ), Belgium, Europe, Earth
Tel. : +32 2 724.86.50
Fax : +32 2 726.26.86
E-mail: Alexei.Karpov@sonycom.com
" There is no future or freedom in the circumscribed life and
the only other life is complete rejection of the rules... "
------------------------------
Date: 26 Oct 1998 12:07:38 +0100
From: Michal Rutka <erhmiru@erh.ericsson.se>
To: "Bertil Wennergren" <bertilow@hem1.passagen.se>
Subject: Re: Problems with plus sign in perl script
Message-Id: <lag1cb8ttx.fsf@erh.ericsson.se>
"Bertil Wennergren" <bertilow@algonet.se> writes:
<cut>
> Yes, but the following does not work:
>
> #!/usr/bin/perl -w
>
> use diagnostics;
> use strict;
>
> my $plus_sign = "\+";
> my $plus_word = "plus";
>
> my $string1 = "word $plus_sign word";
>
> print "$string1\n";
>
> $string1 =~ s|$plus_sign|$plus_word|g;
change this line to:
$string1 =~ s|\Q$plus_sign|$plus_word|g; # Why are you using /g modifier?
it should work now.
> print "$string1\n";
Michal
------------------------------
Date: Sun, 25 Oct 1998 23:50:35 GMT
From: not@anygood.net (Dave)
Subject: Q: Opinions on Perl/Qt?
Message-Id: <3633b517.17549571@news.isoc.net>
I've been programming in Perl/Tk for a couple years on both UNIX and
Windows. We are finally moving to C++ in our group, and the Qt
widgets look like a better fit for C++ than Tk does. I assume using
Perl/Qt would allow mixing C++ and Perl in a GUI application that has
a single look and feel. Anybody out there besides me looking at or
already using Perl/Qt? Why or why not?
I've already seen much of the KDE vs GNOME debate, and I'm confused
over the LGPL that comes with Perl/Qt. It's unclear to me whether
Perl/Qt can be used in a commercial environment. I tried emailing
Ashley Winters but the email bounced back. Can anyone else shed light
on this or know how to get in touch with Ashley?
Thanks in advance,
Dave
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dlripberXisoc.net (sub X with shunned char)
http://www.isoc.net/dlripber
/--\./==\./ee\./oo\./--\
------------------------------
Date: Mon, 26 Oct 1998 02:31:58 +0000
From: WMWilson <m.v.wilson@erols.com>
Subject: Re: Q: Opinions on Perl/Qt?
Message-Id: <3633DF1E.E7CD2358@erols.com>
Dave wrote:
>
> I've been programming in Perl/Tk for a couple years on both UNIX and
> Windows. We are finally moving to C++ in our group, and the Qt
> widgets look like a better fit for C++ than Tk does. I assume using
> Perl/Qt would allow mixing C++ and Perl in a GUI application that has
> a single look and feel. Anybody out there besides me looking at or
> already using Perl/Qt? Why or why not?
>
> I've already seen much of the KDE vs GNOME debate, and I'm confused
> over the LGPL that comes with Perl/Qt. It's unclear to me whether
> Perl/Qt can be used in a commercial environment. I tried emailing
> Ashley Winters but the email bounced back. Can anyone else shed light
> on this or know how to get in touch with Ashley?
>
> Thanks in advance,
> Dave
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> dlripberXisoc.net (sub X with shunned char)
> http://www.isoc.net/dlripber
>
> /--\./==\./ee\./oo\./--\
The debate about Qt is in the fact that it's license is not GPL/LGPL
and, belonging to a commercial company, could change at their whim.
Currently the license allows software created with it to be freely
distributed, but if the company were to decide that they no longer felt
so generous, a project meant to provide free software could suddenly be
just a waste of 6 months or so.
--
\||/
(..)
+---oOOo-----(_)-----oOOo-----+
| mailto:m.v.wilson@erols.com |
| WMWilson |
|__USCS Data Center Sysadmin__|
------------------------------
Date: 26 Oct 1998 02:56:19 GMT
From: wolph@merlin.albany.net (r j huntington)
Subject: Re: Regular Expression Problem ???
Message-Id: <710ocj$dcg$1@news.monmouth.com>
Trevor Hilaiel (trevorh@curtco.com) wrote:
:
: I would think that this:
:
: while (<DATA>) {
: print unless /^<VirtualHost $ip>/ .. m#^</VirtualHost>#;
: }
:
: wouldn't filter out the body of the <VirtualHost> directive.. Maybe I'm
: missing something?
The statement takes out text matching both regexps and everything between.
print unless /^<VirtualHost $ip>/ .. m#^</VirtualHost>#;
^^
Note the " .. ". The .. operator refers to everything between
the two regexps. I have tested this and it works exactly that way. -rh-
------------------------------
Date: Sun, 25 Oct 1998 23:25:08 -0500
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Regular Expression Problem ???
Message-Id: <1dhh9r2.rz61og1cyfmceN@bay1-115.quincy.ziplink.net>
Trevor Hilaiel <trevorh@curtco.com> wrote:
> I would think that this:
>
> while (<DATA>) {
> print unless /^<VirtualHost $ip>/ .. m#^</VirtualHost>#;
> }
>
> wouldn't filter out the body of the <VirtualHost> directive.. Maybe I'm
> missing something?
Yes, you're missing the meaning of .. in a scalar context.
Basically, it's a flip-flop operator. .. returns false as long as the
first operand evaluates to false. When the first operand is true, ..
switches and returns true as long as the second operand evalautes to
false. When the second operand is true, .. switches back to false and
repeats the process.
So, the above code will work exactly as intended.
The .. operator is explained further in the perlop documentation.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Sun, 25 Oct 1998 18:05:10 -0700
From: rdm@cfcl.com (Rich Morin)
Subject: Re: Sherlock module to search www.perl.com
Message-Id: <rdm-2510981805100001@140.174.42.30>
In article <clintdwF13F2B.Hyw@netcom.com>, clintdw@netcom.com (Clinton
Wong) wrote:
> A MacOS 8.5 Sherlock module for searching www.perl.com is available at:
> http://postmaster.net/~clintdw/cpan-sherlock.html
When I try this address, I get:
Not Found
The requested URL /~clintdw/cpan-sherlock.html was not found on this server.
OTOH, I had some success in getting to:
http://postmaster.net/~clintdw/perlref-sherlock.html
This seems to be the module in question...
On a related topic, Chris Nandor <pudge@pobox.com> posted this cute bit
of code to the MacPerl email list, back on 10/18:
Just a little snippet for y'all:
#!perl -wl
use Mac::Glue::Sherlock;
$s = new Mac::Glue::Sherlock;
@results = $s->search_Internet(
['Yahoo!', 'AltaVista'], {'for'=>'MacPerl', _reply=>1})->get;
foreach (sort @results) {
$c++, print if /ptf/i;
}
printf "%d of %d matches are from PTF.\n", $c, scalar @results;
$s->quit;
Returns:
http://www.ptf.com/MacPerl/ptf_book/cdrom.html
http://www.ptf.com/macperl/
http://www.ptf.com/macperl/depts/Stories/
http://www.ptf.com/macperl/depts/articles/IPCwMP.html
http://www.ptf.com/macperl/forms/feedback.html
http://www.ptf.com/macperl/ptf_book/
6 of 20 matches are from PTF.
--
Canta Forda Computer Laboratory | Prime Time Freeware - quality
UNIX consulting, training, & writing | freeware at affordable prices
+1 415-873-7841 | +1 408-433-9662 -0727 (Fax)
Rich Morin, rdm@cfcl.com | www.ptf.com, info@ptf.com
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 4071
**************************************