[11431] in Perl-Users-Digest
Perl-Users Digest, Issue: 5031 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 2 08:07:35 1999
Date: Tue, 2 Mar 99 05:00:56 -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 Tue, 2 Mar 1999 Volume: 8 Number: 5031
Today's topics:
Re: *** FAQ: ANSWERS TO YOUR QUESTIONS! READ FIRST! Pos (Jonathan Stowe)
Re: *** FAQ: ANSWERS TO YOUR QUESTIONS! READ FIRST! Pos <andrewf@beausys.demon.co.uk>
ADO, OLE on WinNT <bon@boomhq.com>
code that will create a table of links to html files <seugenio@man.amis.com>
Re: code that will create a table of links to html file <Philip.Newton@datenrevision.de>
Re: compiling perl progs to be unreadable scamarena@interclan.net
Cookies in IE3... <pejama@jane.math.jyu.fi>
Re: Cookies in IE3... (Jonathan Stowe)
Re: Execute the Command Line <Philip.Newton@datenrevision.de>
Re: Finding the word after a word <udaa460@axolotl.kcl.ac.uk>
Re: Finding the word after a word <udaa460@axolotl.kcl.ac.uk>
Re: Free online course for Perl 5 & CGI Programming <harish@csaserv.med.siemens.de>
Re: Getting File Version info on Win32 <xrxoxtxhxdx@xrxoxtxhx.xnxextx>
High Quality Web Designer/Webmaster Needed webmaster@designbrokers.com
how can i improve this code ? <f_berg@yahoo.com>
Re: HTML parse problem <jimbo@soundimages.co.uk>
Re: localtime -> time <Philip.Newton@datenrevision.de>
method overriden! <ekkis@arix.com>
Re: nmake, adding modules in Win 98 Carl_Cunningham@oh.god.dont.spam.me
Re: Non-greedy matching <jimbo@soundimages.co.uk>
Re: Odd Experience (Jonathan Stowe)
Re: Please, An example of win32::NetResourse. <xrxoxtxhxdx@xrxoxtxhx.xnxextx>
sending associate array as argument (Thana Letchumi)
Using the print << command alastair@solarnet.co.uk
Re: Using the print << command <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: Why can't my .pl find my SCRIPT ?? <Philip.Newton@datenrevision.de>
Re: Why isn't this a race condition ? <Philip.Newton@datenrevision.de>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 02 Mar 1999 10:15:34 GMT
From: gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: *** FAQ: ANSWERS TO YOUR QUESTIONS! READ FIRST! Posted Twice Weekly ***
Message-Id: <36dbb9b5.4765937@news.dircon.co.uk>
On Mon, 1 Mar 1999 23:58:31 +0000, Andrew Fry
<andrewf@beausys.demon.co.uk> wrote:
> And, as Uri's replies have shown, being sarcastic,
>condescending, patronizing and abusive occasionally go along with the
>reply.
Alternatively : 'witty, humorous or just plain weird' - see:
<http://x7.dejanews.com/[ST_rn=ps]/dnquery.xp?search=next&DBS=1&LNG=ALL&IS=&svcclass=dnserver&ST=PS&offsets=&svcclass=dnserver&CONTEXT=920367858.58458407>
/J\
------------------------------
Date: Tue, 2 Mar 1999 11:45:00 +0000
From: Andrew Fry <andrewf@beausys.demon.co.uk>
Subject: Re: *** FAQ: ANSWERS TO YOUR QUESTIONS! READ FIRST! Posted Twice Weekly ***
Message-Id: <g75mKCA88822EwWw@beausys.demon.co.uk>
In article <1do0m9y.bnbos6hnsh34N@bay1-524.quincy.ziplink.net>, Ronald J
Kimball <rjk@linguist.dartmouth.edu> writes
>Andrew Fry <andrewf@beausys.demon.co.uk> wrote:
>
>> All I am saying is that, as a newbie, I find it unhelpful,
>> irritating and patronizing to be told time-after-time-after-time ....
>> read the FAQ! read the man pages! read the on-line articles! read
>> the books!
>
>How many times have you been told to read the FAQ, the man pages, the
>online articles, and the books?
Several. But of course, I am not talking just about me ... and I am sure
that you realize this.
>
>This newsgroup is primarly for *everyone* to discuss "interesting"
>issues. Basic netiquette defines "interesting" as "issues which are not
>clearly answered in the FAQ or man pages".
>
>
>> Finally, Uri ... calm down and stop the stupid remarks, illogical
>> extrapolations and abuse.
>
>Finally, Andrew ... calm down and stop the stupid remarks, illogical
>extrapolations and abuse.
I am quite calm, thanks, and have not made any stupid remarks. My point
is simply that I find it irritating and patronizing to be constatntly
told what I should be reading. I know what I should be reading, I know
how much time I have to read, and Ill get around to it at my own pace.
Also, I appreciate the efforts of those who do take time to respond to
questions (...other than RTFM).
Lets have no more misinterpretation of what I was trying to say, please,
and no more over-reaction.
---
Andrew Fry
"Time flies like an arrow. Fruit flies like a banana". (Groucho Marx).
------------------------------
Date: Tue, 02 Mar 1999 18:03:43 +0800
From: Bon So <bon@boomhq.com>
Subject: ADO, OLE on WinNT
Message-Id: <36DBB77E.2D9F1754@boomhq.com>
I have just installed perl5.00402-bindist04-bc.zip & libwin32-0_14.zip.
Then I tried the piece of Perl (quoted at below) which (ideally!!) use
ADO / OLE to connect to db (a SQL 6.5)
however, what it returns
---------- start of capture ---------------
Win32::OLE(0.10): GetOleObject() Not a Win32::OLE object at
C:\perl\lib\site/OLE.pm line 113.
Win32::OLE(0.10): GetOleObject() Not a Win32::OLE object at
C:\perl\lib\site/OLE.pm line 113.
Can't call method "Fields" without a package or object reference at
ado.pl line 13.
Win32::OLE(0.10): GetOleObject() Not a Win32::OLE object during global
destruction.
---------- end of capture ---------------
What can I do to make the connection work, or what I need to check out?
Also, can someone recommand some reference on the internet on the Perl -
ADO / OLE?
Thanks a lot.
---------- start of perl code ---------------
use OLE;
$Conn = CreateObject OLE "ADODB.Connection";
$Conn->Open("dsn_test");
$RS = $Conn->Execute("SELECT * FROM dumptable");
$Count = $RS->Fields->count;
for($i = 0; $i < $Count; ++$i) {
print $RS->Fields($i)->name , "\n";
}
while(! $RS->EOF) {
for ( $i = 0; $i < $Count; $i++ ) {
print $RS->Fields($i)->value, " ";
}
print "\n";
$RS->MoveNext;
}
$RS->Close;
$Conn->Close;
---------- end of perl code ---------------
Regards,
Bon
------------------------------
Date: 2 Mar 1999 09:47:39 GMT
From: "Sheila Eugenio" <seugenio@man.amis.com>
Subject: code that will create a table of links to html files
Message-Id: <01be6491$a1099d70$2bbe10ac@amipnet>
Hello everyone! This is a part of the code which intends to display links
to the files in a directory handle DIR. $part is a 5-digit filename. It did
what I want it to do except for one thing: The filenames are not sorted!
How can I display it from left to right in a sorted manner? Thanks very
much!
while (defined($part=readdir(DIR))){
if (($part)=~/(\d+)/) {
$counter++;
$name = substr($part,0,5);
print INDEX "<td><a HREF=\"$part\" >$name</a><br>\n";
if ($counter %10 == 0) {
print INDEX "</tr>\n<tr>\n";
}
}
}
------------------------------
Date: Tue, 02 Mar 1999 13:01:11 +0100
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: code that will create a table of links to html files
Message-Id: <36DBD307.A8AA3DD6@datenrevision.de>
Sheila Eugenio wrote:
>
> Hello everyone! This is a part of the code which intends to display links
> to the files in a directory handle DIR. $part is a 5-digit filename. It did
> what I want it to do except for one thing: The filenames are not sorted!
> How can I display it from left to right in a sorted manner? Thanks very
> much!
>
> while (defined($part=readdir(DIR))){
> if (($part)=~/(\d+)/) {
> $counter++;
> $name = substr($part,0,5);
> print INDEX "<td><a HREF=\"$part\" >$name</a><br>\n";
> if ($counter %10 == 0) {
> print INDEX "</tr>\n<tr>\n";
> }
> }
> }
@filenames = sort readdir(DIR); # calls readdir in a list context, thus
# reading in all the files in the
# directory; then sort sorts them
then replace the while loop with foreach $part (@filenames)
Cheers,
Philip
------------------------------
Date: Tue, 02 Mar 1999 12:41:37 GMT
From: scamarena@interclan.net
Subject: Re: compiling perl progs to be unreadable
Message-Id: <7bgma0$kt0$1@nnrp1.dejanews.com>
In article <x7vhgohkx4.fsf@home.sysarch.com>,
Uri Guttman <uri@home.sysarch.com> wrote:
> >>>>> "JS" == Jonathan Stowe <gellyfish@btinternet.com> writes:
>
> JS> On Tue, 23 Feb 1999 16:04:32 +0100 Arnold M|ller wrote:
> >> I once found a tool called 'perl2exe' oder 'perltoexe' or sth.
> JS> ...
> >> Perhaps there are some UNIX-clones, too.
> >> Hope you can find it.
>
> JS> And if there is what happens when you run the pogram 'strings'
> JS> against it ?
>
> interesting thought. what if you did that on a perl2exe on winblows? it
> should also extract out the code. hell, you could just edit the binary
> on emacs and do that.
I totally hate stupid comments on what they haven't even tried, nor have seen
nor now absolutely nothing about what they are talking about.
perl2exe on Windows leaves it totally unreadable to the common user. You
_CANNOT_ extract the code right out of the binary, not even if you edit it on
the most powerfull text editor ever written.
Post a real solution or shut up.
> about the only good way to do this is to write such bad code that no one
> in their right mind would use it, let alone steal it. if they do, the
> maintenance issues will be their punishment!
Talk about stupidities...
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 2 Mar 1999 10:59:41 GMT
From: Pertti Maki-Valkkila <pejama@jane.math.jyu.fi>
Subject: Cookies in IE3...
Message-Id: <7bggat$hel$1@mordred.cc.jyu.fi>
Hi!
I'm working on a project that uses cookies to identify different users. I've
come across with a problem when setting cookies in IE3. It seems that the
structure of a cookie is different in version 3 than it is in IE4 (or NN3/4).
Does anyone know how it is different or am I doing something wrong. I set the
cookies like this:
print "Set-Cookie:FC_ID=$val; domain=.ksp.fi; Version=1; path=/;
expires=Sat, 31-Dec-05 23:59:59 GMT\n";
print "Set-Cookie:FC_VAL=$summa; domain=.ksp.fi; Version=1; path=/;
expires=Sat, 31-Dec-05 23:59:59 GMT\n";
print "Set-Cookie:FC_CON=$jatko; domain=.ksp.fi; Version=1; path=/;
expires=Sat, 31-Dec-05 23:59:59 GMT\n";
print "Set-Cookie:FC_TEC=$tekninen; domain=.ksp.fi; Version=1; path=/;
expires=Sat, 31-Dec-05 23:59:59 GMT\n";
I've tried to do this before and after the statement
print "Content-type: text/html";
but there seems to be no diffence.
Any ideas???
Pertti Maki-Valkkila
------------------------------
Date: Tue, 02 Mar 1999 12:33:06 GMT
From: gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Cookies in IE3...
Message-Id: <36dbd935.12830989@news.dircon.co.uk>
On 2 Mar 1999 10:59:41 GMT, Pertti Maki-Valkkila
<pejama@jane.math.jyu.fi> wrote:
>Hi!
>
>I'm working on a project that uses cookies to identify different users. I've
>come across with a problem when setting cookies in IE3. It seems that the
>structure of a cookie is different in version 3 than it is in IE4 (or NN3/4).
>
>Does anyone know how it is different or am I doing something wrong. I set the
>cookies like this:
>
I'm going to have to ask for my money back - I have been through all
of the Perl manpages,. the faq and Programming Perl and cant find
anything about 'Cookies' - I guess I'll have to upgrade to this IE4
version of Perl (or is that NN3/4 ? - what are the differences) . I'd
be grateful if you could tell me where I can download Perl IE4.
/J\
------------------------------
Date: Tue, 02 Mar 1999 12:56:46 +0100
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: Execute the Command Line
Message-Id: <36DBD1FE.D50EB308@datenrevision.de>
MAW wrote:
>
> Hi There,
>
> Like many other people, it would appear I am also new to Perl - Only three
> days! However, I am trying to write a script on WIN32 initially - later
> Linux which will execute a command line and then show me the results.
>
> Basically, I am trying to execute a "netstat -a" every 20 seconds for a
> totla period of 2 minutes. I believe I am correct in saying that to do this
> I need to get hold of the Win32::Shell module.
I don't think so. perldoc -f system will show you that the system call
is probably what you need. (I assume you just wish to display the
output of netstat -a on STDOUT -- if you need to process it in any way,
you can capture the output of a command by $output = `netstat -a`;
(with backticks). This should work both for Win32 and Linux.
So, this should work:
--- vvv snip vvv ---
#!/usr/bin/perl -w
use strict;
for (1 .. 6) { # 6 * 20 seconds = 120 seconds = 2 minutes
system "netstat -a"; # (or $output = `netstat -a`, and then do
# something with $output)
sleep 20; # sleep for 20 seconds; see perldoc -f sleep
}
--- ^^^ snip ^^^ ---
Cheers,
Philip
------------------------------
Date: 2 Mar 1999 11:51:27 GMT
From: Allan Hawdon <udaa460@axolotl.kcl.ac.uk>
Subject: Re: Finding the word after a word
Message-Id: <7bgjbv$lsk$1@willow.cc.kcl.ac.uk>
kalikste@uiuc.edu wrote:
: Quick question for a regular expression-
: What is the most elegant way to extract the word after a specific word in a
: string (words seperated by one space)? For example, if the string is "The
: quick brown fox jumps over the lazy dog", given "brown", I want to return
: "fox". In my situation, each word will only appear once in the string. I
: appreciate all your input.
Quick 'n' dirty
$string = "the quick brown dog jumped over the lazy dog";
$srch = "brown";
($res) = $string =~ /.* $srch (\S+) /;
print "$res\n";
------------------------------
Date: 2 Mar 1999 12:16:28 GMT
From: Allan Hawdon <udaa460@axolotl.kcl.ac.uk>
Subject: Re: Finding the word after a word
Message-Id: <7bgkqs$mh1$1@willow.cc.kcl.ac.uk>
Allan Hawdon <udaa460@axolotl.kcl.ac.uk> wrote:
: kalikste@uiuc.edu wrote:
: : Quick question for a regular expression-
: : What is the most elegant way to extract the word after a specific word in a
: : string (words seperated by one space)? For example, if the string is "The
: : quick brown fox jumps over the lazy dog", given "brown", I want to return
: : "fox". In my situation, each word will only appear once in the string. I
: : appreciate all your input.
: Quick 'n' dirty
: $string = "the quick brown dog jumped over the lazy dog";
: $srch = "brown";
: ($res) = $string =~ /.* $srch (\S+) /;
: print "$res\n";
Whoops. Unless it's at the beginning of the string of course.
($dummy,$res) = $string =~ /(^|.* )$srch (\S+) /;
I'm sure someone else can come up with something more elegant.
------------------------------
Date: Mon, 01 Mar 1999 16:19:45 +0100
From: Harish <harish@csaserv.med.siemens.de>
Subject: Re: Free online course for Perl 5 & CGI Programming
Message-Id: <36DAB010.791D80A9@csaserv.med.siemens.de>
Hi,
I am new to Perl. I found this site very useful. Great Work!
Thanks!
Harish
------------------------------
Date: Tue, 2 Mar 1999 00:03:44 -0800
From: "Dave Roth" <xrxoxtxhxdx@xrxoxtxhx.xnxextx>
Subject: Re: Getting File Version info on Win32
Message-Id: <7XMC2.994$YV6.98@news2.giganews.com>
Jalil Feghhi wrote in message <920324640.32972@zeppelin.svr.home.net>...
>Is there anyway to get file version info (available for exe and dll files)
>on Win32 systems?
Win32::AdminMisc can do it. Check out the FAQ:
http:/www.roth.net/perl/adminmisc/
dave
--
=================================================================
Dave Roth ...glittering prizes and
Roth Consulting endless compromises, shatter
http://www.roth.net the illusion of integrity
Win32, Perl, C++, ODBC, Training
rothd at roth dot net
Our latest Perl book is now available:
"Win32 Perl Programming: The Standard Extensions"
http://www.roth.net/books/extensions/
------------------------------
Date: Tue, 02 Mar 1999 08:29:40 GMT
From: webmaster@designbrokers.com
Subject: High Quality Web Designer/Webmaster Needed
Message-Id: <7bg7hb$9e4$1@nnrp1.dejanews.com>
We are a bona fide company based in Ireland. Our business is based on
building relationships with clients who need web site (or anything internet
related) advice and then supply them with this service through our list of
webmasters.
As an example, a job comes in to design the race horse site for antartica,
we agree the content, get all the literature together and then package a
brief together that the client agrees too. We then agree a price (based on
our extensive knowledge of what sites cost to build) and then come to you
(once you have been approved). You give us a price, we agree it, you
produce the work - the client thanks us and everybody wins.
On the subject of money, until you have worked with us on a number of
projects, we understand that you may be cautious about being paid after
completion. So we agree to pay 33% in advance, 33% upon completion and
uploading to working state, 33% within 28 days of the work being uploaded.
Where's the 1% - well, every client that we sign up will be obliged to pay
us a monthly maintenance contract (ensuring all the links work and nothing
has been damged intentionally or mistakenly) you will get a fixed fee per
month for the duration of this maintenance contract 28 days in arrears on
the basis that we never receive a report of a site failing - we think you'll
probably prefer the maintenance fee rather than worry about the 1%
Make no mistake - we are here to make money and we need you to do it. Our
gain is your gain. What we need is to build on our team. This is a
constant effort so don't be surprised if you have seen this before or see it
again.
If you are interested in this work, then you should know there is one minor
hitch. Once we have received a contract, we will ask two or three people to
submit one design to us (usually the index page) prior to us agreeing a
contract. Only one person can win the work, but if we are to maintain the
highest standards, competition is the best way for us to do it.
Once your design has been approved, we will arrange transfer of your deposit
and off you go.
If you are interested and feel this might be of interest to you, then send
me an e-mail with links to three sites you have worked on. Beside each
link, indicate how much each site cost. Once we have approved your work, we
will send you a package for one of our projects for you to submit your
design.
Looking forward to hearing from you and in anticipation of a mutually
beneficial business realtionship
Sincerely
PATRICK
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Mon, 01 Mar 1999 04:39:21 +0100
From: Frank Berg <f_berg@yahoo.com>
Subject: how can i improve this code ?
Message-Id: <36DA0BE9.21009F51@yahoo.com>
hi all,
first i'm new to perl and apologizes by advance if this code hurts you
:-), it solves my problem but i think it's (at least) really ugly and
heavy and i want some advices or 'another way to do it'.
i'm using this for printing a document made of different part of datas
that i fetch from a database, the problem is that i can't change the
organisation of the datas in the db , so i get $aref_data like this and
have to work with it...
Thanks
Frank
----------------------------------------
#/usr/local/bin/perl -w
use strict;
my $base = 1;
##data i ve to print in a certain order.
my $aref_data = [ [12, 1, 1, '(12) Im with 1...'], [3, 1, 1, '(3) Im
with 1'], [7, 1, 1, '(7) Im with 1'], [14, 12, 2, '(14) Im with 12'],
[5, 3 , 2, '(5) Im with 3'], [16, 14 , 3, '(16) Im with 14'], [25, 16 ,
4, '(25) Im with 16'], [22, 14, 3, '(22) Im with 14'], [28, 22, 4, '(28)
Im with 22']];
##i'm using an index because there's can be
##a lot of array contening a lot of text
## i think this is faster than manipulate
##directly @$aref_data but i don t really know in fact...
my @sorted_index;
foreach my $i (0..$#{$aref_data}) {
if ($aref_data->[$i][1] == $base) {
push @sorted_index, $i;
&get_withme($aref_data->[$i][0],$aref_data,\@sorted_index);
}
}
print "--------------------------1-----------------------\n\n";
print map ("\t"x$aref_data->[$_][2] . "$aref_data->[$_][3]\n"
,@sorted_index);
exit;
##This is really bad because i'm reparsing
## my array again and again...but i didnt find anything else...yet :-{
sub get_withme {
my ($id ,$aref_data,$a_sorted_index) = @_;
foreach my $j(0..$#{$aref_data}) {
if ($aref_data->[$j][1] == $id){
push @$a_sorted_index, $j;
&get_withme($aref_data->[$j][0],$aref_data,$a_sorted_index);
}
}
}
------------------------------
Date: 02 Mar 1999 12:56:37 +0000
From: Jim Brewer <jimbo@soundimages.co.uk>
Subject: Re: HTML parse problem
Message-Id: <uvhgk6oe2.fsf@jimbosntserver.soundimages.co.uk>
Jim Correia <correia@barebones.com> writes:
> Yes indeed. I'd like to see the standards in question that require the
> quotes (XML doesn't count, since we aren't talking about XML).
The ISO SGML Standards, for a start. The quotes may be omitted when
the attribute value contains only text characters (also as defined by
ISO SGML) with no intervening white space. Attribute values which
contain whitespace must be enclosed in quotes. Further, any attribute
which contains multiple values must also be enclosed in quotes with
each value seperated by a comma, whether or not whitespace is
present. If the attribute value needs to contain a comma or a double
quote, for example, the use of an entity will ensure the attribute
will parse correctly.
Thus it is possible to properly parse the HTML (SGML) document. If in
question, use a decent SGML parser, use the HTML DTD, and parse the
HTML document in question. Irregularities will be duly noted.
Just becase Netscape/AOL or IEx render a readable document does not
that document parsable make.
Further, standards are standards. HTML and XML are both SGML
applications. It stands to reason that SGML standards apply to both.
--
Jim Brewer
e-mailed courtesy copies are unappreciated, please refrain.
------------------------------
Date: Tue, 02 Mar 1999 12:10:49 +0100
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: localtime -> time
Message-Id: <36DBC739.C77E3B49@datenrevision.de>
Russ Allbery wrote:
>
> Philip Newton <Philip.Newton@datenrevision.de> writes:
>
> > Where do you get perlwhich from?
>
> Well, there's a version that does the same thing in Tom Christiansen's set
> of module tools, but I wrote that one myself a while back.
>
> #!/usr/bin/perl
> $version = q$Id: perlwhich,v 0.1 1998/01/12 23:33:29 eagle Exp $;
> [...]
> which, upon looking at it, isn't as platform-independent as it could be.
> So here's a better version:
> [...]
>
> or you can just use Tom's.
Not so sure about "better" -- the second version didn't work for me
(-w gives "Use of uninitialized value at ./perlwhich2 line 5 (#1)", the
line with "if ($@)"). So I took the version 1 and merged in the for
(@ARGV) bit to process multiple modules. This worked under perl
5.005_51 under PA-RISC2.0 (HP-UX 10.20).
(Sorry to have to snip all the code -- my newsreader insisted.)
Cheers,
Philip
------------------------------
Date: Tue, 2 Mar 1999 00:06:20 -0800
From: "Ekkis" <ekkis@arix.com>
Subject: method overriden!
Message-Id: <rZMC2.5866$8N5.68922@typhoon-sf.pbi.net>
It seems that when I inherit from a class, if I create a method with the
same name as one of the base class's methods, the base class loses access to
it's own method! Consider the following (see 3 files below): a call to
c2->new() generates a call to the base class constructor c1->new() which
calls its helper sub init(). That call ($self->init()) should resolve to
c1->init(), but doesn't!! instead c2->init() gets called. Thus when
c1->new() returns and c2->new() continues and calls ITS own init(),
c2->init() is called for a second time. Can someone explain to me why? and
what can be done to protect the base class's access to it's own methods?
1k thx - e
--> Class 1, File c1.pm
#!/usr/bin/perl
package c1;
use strict;
use Carp;
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = {};
bless($self, $class);
$self->init(@_);
return $self;
}
sub init {
my $self = shift;
# init stuff
print "Class I: init()\n";
}
1;
--> Class 2, File c2.pm
#!/bin/perl
package c2;
use strict;
use c1; # inherit
@c2::ISA = ("c1");
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = $class->SUPER::new();
bless($self, $class);
$self->init(@_);
return $self;
}
sub init {
my $self = shift;
# init stuff
print "Class II: init()\n";
}
1;
--> Object, File o.pl
#!/usr/local/bin/perl -w
use c2;
$o = c2->new();
------------------------------
Date: Tue, 02 Mar 1999 08:51:25 +0100
From: Carl_Cunningham@oh.god.dont.spam.me
Subject: Re: nmake, adding modules in Win 98
Message-Id: <36DB987D.3BEBBCBE@oh.god.dont.spam.me>
Randy Kobes schrieb:
> On Sun, 28 Feb 1999 12:29:42 GMT,
> tbird99@my-dejanews.com <tbird99@my-dejanews.com> wrote:
> >I am trying to add modules for Perl in Win 98. I am using Perl v5.005_02, and
> >the path is correct. I get the error, "Bad command or file name" whenever I
> >try to do the nmake step for adding a module. Am I doing something wrong?
>
> Hi,
> It probably means you don't have nmake installed - you can grab it
> from ftp://ftp.microsoft.com/Softlib/MSLFILES/nmake15.exe. If you're
> using ActiveState's perl port, then this should work - if not, you might
> have to edit perl's Config.pm file to tell it what make program you're
> using.
>
I've downloaded nmake from MS, and it bombs out when I try to use it, complaining
about "Illelagal characters" and fun stuff like that. Just did the basic "perl
makefile.pl;make;" and had no luck. Any ideas?
Carl Cunningham
------------------------------
Date: 02 Mar 1999 09:54:32 +0000
From: Jim Brewer <jimbo@soundimages.co.uk>
Subject: Re: Non-greedy matching
Message-Id: <uk8x02p47.fsf@jimbosntserver.soundimages.co.uk>
Mark <admin@asarian-host.org> writes:
> Hi,
>
> Suppose I have the following domains:
>
> $sites{'cwdomains'} = 'domain_one|domain_two';
>
> then:
>
> s/\@.*?(?:($sites{'cwdomains'}))/\@$1/gi;
>
> will fail is there are multiple email addresses on the same line: the ".*?" is
> discarded, and a greedy match is done. Okay, I asked for that with "?:", but is
> there any way I can match ".*?" non-greedy before "(?:($sites{'cwdomains'}))" ?
The .*? is NOT discarded. You simply got what you asked for, as much
of anything '(.*)', including NOTHING, kept to the bear minimum. The
construct you have used allows the match to match everything
immediately after the '@' and before (domain_one|domain_two). Even if
the match contains nothing.
I think what you are trying to achive is the removal of any
host/subdomain information that may occur before the domain(s) you are
matching on. Regardless, your regex does not specify what you want
well enough to get what you want.
For example:
$sites{'cwdomains'} = 'maybe.com|no.com|maybe.no.com';
$_ = 'abc@z.no.com def@a.yes.com ghi@b.yes.com ';
$_ .= 'jkl@c.maybe.com mno@d.maybe.com pqr@e.maybe.no.com';
s#(?:[^@](?:(?!$sites{'cwdomains'}))\.)*($sites{'cwdomains'})#$1#gi;
print "$_\n";
yields:
abc@no.com def@a.yes.com ghi@b.yes.com jkl@maybe.com mno@maybe.com pqr@maybe.no.com
The first part of the expression uses the non-grouping (?:) construct
and allows 0 or more matches against the pattern. The pattern itself
excludes any match on the '@' character. This ensures we only look for
matches following the '@' symbol. This is followed by the negative
look-ahead assertion using the domains we do want to match on. We want
to match as much as possible excluding the desired domains. This is
followed by a single '.' character. This group is allowed to match 0
or more times. Once this group fails to match the pattern now contains
the alternation group, which are the domains you want to match on and
substitute for.
This is a bit different than your '(.*?)' pattern. The more defined a
pattern the more likely the results will meet expectations. The
application of the modifier only obscured the real issue, that is,
finding the pattern you were looking for and doing the substitution
there. My experience with the '(.*?)' construct indicates that unless
the rest of the pattern is very well defined you will wind up with
either nothing or way more than you bargined for. Anyway, '(.*?)'
usually indicates that more thought is required in the construction of
the pattern. Same with the '(.*)' construct. Minimal matching is
almost always the result of a poorly constructed regex.
--
Jim Brewer
e-mailed courtesy copies are unappreciated, please refrain.
------------------------------
Date: Tue, 02 Mar 1999 09:45:22 GMT
From: gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Odd Experience
Message-Id: <36dbaf2b.2067664@news.dircon.co.uk>
On Tue, 02 Mar 1999 01:42:54 -0500, Wally <wally@sub-zero.mit.edu>
wrote:
>Hello all. Had an odd experience tonight at an Open House for MIT's EECS
>internship program.
>
>I was talking with a cat from Company X. I said that I had been writing
>a lot of Perl lately, and was "falling unashamedly in love with the
>language".
>
>His response: "That's unfortunate. You and your Perl code will become
>one, inextricably linked. <laughter>"
>
>Perl is *not* write-only, I tell myself. But it LOOKS that way! :)
>
No its just that cats have a different view of programming style than
the rest of us:
See:
<http://www.dejanews.com/[ST_rn=ps]/dnquery.xp?search=thread&recnum=%3cPine.GSO.4.02A.9811251105090.6345-100000@user2.teleport.com%3e%231/1&svcclass=dnserver>
<http://www.dejanews.com/[ST_rn=ps]/dnquery.xp?search=thread&recnum=%3c74bibk$qp$1@gellyfish.btinternet.com%3e%231/1&svcclass=dnserver>
<http://www.dejanews.com/[ST_rn=ps]/getdoc.xp?AN=420708912>
<http://www.dejanews.com/[ST_rn=ps]/getdoc.xp?AN=253098763>
<http://www.dejanews.com/[ST_rn=ps]/dnquery.xp?search=thread&recnum=%3c366e73e9.385427822@news.oz.net%3e%231/1&svcclass=dnserver>
etc ...
/J\
------------------------------
Date: Tue, 2 Mar 1999 00:11:19 -0800
From: "Dave Roth" <xrxoxtxhxdx@xrxoxtxhx.xnxextx>
Subject: Re: Please, An example of win32::NetResourse.
Message-Id: <e2NC2.1008$YV6.587@news2.giganews.com>
RedWine wrote in message <36d9f6de.44333704@C48381-a>...
>I need to map a network drive. (\\mike400\c)
>Win98 & WinNT are the OS's
>
>win32::NetResource is the module I need (I think)
>
>The terminology is abstract to say the least.
>My "Learning Perl" book doesn't cover this. I order a couple
>additional books but they will not be in for at least a week+.
>
This is taken from chapter 2 of my new book (see my sig for details):
Connecting to Shared Network Resources
--------------------------------------
If your intention is to make a connection to a network share, then you
must visit the AddConnection() function:
Win32::NetResource::AddConnection( \%NetResource, $Password, $Userid,
$Connection)
The first parameter (\%NetResource) is a reference to a NETRESOURCE hash.
The second and third parameters ($Password and $Userid) are the password
and userid, respectfully. The userid can be any valid username (it does not
have to be the current user). If the $Userid parameter is an empty string,
then the current user's userid will be used.
The fourth parameter ($Connection) determines whether or not the system
should remember this connection. If the value for this parameter is a 1 then
the connection will be remembered and the next time the user logs on there
will
be an attempt to connect again (the connection will be persistent). This
information will be remembered, however, only if it is successful in
connecting
to the share and the connection redirects a local device. Deviceless
connections
(that is, connecting as a UNC and not a drive or printer) will not be
remembered.
If the function is successful then it returns a TRUE value otherwise it
returns
FALSE.
The code in Example 2.12 enables you to connect your R: drive to
\\server1\games and remember the connection so every time you logon,
your R: drive will automatically connect.
Example 2.12: Connecting to a shared resource.
use Win32::NetResource;
%NetResource = (
LocalName => "R:",
RemoteName => "\\\\server1\\games"
);
$User = "";
$Password = "";
if( Win32::NetResource::AddConnection( \%NetResource, $Password, $User,
1 ) )
{
print "Successful!\n";
}
else
{
# See Example 1.6 for the NetError() function
print NetError();
}
The code in Example 2.12 will connect the R: drive to \\server1\games.
Notice
that only two fields of the NETRESOURCE hash were used: LocalName and
RemoteName.
There really is no need to use the other fields. If you wanted to specify a
userid
and password you would fill out both the Password and User parameters.
Typically
these parameters are left as empty strings so the connection is made using
the current user's id and password. The fourth parameter of AddConnection()
in Example 2.12 is a 1, so if the function successfully connects then the
user's
profile is updated to reconnect every time the user logs on.
NOTE:
In Example 2.12 you could have left off the LocalName key from the
%NetResource
hash. This would have made a deviceless connection. You would have been
connected
to the shared resource but not through a local drive letter. The only way to
access the resource would be through a UNC.
The user's profile would have not been updated to remember the connection
because
deviceless connections can not be persistent whereas regular local devices
that
are connected to a share can be.
I hope this helps,
dave
--
=================================================================
Dave Roth ...glittering prizes and
Roth Consulting endless compromises, shatter
http://www.roth.net the illusion of integrity
Win32, Perl, C++, ODBC, Training
rothd at roth dot net
Our latest Perl book is now available:
"Win32 Perl Programming: The Standard Extensions"
http://www.roth.net/books/extensions/
------------------------------
Date: 2 Mar 1999 08:10:57 GMT
From: kthl@msg.ti.com (Thana Letchumi)
Subject: sending associate array as argument
Message-Id: <7bg6eh$duk$1@tilde.csc.ti.com>
Hi,
May I know how do I call another perl script with passing an argument (which
is an associate array) from a perl script ?.
THank YOu.
Regards,
Thana
------------------------------
Date: Tue, 02 Mar 1999 12:31:16 GMT
From: alastair@solarnet.co.uk
Subject: Using the print << command
Message-Id: <36dbd902.328057922@news-reader.bt.net>
Hi all
I'm having a bit of a problem I when I try and use the print
<<variable command to print HTML I get a error that says PERL cannot
find the string terminator. This is the code I have. Can anyone spot
anything I am doing wrong. Also if its not the code causing this
error can anyone recommend anything.
print <<_HTML_
<HEAD>
<TITLE>TEST</TEST>
<BODY>
<P>test<P>
</BODY>
_HTML_
Please help as I am going insane sat here looking at this code
Thanks in advance
A;lastair brown
------------------------------
Date: 02 Mar 1999 13:44:08 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Using the print << command
Message-Id: <83d82s3vtz.fsf@vcpc.univie.ac.at>
Re: Using the print << command, alastair
<alastair@solarnet.co.uk> said:
alastair> print <<_HTML_
missing semi-colon ;
alastair> <BODY> <P>test<P> </BODY> _HTML_
Make it even easier and use the CGI.pm module:
print start_html(-title => '....');
print p, 'test', p;
print end_html;
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien. | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds! | private email:
Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: Tue, 02 Mar 1999 12:44:34 +0100
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: Why can't my .pl find my SCRIPT ??
Message-Id: <36DBCF22.32EA6363@datenrevision.de>
Eric Bohlman wrote:
>
> Michael Fuerst <mfuerst@advancenet.net> wrote:
> : # attempt to pull out <SCRIPT .... </SCRIPT>
> : # This next line prints and puts only an ascii 10 and an ascii 32 into
> : $1
> : # (PROBLEM 1: I would think that this would put everything between
> : <SCRIPT> and </SCRIPT> into $1)
> : print $page =~ m'^\s*<SCRIPT.*>(.*)</SCRIPT>'smg;
>
> The '.*' after 'SCRIPT' is greedy and matches everything up to the last
> '>' before '</SCRIPT>', leaving only a newline and a space for the parens
> to capture. You need to make it non-greedy: .*?
Or, alternatively, [^>]* instead of .* ?
Cheers,
Philip
------------------------------
Date: Tue, 02 Mar 1999 11:48:08 +0100
From: Philip Newton <Philip.Newton@datenrevision.de>
To: "Juho Cederstrvm" <cederstrom@kolumbus.fi>
Subject: Re: Why isn't this a race condition ?
Message-Id: <36DBC1E8.FF0860AE@datenrevision.de>
[posted and mailed]
Juho Cederstrvm wrote:
>
> Jonathan Feinberg wrote:
>
> >I guess we need another FAQ: "I *still* still don't get locking..."
>
> Nope. You don't need. Or at least not because of me. I can get locking
> always when I need it.
"I don't get locking" here does not mean "I cannot lock files / I can't
get locking to work" but rather "I don't [fully] understand locking".
Maybe you didn't get what Jonathan Feinberg said :).
Cheers,
Philip
------------------------------
Date: 12 Dec 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 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5031
**************************************