[22216] in Perl-Users-Digest
Perl-Users Digest, Issue: 4437 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 21 06:05:44 2003
Date: Tue, 21 Jan 2003 03:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 21 Jan 2003 Volume: 10 Number: 4437
Today's topics:
abs. pathname <stephan.bressler@siemens.com>
Re: abs. pathname <josef.moellers@fujitsu-siemens.com>
Re: abs. pathname <nobull@mail.com>
Re: APL's relation to perl <bik.mido@tiscalinet.it>
Re: APL's relation to perl <bik.mido@tiscalinet.it>
Re: avoid chaos -or- "protected" writing <ubl@schaffhausen.de>
Re: avoid chaos -or- "protected" writing <nobull@mail.com>
Re: Couple of Perl CGI problems <bigj@kamelfreund.de>
Re: Couple of Perl CGI problems <bart.lateur@pandora.be>
Re: How can a SMTP mail be deleted from a Unix mailbox <bart.lateur@pandora.be>
Re: Newbie - "Nobody" in sender heading? <camerado@camerado.com>
Re: Newbie - "Nobody" in sender heading? <jurgenex@hotmail.com>
newbie perl pattern processing question (Sol Linderstein)
Re: newbie perl pattern processing question <bernard.el-hagin@DODGE_THISlido-tech.net>
Re: OO perl : object containing ref to other object <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Re: OO perl : object containing ref to other object <ubl@schaffhausen.de>
Re: OO perl : object containing ref to other object <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Re: OO perl : object containing ref to other object <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
perl to post files to newsgroups??? <control153@NOSPAMyahoo.com>
Re: perl to post files to newsgroups??? <me@privacy.net>
Problem with WMI <a@a.com>
Re: Regex to find all words containing a single vowel? (Martin)
Re: Reverse Inheritance? <bart.lateur@pandora.be>
Re: Reverse Inheritance? <ubl@schaffhausen.de>
Re: Starting with Perl <brian.smart@blueyonder.co.uk>
Re: why does not this work (classical music)
Re: why does not this work <bart.lateur@pandora.be>
Writing gaming "macro" programs (Robert Parks)
Re: YAPC::Canada - May 15 and 16, 2003 in Ottawa - http (Walter Roberson)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 21 Jan 2003 08:52:29 +0100
From: "Stephan Bressler" <stephan.bressler@siemens.com>
Subject: abs. pathname
Message-Id: <b0iu5e$jg9$1@news.mch.sbs.de>
Hi,
my program is started somewhere in the directory tree (dir A). It takes a
pathname of a file, either relativ or absolute.
I'd like to convert the relativ pathname to an absolute pathname.
Example:
We're in dir /a/b/c and get ../x/foo.txt as filename. The function should
return /a/b/x.
Any ideas?
BTW: It should be OS-independent.
TIA
Stephan
------------------------------
Date: Tue, 21 Jan 2003 09:21:38 +0100
From: Josef =?iso-8859-1?Q?M=F6llers?= <josef.moellers@fujitsu-siemens.com>
Subject: Re: abs. pathname
Message-Id: <3E2D0312.2CDE3FED@fujitsu-siemens.com>
Stephan Bressler wrote:
> =
> Hi,
> =
> my program is started somewhere in the directory tree (dir A). It takes=
a
> pathname of a file, either relativ or absolute.
> =
> I'd like to convert the relativ pathname to an absolute pathname.
> =
> Example:
> We're in dir /a/b/c and get ../x/foo.txt as filename. The function shou=
ld
> return /a/b/x.
> =
> Any ideas?
> =
> BTW: It should be OS-independent.
I'm not sure if this can be done, since Perl has been ported to a lot of
OSes which may or may not have directories and different ways of
specifying them.
In a piece of code I once wrote, I used the following (pseudo-) code
based on the assumption that Perl internally only uses / as a directory
separator:
$fullpath =3D cwd() . '/' . $relpath;
while (1) {
next if $fullpath =3D~ s|/+[^/]+/+\.\./+|/|;
next if $fullpath =3D~ s|/+\./+|/|;
last;
}
You can then use dirname() to extract the directory part.
-- =
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: 21 Jan 2003 08:51:16 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: abs. pathname
Message-Id: <u9znpu7unv.fsf@wcl-l.bham.ac.uk>
"Stephan Bressler" <stephan.bressler@siemens.com> writes:
> my program is started somewhere in the directory tree (dir A). It takes a
> pathname of a file, either relativ or absolute.
>
> I'd like to convert the relativ pathname to an absolute pathname.
Please see numerous previous threads on this subject:
http://groups.google.com/groups?q=absolute+path+group%3Acomp.lang.perl*
Why is this not in the FAQ?
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 21 Jan 2003 09:16:08 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: APL's relation to perl
Message-Id: <lhqo2vs8j5hlt7v0lmgvdonu1mopji0vm7@4ax.com>
On 17 Jan 2003 11:07:57 -0800, genericax@hotmail.com (Sara) wrote:
>I WISH! APL is (was) one of the best linear variable programming
>languages in existence. Imagine a primitive function (domino) to
>invert an arbitry matrix (of ANY number of dimensions even!). How many
^^^^^^^^^^
<OT>
I don't know APL, I am only a beginner in Perl, and OTOH I'm not an
expert in (multi)linear algebra either, but AFAIK there's no (+ I
can't devise a) generally accepted/acceptable notion of multiplication
(and thus inversion) of "ANY number of dimension"-al matrices, while
such a notion is natural for "2-dimensional" (that is, ordinary)
matrices (that is rank 2 tensors). But maybe you meant something
completely different...
</OT>
Michele
--
>It's because the universe was programmed in C++.
No, no, it was programmed in Forth. See Genesis 1:12:
"And the earth brought Forth ..."
- Robert Israel on sci.math, thread "Why numbers?"
------------------------------
Date: Tue, 21 Jan 2003 09:16:08 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: APL's relation to perl
Message-Id: <eeso2v44e4f3o8ih3qik2b2vllk12am846@4ax.com>
On Fri, 17 Jan 2003 19:11:54 GMT, Uri Guttman <uri@stemsystems.com>
wrote:
>you should take a peek at the perl 6 world. many of the apl vector
>flavored ops are getting into perl. you will be able to convert most
>common ops to a vector form, e.g. a scalar can be added to all elements
Another OT intervention from me, but at least in this case it's a Perl
question...
To your knowledge, will Perl 6 support cartesian products and the
possibilty of iterating over them, e.g. with a syntax roughly of the
kind of:
for my ($x,$y) ((1..3)*(1..5)) {
# do something...
}
I would really love that! (OK, I can check the relevant docs as
suggested if I'm really interested in these matters...)
Michele
--
>It's because the universe was programmed in C++.
No, no, it was programmed in Forth. See Genesis 1:12:
"And the earth brought Forth ..."
- Robert Israel on sci.math, thread "Why numbers?"
------------------------------
Date: Tue, 21 Jan 2003 09:20:15 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: avoid chaos -or- "protected" writing
Message-Id: <b0j33u$aje$2@news.dtag.de>
Michael Budash wrote:
> my $sessionid = join '', localtime(), $ENV{REMOTE_ADDRESS};
5 Million Mega AOL customers on the same Proxy. Blow.
Don't reinvent the wheel. Take a look at the Apache::Session module or
related material on CPAN.
->malte
------------------------------
Date: 21 Jan 2003 09:03:33 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: avoid chaos -or- "protected" writing
Message-Id: <u9vg0i7u3e.fsf@wcl-l.bham.ac.uk>
Michael Budash <mbudash@sonic.net> writes:
> In article <u9d6mr8v5u.fsf@wcl-l.bham.ac.uk>,
> Brian McCauley <nobull@mail.com> wrote:
>
> > Lorenz Blum <little_tux@gmx.net> writes:
> >
> > > But how can I create a tag that the user can't see in the
> > > HTML-source but if "submit" then this value will be sent?
> > You can't.
> > This is the "perpetual motion machine" of computer programming.
> > This has nothing to do with Perl.
>
> true, but not very helpful.
How is telling someone that their goal is unattanable not helpful?
Would it be more "helpful" to show him how to build his perpetual
motion machine (which, of course, wouldn't actually work)?
How is telling someone that they have mis-partioned their problem not
helpful? Would it be more "helpful" to let him continue to labour
under the misconception that this was to do with Perl?
> and you didn't address the o.p.'s foremost question about
> session-handling.
Well, appart from the fact it was OT there's also the fact that the OP
gave the impression that he'd figured out how to do session-handling
but was unhappy with the solution he'd found ant wanted a way to do it
in a way that could not be seen by the user (which is of course impossible).
> why bother replying at all?
To help the OP.
A more interensting question: why did _you_ bother replying at all?
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 21 Jan 2003 09:25:11 +0100
From: "Janek Schleicher" <bigj@kamelfreund.de>
To: kedaran0504@yahoo.com.au (UmanS)
Subject: Re: Couple of Perl CGI problems
Message-Id: <pan.2003.01.21.08.24.25.886069@kamelfreund.de>
On Mon, 20 Jan 2003 19:11:59 +0000, UmanS wrote:
> I am submitting a field contains name and email address separated by
> "|" (Selected from a drop down list in a form)
> ex: Surname.Firstname|user@mydomain.com
> In the cgi script I assign this to a field and splitting this field
> into an array.
> $var1 =query->param('formfield1');
> @myarray = split ("|",$var1);
The first argument to split is always (interpreted as) a regexp. So the
variable $var1 is splitted at each subpart of the string that is an
alternation of an empty string or an empty string (as there isn't anything
left or right of the alternation symbol). Such an empty part can be found
between every two characters, so in fact it's a character splitting.
> @myname = $myarray[0];
> @myaddr = $myarray[1];
A short way to do what you want is instead:
my ($name, $addr) = split /\|/, $query->param('formfield1');
Best Wishes,
Janek
------------------------------
Date: Tue, 21 Jan 2003 10:34:43 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Couple of Perl CGI problems
Message-Id: <p68q2vg9uua2qlp97mo5rdqv1git8a7s6f@4ax.com>
UmanS wrote:
>First problem.
>I am submitting a field contains name and email address separated by
>"|" (Selected from a drop down list in a form)
>ex: Surname.Firstname|user@mydomain.com
>In the cgi script I assign this to a field and splitting this field
>into an array.
>$var1 =query->param('formfield1');
>@myarray = split ("|",$var1);
The first argument to split() is a regex. /|/ means: match nothing or
nothing. Thus, it is the same as "match nothing": //. Look up in the
docs what
split //, $var1
does.
You need to escape the bar to take it literally:
split /\|/, $var1
>@myname = $myarray[0];
>@myaddr = $myarray[1];
>
>When I print $var1 it prints ok, but how can I print @myname or
>@myaddr. If say
>print $myname[0] it will print only the first letter.
>Second Problem.
>I am sumitting a Text type field through a web form that may contains
>(' single quot character) and when my perl cgi script submit this to
>the oracle database oracle interprets it as a terminator. SO I am
>coverting the single quots to double quots. But the problem is I am
>using
>$string = ~/\'/\"/; but this changes only the first occurance only.
You want the /g modifier,
/'/"/g
but actually that's barking up the wrong tree. What you *really* want,
is use DBI's quote() method -- assuming you're using DBI:
$string = $dbh->quote($string)
or, better still, use placeholders to link the data to the database. A
Placeholder is pretty much an anonymous variable in your SQL,
represented by a question mark. Do not quote it. You provide the value
for the placeholders, in the same order, in the execute() call.
$sth = $dbh->prepare("SELECT * FROM mytable WHERE name=?");
$sth->execute("Foo");
--
Bart.
------------------------------
Date: Tue, 21 Jan 2003 07:56:02 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: How can a SMTP mail be deleted from a Unix mailbox by a script?
Message-Id: <evup2vghd9kvh4fjv3604vcq1nlpcoa57o@4ax.com>
Markus Elfring wrote:
>This request's subject is the deletion of messages in the file "mbox".
I think the safest approach would be to go through POP. For Perl, see
the modules Mail::POP3Client and Net::POP3. Search for methods with a
name like "delete" (not necessarily with that case).
--
Bart.
------------------------------
Date: Tue, 21 Jan 2003 05:35:37 GMT
From: CAMERADO <camerado@camerado.com>
Subject: Re: Newbie - "Nobody" in sender heading?
Message-Id: <3E2CDC3B.E0134824@camerado.com>
What are you talking about?
"Jürgen Exner" wrote:
> CAMERADO wrote:
> > Can anybody tell me where / how to fix this in the script?
>
> I just answered your question in "the other NG".
> If you do mulit-posts then please see for yourself how to collect all the
> replies.
>
> jue
------------------------------
Date: Tue, 21 Jan 2003 07:14:58 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Newbie - "Nobody" in sender heading?
Message-Id: <Sr6X9.16$OI6.8@nwrddc02.gnilink.net>
[Please don't post jeopardy style, re-arranged into chronological order]
[Please don't blindly full-quote]
CAMERADO wrote:
> "Jürgen Exner" wrote:
>> CAMERADO wrote:
>>> Can anybody tell me where / how to fix this in the script?
>>
>> I just answered your question in "the other NG".
>> If you do mulit-posts then please see for yourself how to collect
>> all the replies.
[Assuming your reply was meant to go here]
> What are you talking about?
I'm talking about that you did a multi-post in at least two different
newsgroups.
If at all you should have done a cross-post with a proper follow-up to one
single NG.
And now you are posting TOFU.
I have to say, you are using up your credits pretty fast.
It appears you didn't even lurk around for week or two. Otherwise you would
have known how not to behave.
May I suggest that at least you read the posting guidelines (which are
posted here very regularly) and probably the newuser NGs before commiting
yet another social blunder.
jue
------------------------------
Date: 20 Jan 2003 22:26:23 -0800
From: slinderstein@yahoo.com (Sol Linderstein)
Subject: newbie perl pattern processing question
Message-Id: <e435b329.0301202226.10900559@posting.google.com>
Hi,
I'm not new to programming but I am new to perl. Here's what I want to
do.
I have a text file with lines of HTML with special embedded tags in
it. I want to parse each line of the file and process the tags. A line
of the input file might look like this:
<A HREF="blahblahblah?id=<<var id>>">blah</A>
or like this:
<INPUT TYPE="HIDDEN" NAME="<<var foo>>" VALUE="<<var bar>>">
So, what I want to do is find the chunks of text surrounded by << >>
and then process the stuff inside of the double angle brackets,
replacing the << >> and the stuff inside of it with what my code will
compute then printing out the processed line. There might be multiple
of these patterns on each line.
In essence I want to write an HTML pre-processor. "Var" isn't the only
tag I'm planning to process, by the way.
I think the approach/answer has to do with the split function but I'm
not sure how to do this.
I'd appreciate a simple example that takes a string and outputs the
processed string. For simplicity, you can have the "var" tag replace
the value with a random number. That should illustrate for me how to
do what I want to do.
Thanks very much.
Sol
------------------------------
Date: Tue, 21 Jan 2003 07:28:55 +0100
From: Bernard El-Hagin <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: newbie perl pattern processing question
Message-Id: <n1qp2vo2fvql5stcc5rc5pec6o3rhdai8f@4ax.com>
On 20 Jan 2003 22:26:23 -0800, slinderstein@yahoo.com (Sol
Linderstein) wrote:
>Hi,
>
>I'm not new to programming but I am new to perl. Here's what I want to
>do.
>I have a text file with lines of HTML with special embedded tags in
>it. I want to parse each line of the file and process the tags. A line
>of the input file might look like this:
>
> <A HREF="blahblahblah?id=<<var id>>">blah</A>
>
>or like this:
>
> <INPUT TYPE="HIDDEN" NAME="<<var foo>>" VALUE="<<var bar>>">
>
>So, what I want to do is find the chunks of text surrounded by << >>
>and then process the stuff inside of the double angle brackets,
>replacing the << >> and the stuff inside of it with what my code will
>compute then printing out the processed line. There might be multiple
>of these patterns on each line.
What have you tried so far?
>In essence I want to write an HTML pre-processor. "Var" isn't the only
>tag I'm planning to process, by the way.
>
>I think the approach/answer has to do with the split function but I'm
>not sure how to do this.
>
>I'd appreciate a simple example that takes a string and outputs the
>processed string. For simplicity, you can have the "var" tag replace
>the value with a random number. That should illustrate for me how to
>do what I want to do.
How did *you* try to do this?
>Thanks very much.
No problemo.
Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'
------------------------------
Date: Tue, 21 Jan 2003 08:51:38 +0100
From: Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Subject: Re: OO perl : object containing ref to other object
Message-Id: <newscache$2i029h$dhd$1@news.emea.compuware.com>
Teh (tî'pô) wrote (Monday 20 January 2003 17:35):
> Koos Pol bravely attempted to attach 84 electrodes of knowledge
> to the nipples of comp.lang.perl.misc by saying:
>>Paul Masquelier wrote (Monday 20 January 2003 15:35):
>> sub new {
>> my $this = shift;
>> my $name = shift;
>> my $self = {};
>> bless $self, $this; # now he knows he's got methods
>> $self->name($name); # methods and variables prefer lower case
> ^^^^^^^^
> Says who? it's a matter of taste and has nothing to do with the OP
> problem.
To be honest, I can't point the exact location. But it is hidden somewhere
in the docs. Package names with initial caps, variables and the like lc,
hidden/system like stuff with a leading _. It is not only a matter of taste
but also a matter of being able to visually interpret the code without
actually reading the code. This leads to more transparent code and less
errors.
>>> my $name = ${$this}{NAME};
>> ^^^^^^^^^^^^^^
>>
>>You are mixing up things here. $this is an hash ref. The way to access the
>>NAME key is:
>>
>> my $name = $this->{name}; # again mapped to lc
>
> Either syntax works. I prefer -> too BTW.
I'm sure it does. But I am not here to advocate obfuscation in code. Au
contraire, mon ami. I really don't want to think about what a certain piece
of code is doing. If the code is unclear, it's wrong code. That simple.
>>I've only skimmed the rest of your code. But I would reckon that if you go
>>the same way with Book.pm as with Chapter.pm your script should run fine.
>>If not, just come back with your questions.
>
> It doesn't, he called GetChapter as a static method rather than a
> regular one.
Yep. You are right. I didn't check his code that far.(I assumed the OP would
get back after cleaning up the stuff.)
--
KP
------------------------------
Date: Tue, 21 Jan 2003 09:09:22 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: OO perl : object containing ref to other object
Message-Id: <b0j2fm$8vi$1@news.dtag.de>
Ben Morrow wrote:
> ~% perl -le'$r = {}; bless $r, "Pack"; $a = {k => $r}; print ${$a}{k}'
> Pack=HASH(0xd653c)
>
> ${$a}{k} appears to be correct: it's a logical generalization of %{$a}.
> $a->{k} is still clearer, of course.
I expected it to be a hash subscript on a scalar dereference, but now
that you mentioned it, this looks kinda cool actually. I have never seen
it before. I wonder were the OP found this kind of syntax?
->malte
------------------------------
Date: Tue, 21 Jan 2003 08:51:38 +0100
From: Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Subject: Re: OO perl : object containing ref to other object
Message-Id: <newscache$uy029h$ehd$1@news.emea.compuware.com>
Teh (tî'pô) wrote (Monday 20 January 2003 17:35):
> Koos Pol bravely attempted to attach 84 electrodes of knowledge
> to the nipples of comp.lang.perl.misc by saying:
>>Paul Masquelier wrote (Monday 20 January 2003 15:35):
>> sub new {
>> my $this = shift;
>> my $name = shift;
>> my $self = {};
>> bless $self, $this; # now he knows he's got methods
>> $self->name($name); # methods and variables prefer lower case
> ^^^^^^^^
> Says who? it's a matter of taste and has nothing to do with the OP
> problem.
To be honest, I can't point the exact location. But it is hidden somewhere
in the docs. Package names with initial caps, variables and the like lc,
hidden/system like stuff with a leading _. It is not only a matter of taste
but also a matter of being able to visually interpret the code without
actually reading the code. This leads to more transparent code and less
errors.
>>> my $name = ${$this}{NAME};
>> ^^^^^^^^^^^^^^
>>
>>You are mixing up things here. $this is an hash ref. The way to access the
>>NAME key is:
>>
>> my $name = $this->{name}; # again mapped to lc
>
> Either syntax works. I prefer -> too BTW.
I'm sure it does. But I am not here to advocate obfuscation in code. Au
contraire, mon ami. I really don't want to think about what a certain piece
of code is doing. If the code is unclear, it's wrong code. That simple.
>>I've only skimmed the rest of your code. But I would reckon that if you go
>>the same way with Book.pm as with Chapter.pm your script should run fine.
>>If not, just come back with your questions.
>
> It doesn't, he called GetChapter as a static method rather than a
> regular one.
Yep. You are right. I didn't check his code that far.(I assumed the OP would
get back after cleaning up the stuff.)
--
KP
------------------------------
Date: Tue, 21 Jan 2003 08:51:38 +0100
From: Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Subject: Re: OO perl : object containing ref to other object
Message-Id: <newscache$z3229h$phd$1@news.emea.compuware.com>
Teh (tî'pô) wrote (Monday 20 January 2003 17:35):
> Koos Pol bravely attempted to attach 84 electrodes of knowledge
> to the nipples of comp.lang.perl.misc by saying:
>>Paul Masquelier wrote (Monday 20 January 2003 15:35):
>> sub new {
>> my $this = shift;
>> my $name = shift;
>> my $self = {};
>> bless $self, $this; # now he knows he's got methods
>> $self->name($name); # methods and variables prefer lower case
> ^^^^^^^^
> Says who? it's a matter of taste and has nothing to do with the OP
> problem.
To be honest, I can't point the exact location. But it is hidden somewhere
in the docs. Package names with initial caps, variables and the like lc,
hidden/system like stuff with a leading _. It is not only a matter of taste
but also a matter of being able to visually interpret the code without
actually reading the code. This leads to more transparent code and less
errors.
>>> my $name = ${$this}{NAME};
>> ^^^^^^^^^^^^^^
>>
>>You are mixing up things here. $this is an hash ref. The way to access the
>>NAME key is:
>>
>> my $name = $this->{name}; # again mapped to lc
>
> Either syntax works. I prefer -> too BTW.
I'm sure it does. But I am not here to advocate obfuscation in code. Au
contraire, mon ami. I really don't want to think about what a certain piece
of code is doing. If the code is unclear, it's wrong code. That simple.
>>I've only skimmed the rest of your code. But I would reckon that if you go
>>the same way with Book.pm as with Chapter.pm your script should run fine.
>>If not, just come back with your questions.
>
> It doesn't, he called GetChapter as a static method rather than a
> regular one.
Yep. You are right. I didn't check his code that far.(I assumed the OP would
get back after cleaning up the stuff.)
--
KP
------------------------------
Date: Tue, 21 Jan 2003 05:08:52 GMT
From: ocd <control153@NOSPAMyahoo.com>
Subject: perl to post files to newsgroups???
Message-Id: <Xns930A1F98E727control153NOSPAMyaho@167.206.3.3>
was wondering if perl can upload files (images/mp3) to newsgroups ..(the
binaries) ... i've never seen this done ....
i know how to do it manually (yEnc) but was wondering if perl can automate
it ... any ideas or thoughts would be great help...
thanks
------------------------------
Date: Tue, 21 Jan 2003 16:26:04 +1100
From: "Tintin" <me@privacy.net>
Subject: Re: perl to post files to newsgroups???
Message-Id: <b0illd$pt8co$1@ID-172104.news.dfncis.de>
"ocd" <control153@NOSPAMyahoo.com> wrote in message
news:Xns930A1F98E727control153NOSPAMyaho@167.206.3.3...
> was wondering if perl can upload files (images/mp3) to newsgroups ..(the
> binaries) ... i've never seen this done ....
> i know how to do it manually (yEnc) but was wondering if perl can automate
> it ... any ideas or thoughts would be great help...
> thanks
See http://search.cpan.org/author/GBARR/libnet-1.12/Net/NNTP.pm
------------------------------
Date: Tue, 21 Jan 2003 09:30:34 GMT
From: "John" <a@a.com>
Subject: Problem with WMI
Message-Id: <_q8X9.163521$la7.1235401@telenews.teleline.es>
How can I use WMI with NT 4.0 or W95?Must I install anything?I have an
script that use WMI.
With W2K i don´t have any problems.
Thanks
------------------------------
Date: 21 Jan 2003 02:56:21 -0800
From: mrennix@totalise.co.uk (Martin)
Subject: Re: Regex to find all words containing a single vowel?
Message-Id: <cb57fb72.0301210256.25241678@posting.google.com>
"Janek Schleicher" <bigj@kamelfreund.de> wrote in message news:<pan.2003.01.20.22.09.55.52492@kamelfreund.de>...
> On Sun, 19 Jan 2003 18:35:13 +0000, Martin wrote:
>
> > I need to find all words in a file containing only a single vowel.
> >
> > For example:
> >
> > $regex = ????????
> > $string = "The quick brown fox jumped over the lazy dog";
> > $string =~ /$regex/g;
> >
> > should match:
> >
> > The
> > brown
> > fox
> > the
> > lazy
> > dog
> >
> > This sounds simple but I can't work out the regex! Any ideas?
>
> As TMTWTDI, here's another solution:
>
> print join "\n",
> ($string =~ /(\b [^aeiou\s]* [aeiou] [^aeiou\s]* \b)/gix);
>
>
> Greetings,
> Janek
This works great, and I actually understand it! But, why does it need
to be given the x modifier (for extended regexes)? Which features are
available only when the x modifier is used?
I guess I need to buy a book!
Thanks for the help guys (BTW it was for fun, I am reading the Llama
and thought I'd test myself). I am way past the age for homework!
--
Martin Rennix
------------------------------
Date: Tue, 21 Jan 2003 08:06:47 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Reverse Inheritance?
Message-Id: <ocvp2vofhfb7m4fjbhructs177ieol088u@4ax.com>
Mark Gannon wrote:
>I'm trying to write a set of modules to manage a network device via its web
>interface. There are several different interfaces to be supported
>(depending on what generation of software). My hope is to manage these
>differences in the module code so that code that uses the modules doesn't
>have to be aware of the different interfaces.
It seems to me like you want to use a mechanism of a main module, the
interface, and various "driuvers", one for each generation of software.
It's pretty much like DBI uses various DBD::* drivers to access its
database.
>new() {
> if ($thingie->isafoobar) {
> return Foo::Bar->new();
> }
> else {
> return Foo::Onyou->new();
> }
>}
Hmm... did you know you can use a string for the class? So
my $driver = 'Foo::Bar'; # or 'Foo::Onyou';
sub new {
return $driver->new();
}
will work just fine.
But perhaps that is going too far, provided you only need one "driver"
at a time. You can then use plain inheritance, and set @ISA at runtime.
@Foo::ISA = 'Foo::Bar';
and
Foo->new
will now call Foo::Bar->new (but with 'Foo' as a class name), provided
Foo doesn't have a new() method of its own. Same for any other methods.
See AnyDBM_File for a real world example.
--
Bart.
------------------------------
Date: Tue, 21 Jan 2003 09:14:48 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: Reverse Inheritance?
Message-Id: <b0j2po$aje$1@news.dtag.de>
Mark Gannon wrote:
> I'm trying to write a set of modules to manage a network device via its web
> interface. There are several different interfaces to be supported
> (depending on what generation of software). My hope is to manage these
> differences in the module code so that code that uses the modules doesn't
> have to be aware of the different interfaces. What I'd like to do is
> something like:
Maybe the Decorator Design Pattern will help you.
->malte
------------------------------
Date: Tue, 21 Jan 2003 10:56:32 -0000
From: "Brian Smart" <brian.smart@blueyonder.co.uk>
Subject: Re: Starting with Perl
Message-Id: <yz9X9.5528$pW3.4114@news-binary.blueyonder.co.uk>
Hello All,
Thanks for comments, I am now over the first hurdle. I have installed Perl
on my computer and can run my script from the command line and get the
desired result.
Any comments on how to move forward with learning the language would be
appreciated.
Regards
Brian Smart
"Jürgen Exner" <jurgenex@hotmail.com> wrote in message
news:IWWW9.483$PR2.402@nwrddc02.gnilink.net...
> Brian Smart wrote:
> > I am just starting with Perl. Can anybody help me to get started. I
> > am using a Windows2000 m/c and want to run a script from a web page.
>
> Stop right here. Perl and web pages have nothing to do with each other.
> The first is a universal programming language, the other is a document
> written in [D]HTML.
>
> Of course you can use any programming language (including Perl) to
generate
> a file which contains HTML. Or you can use any programming language to
> return the proper response to a CGI web server. But that is one or two
> additional layers of complexity.
>
> You said that you are new to Perl.
> Well, can we assume that you are familiar with
> - HTML? and maybe DHTML?
> - CGI programming?
> Because those areas are separate from and have nothing to do with Perl.
>
> Ok, now: "Running a script from a web page". Taking this literally I would
> assume that you were trying to run a script on the client when the browser
> renders some HTML page.
> While there is a PerlScript it is limited to IE only. And the user will
have
> to install PerlScript first.
> Therefore I suggest to look for other solutions, most notably JavaScript.
>
> > As is usual with a beginer, although I have followed the
> > instructions, regarding where to put the script, and to make it
> > executable, it doesn't work. The script should print "Hello world"
> > (Very original) but all I get is a page from the server saying : You
> > do not have permission to access the requested file on this server.
> >
> > I can obviously supply any information that my ignorance has stopped
> > me providing with this request.
>
> Assuming you are talking about a CGI script (you negleted to tell us):
Does
> your script produce the desired output (that is the desired HTML content
> plus the proper header) when run from the command line?
> If yes, then you don't have a Perl problem. For further information please
> see PerlFAQ9:
> My CGI script runs from the command line but not the browser.
>
> If it doesn't produce the desired output then please show us the script
> (reduced to a minimal example that still reproduces the problem), explain
> the desired output, and chances are someone here will be able to fix it.
>
> jue
>
>
------------------------------
Date: 20 Jan 2003 21:55:09 -0800
From: ndescripto@yahoo.com (classical music)
Subject: Re: why does not this work
Message-Id: <b431b108.0301202155.655c8fdd@posting.google.com>
damian@qimr.edu.au (Damian James) wrote in message news:<slrnb2ouaq.7fp.damian@puma.qimr.edu.au>...
>
> %$b->{a} is the same as %{$b}->{a}, which is not a syntax error,
> but is not what the OP wants. Note that using warnings would have
> alerted the OP to this:
>
> Reference found where even-sized list expected...
>
> The OP should note that $a and $b should be avoided since they are
> used by sort(). See the entry for sort() in the perlfunc man page.
>
> --damian
Thanks. I did not think about precedence carefully.
As for $a and $b many of my programs use them very liberally and yes I
am also aware that they are special variables in sort. But I happen
use
sort always in a loop such as
for ( sort {$b cmp $a} @a)
{
-- do stuff
}
so my guess is that $a and $b are scoped inside those braces. And I
always
make sure I don't have $a and $b inside that scope.
In any case I don't think I have encountered any problems so far.
Show me a nasty example even if I follow the rules above.
If I remember correctly llama book uses $a quite liberally and I don't
recall
reading in it any warnings about using $a at all. I am refering to
2ed and
I don't know about newer edition.
------------------------------
Date: Tue, 21 Jan 2003 06:53:12 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: why does not this work
Message-Id: <bdrp2vsqlogt64eq1fu3h6o84sbb1gmav7@4ax.com>
classical music wrote:
>As for $a and $b many of my programs use them very liberally and yes I
>am also aware that they are special variables in sort. But I happen
>use
>sort always in a loop such as
>
>for ( sort {$b cmp $a} @a)
> {
> -- do stuff
> }
>
>so my guess is that $a and $b are scoped inside those braces.
Actually, $a and $b are scoped (with an implied "local") to the sort
block, loop or not. They're still globals, though.
> And I always
>make sure I don't have $a and $b inside that scope.
You mean the loop block? That doesn't even matter.
>In any case I don't think I have encountered any problems so far.
You only have to make sure you don't declare $a or $b with "my", and
you'll be fine. Because that way, you'd disturb their behaviour in the
sort block.
--
Bart.
------------------------------
Date: 20 Jan 2003 21:38:08 -0800
From: rparks@kenan.com (Robert Parks)
Subject: Writing gaming "macro" programs
Message-Id: <15b76f2b.0301202138.435959af@posting.google.com>
Hi would like write a macro program to play a windows game. I will
need to be able to do the following:
- enter key strokes
- move mouse
- click
- check pixels
Anyone know of a perl module that would facilitate these activities?
Thanks
Rob
------------------------------
Date: 21 Jan 2003 05:29:08 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: YAPC::Canada - May 15 and 16, 2003 in Ottawa - http://www.yapc.ca/
Message-Id: <b0ilr4$dpg$1@canopus.cc.umanitoba.ca>
In article <3E2C9FBF.BB0A1732@acm.org>, John W. Krahn <krahnj@acm.org> wrote:
:Peter Scott wrote:
:> If you encounter any problems with the site or would like to contact
:> us directly then please write to help@yapc.ca .
:Yes, it's too far east! Could you move it to U.B.C.? :-)
Or somewhere nice and central, like Winnipeg ;-)
--
The Knights Of The Lambda Calculus aren't dead --this is their normal form!
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 4437
***************************************