[8732] in Perl-Users-Digest
Perl-Users Digest, Issue: 2348 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 17 12:17:28 1998
Date: Fri, 17 Apr 98 09:00:31 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 17 Apr 1998 Volume: 8 Number: 2348
Today's topics:
Re: 'strict' and filehandles <bmb@ginger.libs.uga.edu>
Re: .= so why not =. ? (Last time; promise) <bmb@ginger.libs.uga.edu>
Re: .= so why not =. ? (Michael Rubenstein)
Announcing The Perl Study Forum <doug@ccinet.com>
Re: Array / List question <kevan@nol.net>
Re: Bill Gates should be invited to O'Reilly's "Free So (Chris Nandor)
Re: CLPM CONTENT POLICE (was info on cookies) <andrewf@cp.pathfinder.com>
Re: CLPM CONTENT POLICE (was info on cookies) <andrewf@cp.pathfinder.com>
Re: commenting a whole block? <jdporter@min.net>
Re: commenting a whole block? <bmb@ginger.libs.uga.edu>
Re: Fork in perl/NT ? (Stuart McDow)
Re: Hash of Arrays (Andrew M. Langmead)
Re: Hash of Arrays <pdcawley@bofh.org.uk>
Help me! <yurik5@usa.net>
Re: Hide or Encrypt perl source code (Stuart McDow)
Re: how to develop/test perl-cgi in local win32 develop <due@discovernet.net>
Re: multi-lingual program in perl (Martin Vorlaender)
Re: Multi-tasking/threading <bsugars@canoe.ca>
ODBC and Perl <dunlopg@bathroom.tibus.net>
Re: OOPS and several parents (Daniel)
Operator overloading questions (Phil Ptkwt Kristin)
Re: Operator overloading questions <jdporter@min.net>
Pb with LWP emmanuel_astier@yahoo.com
Re: PERL aware code editor <c96men@cs.umu.se>
Re: Perl library for INI file <bmb@ginger.libs.uga.edu>
Perl Oddity (Mark-Jason Dominus)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 17 Apr 1998 10:43:10 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: 'strict' and filehandles
Message-Id: <Pine.A41.3.96.980417103956.63622O-100000@ginger.libs.uga.edu>
#!/usr/local/bin/perl -w
use strict;
my($filename ) = 'xx';
open ( FOO , $filename ) ;
close( FOO );
The above code works on my machine, but you can't leave any of it out if
you want to avoid error messages. I never saw anything that mentioned
barewords, so that must be in a different part of your code.
HTH, Brad Baxter, UGA
On Fri, 17 Apr 1998, Uwe Hein wrote:
> With 'use strict' I am not able to call
> 'open ( FOO , $filename ) ;' anymore
> (Bareword error).
> Can anyone help?
> Thanks
> -uh
> Uwe Hein
------------------------------
Date: Fri, 17 Apr 1998 09:59:43 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: .= so why not =. ? (Last time; promise)
Message-Id: <Pine.A41.3.96.980417094654.63622K-100000@ginger.libs.uga.edu>
On 16 Apr 1998, Abigail wrote:
> Uh, if foobar offends you, perhaps you shouldn't play with the grownups.
> Abigail
Actually, I do look young for my age. :-)
I would like to thank everyone who took the time to respond to my post.
I found the replies thought provoking, informative, suprising and witty.
You decide which was which. :-)
I promise this is my last post on the subject. Having spent my first two
days attempting to follow this list (I finally finished reading the FAQ,
"whew!"), I understand why some of you have little patience; this takes a
lot of time, over and above regular email.
I'm kicking myself for not taking this plunge earlier.
Kind Regards,
Brad Baxter
UGA
------------------------------
Date: Fri, 17 Apr 1998 14:26:27 GMT
From: miker3@ix.netcom.com (Michael Rubenstein)
Subject: Re: .= so why not =. ?
Message-Id: <353865f5.234554291@nntp.ix.netcom.com>
On 16 Apr 1998 19:03:16 GMT, abigail@fnx.com (Abigail) wrote:
>John Adams (John.Adams@BentonvilleAR.ncr.com) wrote on MDCLXXXIX
>September MCMXCIII in <URL: news:01bd6941$d1cb6340$32325299@arbentadamsj.bentonvillear.ncr.com>:
>++ Okay, if
>++
>++ $string1 = "foo";
>++ $string2 = "bar";
>++ $string1 .= $string2; #$string1 is now "foobar"
>++
>++ then why doesn't
>++
>++ $string1 = "foo";
>++ $string2 = "bar";
>++ $string1 =. $string2; #$string1 is now "barfoo"
>++
>++ Or am I missing something here?
>
>
>Yes. There are no =+ and =- in Perl either. And that's because there
>are no =+ and =- in C. Not anymore at least. AFAIK, long time ago, =+
>and =- where in C, with there obvious meanings. But then, a generation
>of lazy programmers was born, too laze to hit the space bar every now
>and then. They tend to not put spaces around operators. So you get
>things like 'a=7', which is fine. But 'a=-7' wouldn't be the same as
>'a = -7'. So, they took it out.
>
>So... if everyone always had put spaces around their operators, =.
>might have been a Perl operator.
Perhaps it would have been better if Perl had been derived from a
language that requires spaces around the operators, such as COBOL. :-)
--
Michael M Rubenstein
------------------------------
Date: Fri, 17 Apr 1998 14:25:33 GMT
From: "Doug Evans" <doug@ccinet.com>
Subject: Announcing The Perl Study Forum
Message-Id: <xDJZ.186$f2.757573@katana>
The Perl Study Forum is now on-line, at...
http://www.icparts.com/perlforum
This site is designed to help newbies, as they struggle with the Perl texts,
"Learning Perl", Learning Perl on Win32 Systems", and "Perl Programming".
There are two basic parts to the site, 1) a BBS, where people can ask
questions, related to specific pages, in the books, and others, hopefully,
you old timers, and 2) a set of pages, one for each book, designed as a FAQ,
where the questions and responses, developed in the BBS, will be archived,
for students of the future to refer to.
We hope you will join in.
Doug Evans
------------------------------
Date: Fri, 17 Apr 1998 15:11:33 GMT
From: "Kevan Granat" <kevan@nol.net>
Subject: Re: Array / List question
Message-Id: <01bd6a12$c0d82bf0$326d5cc0@kevan>
I'm not sure if this option was posted yet...
to modify all elements of an array w/o a loop, the camel book (1st ed,
p221)
suggests:
grep($_ *= 2, @Array) ;
which is quite handy, I think, for s/// operations...
grep(s/this/that/g, @Array) ;
Note that @Array only includes the elements that had a successful
substitution, though. Sometimes you have to use:
grep(s/this/that/g || 1, @Array) ;
"A.P." <road@apdo.com> writes:
> Hi!
> I don't understand the behaviour of the following code:
>
> print ((0,4)**2);
>
> It prints 16, why doesn't it print 0? I discovered this trying to do it
> with an array. I'm a Perl beginner and I wondered if there was a way of
> doing some operation (like squaring) all the elements of an array/list
> without using a loop block. What I tried was:
------------------------------
Date: Fri, 17 Apr 1998 10:53:40 -0400
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <pudge-1704981053410001@ppp-24.ts-1.kin.idt.net>
In article <35366AC6.F32997A7@cyberhighway.net>, Bill Anderson
<ucntcme@cyberhighway.net> wrote:
# But why? What does it matter if someone believes it? It begins to delve into
# religion if you go that far. You have gone beyond guarding your thoughts to
# trying to 'convert' others' thoughts.
Who in this dicussion hasn't?
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10 1FF7 7F13 8180 B6B6'])
#== New Book: MacPerl: Power and Ease ==#
#== Publishing Date: Early 1998. http://www.ptf.com/macperl/ ==#
------------------------------
Date: Fri, 17 Apr 1998 10:36:25 -0400
From: "Andrew F. Lee" <andrewf@cp.pathfinder.com>
Subject: Re: CLPM CONTENT POLICE (was info on cookies)
Message-Id: <Pine.GSO.3.95.980417102623.19418B-100000@cp.pathfinder.com>
On 16 Apr 1998, Craig Berry wrote:
> Abigail (abigail@fnx.com) wrote:
> : Andrew F. Lee (andrewf@cp.pathfinder.com) wrote on MDCLXXXIX September
> This is the key metric that I can't believe people keep missing. I
> sometimes wonder if a large minority of CGI programmers simply don't
> understand that there's nothing magic about Perl as a CGI implementation
> language.
Ah, but Perl is magical in every way! :-)
> And to expand on this, questions about semantics are (if anything) far
> more welcome in c.l.p.m than questions about syntax. Syntax questions
> can generally be answered trivially by doc lookup or a quick experiment;
> semantics questions tend to be tougher and more interesting.
Yes, and semantics involve applications. CGI is very common (no pun) as
an application with which Perl programmers wrestle. The semantics of Perl
become intertwined with the semantics of CGI. Ditto for Unix shell or
other OS's. Ditto for other tools like AWK, sed, ex.
> However, a question irrelevant to Perl as such (e.g., "How do I deal with
> the user bouncing on the submit button," to paraphrase a recent example)
That was off topic. I agree. On the other hand, "How do I get my Perl
CGI to deal with event blah." Seems reasonable on a newsgroup with misc
in the title. Is that not fair?
------------------------------
Date: Fri, 17 Apr 1998 10:48:18 -0400
From: "Andrew F. Lee" <andrewf@cp.pathfinder.com>
Subject: Re: CLPM CONTENT POLICE (was info on cookies)
Message-Id: <Pine.GSO.3.95.980417103643.19418C-100000@cp.pathfinder.com>
On 16 Apr 1998, Abigail wrote:
> Andrew F. Lee (andrewf@cp.pathfinder.com) wrote on MDCLXXXIX September
> ++ In my humble opinion, Perl and CGI are commmon companions.
>
> You are wrong. Just the fact a majority of CGI programs are written
> in Perl doesn't mean the majority of Perl programs have anything
> to do with CGI.
I stated opinion. Opinions are not facts. In particular they do not have
a truth value. Your assertion that I am 'wrong' is meaningless.
> ++ As a Perl programmer, I do not usually come to clpm questions about syntax
> ++ so much as questions about semantics. Apologies to those who are studying
> ++ Perl in a vacuum with no intention of ever writing applications.
>
> You are wrong. Many applications are written in Perl that have nothing to
> do with CGI.
This seems to be a non-sequiter. Read my statement and consider what I
have said. It has nothing to do with CGI.
> ++ My point: If you have something useful to say, please do. If you have
> ++ just had too much caffeine, please refrain from posting pointless and
> ++ sniveling comments (unless they are funny).
>
> Your post is pointless and sniveling. And it ain't funny.
Ok --- one pointless and sniveling unfunny post to your dozens (I was not
attempting to be funny, btw). Perhaps I misstated my thought completely.
Let's try this again.
Abigail, I find your one liners to be insipid and a waste. I would ask
that you refrain from posting unless you have something useful to say. By
useful I mean, in particular, more than "RTFM" or "That's not Perl". I
know that. I know that you know that. Everyone in clpm knows that you
know that. Applause and adulation. Now, I will take my own advice and
drop this and just ignore your posts.
------------------------------
Date: Fri, 17 Apr 1998 14:04:08 GMT
From: John Porter <jdporter@min.net>
Subject: Re: commenting a whole block?
Message-Id: <353762BC.3539@min.net>
Larry Rosler wrote:
>
> I recently saw a quote along the lines of "I know that what I said last year
> differs from what I say now. I was right then, and I'm right now." This is
> the mark of religious fanaticism, not of sound engineering evolution.
I'm not sure I agree with this. Obviously the language can change,
perhaps a lot, in the course of a year. Someone who's hep to the
state of the language at each point might easily say different yet
correct things from one year to the next.
Besided, in perl, TIMTOWTDI, so there are plenty of "different yet
correct" things to be said. :-)
John Porter
------------------------------
Date: Fri, 17 Apr 1998 10:20:24 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: commenting a whole block?
Message-Id: <Pine.A41.3.96.980417101546.63622M-100000@ginger.libs.uga.edu>
Perl is free. The FAQs are free. The advice we get in this list is free.
On the other hand, all of the above are very costly to those who maintain
them voluntarily.
You get what you pay for? (or should I have said, "YGWYPF")
Brad Baxter
UGA
On Thu, 16 Apr 1998, Larry Rosler wrote:
> I recently saw a quote along the lines of "I know that what I said last year
> differs from what I say now. I was right then, and I'm right now." This is
> the mark of religious fanaticism, not of sound engineering evolution. Yet
> that seems to be the dominant attitude of Perl gurus in this group. "Come
> back after you've upgraded to the latest -- and therefore, the only
> acceptable -- version of perl." Too bad that even the official on-line FAQs
> can't meet up with this expectation.
>
> Larry Rosler
> Hewlett-Packard Laboratories
> lr@hpl.hp.com
------------------------------
Date: 17 Apr 1998 14:21:43 GMT
From: smcdow@arlut.utexas.edu (Stuart McDow)
Subject: Re: Fork in perl/NT ?
Message-Id: <6h7ohn$n33$1@ns1.arlut.utexas.edu>
emmanuel_astier@yahoo.com writes:
>
> I first made the prog on Unix, using a Fork and signals to have the request
> sent at the same time.
>
> But the 100 requests saturate our developpement network, so I'd like to have
> the same kind of prog localy, on the NT server.
That will be a problem. The Well Known Virus from Redmond doesn't
support fork().
> How can I do multiprocess/multithread/multi-whatever with Perl on NT
> ??
AFAIK, unless there's some sort of magical module out there, you'll
have to wait for 5.005, which will support threads.
--
Stuart McDow Applied Research Laboratories
smcdow@arlut.utexas.edu The University of Texas at Austin
"It is obvious that about 750,000 people ago, Austin was a wonderful City."
------------------------------
Date: Fri, 17 Apr 1998 14:39:24 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Hash of Arrays
Message-Id: <ErKBDo.M78@world.std.com>
"James Birchfield" <jsrbirch@toad.net> writes:
>You might alos consider hashing up a reference to the array.
>$HASH{$index} = \@array;
But there are some dangers to this approach, as explained in the
perldsc man page that other articles in this thread mentioned.
You can accidentally give all the elements of the hash a reference to
the same array.
for $row (1 .. 10) {
@col = map { $row * $_ } 0 .. 10;
$buggy[$row] = \@col;
$safe[$row] = [ @col ];
}
print "printing \@buggy\n";
for $row ( @buggy ) {
print map { sprintf '%4d', $_ } @$row;
print "\n";
}
print "printing \@safe\n";
for $row ( @safe ) {
print map { sprintf '%4d', $_ } @$row;
print "\n";
}
Now you can fix this with a well place my(), but are you sure that the
maintainance programmer won't change the scope of the variable and
mess things up? (Even if the mainainance programmer is youself.)
--
Andrew Langmead
------------------------------
Date: 17 Apr 1998 16:59:54 +0200
From: Piers Cawley <pdcawley@bofh.org.uk>
Subject: Re: Hash of Arrays
Message-Id: <s7pemywcx3p.fsf@olorin.elsevier.nl>
"James Birchfield" <jsrbirch@toad.net> writes:
> You might alos consider hashing up a reference to the array.
>
> $HASH{$index} = \@array;
>
> Then you can pass the array to a subroutine like this;
> foo($HASH{$index});
>
> sub foo {
> local($array) = @_;
> for(@$array) { ...
> }
>
> I like this way better.
You can pass
$HASH{index1} = [ @array ]
to a subroutine as well you know. But if that subroutine wants to mess
about with the contents of the array then in your version @array (the
global one) will get altered, whereas the only thing that gets changed
in the second is the contents of $HASH{index1}.
BTW, don't you mean 'my $array = shift;'?
--
Piers Cawley
Where is the life we have lost in living?
Where is the wisdom we have lost in knowledge?
Where is the knowledge we have lost in information? -- T. S. Eliot.
------------------------------
Date: Fri, 17 Apr 1998 18:28:27 +0300
From: Yurik <yurik5@usa.net>
Subject: Help me!
Message-Id: <3537751B.F4991970@usa.net>
I'm interested in processing data from WEB pages,
the problem is I'm copletely lost in all these CGI and PERL scripting
references.
Can somebody tell me what I need to write a simple CGI or what ever
script which will take data from 'text field' on the WEB page after I
press 'submit' button and save the data to the file on the server.
I'll appriciate any examples.
Thanks,
Yurik.
mailto:yurik5@usa.net
------------------------------
Date: 17 Apr 1998 14:08:09 GMT
From: smcdow@arlut.utexas.edu (Stuart McDow)
Subject: Re: Hide or Encrypt perl source code
Message-Id: <6h7no9$kgf$1@ns1.arlut.utexas.edu>
John Porter <jdporter@min.net> writes:
>
> Now it's 14 meg. Do you think that's easy to justify?
Probably not. Looks like you'll have to wait for the perl compiler.
I realize now why I've always shied away from writing commercial
software. :-)
--
Stuart McDow Applied Research Laboratories
smcdow@arlut.utexas.edu The University of Texas at Austin
"It is obvious that about 750,000 people ago, Austin was a wonderful City."
------------------------------
Date: 17 Apr 1998 14:11:52 GMT
From: "Allan M. Due" <due@discovernet.net>
Subject: Re: how to develop/test perl-cgi in local win32 development environment?
Message-Id: <6h7nv8$f77$0@206.165.146.192>
Actually you can get Website 1.1 for free, it is just not highly
advertised. If you go to the O'reilly website for the "free demos" at
http://software.ora.com/download/ you will find one of the free demos is a
complete version Website 1.1e. This is in no way restricted. It just is
the old program before 2.0. It is not as powerful as 2.0 but it is not a
demo in the usual sense. It is what came in the box if you bought 1.1.
There were later versions of 1.1 (g and h) but e should meet most of your
needs. O'Reilly has excellent documentation on their support pages as to
how to set it up to run Perl programs. It is what I use to debug sites
before I place them on the web.
Hope this helps.
AmD
Stay away from PWS very limited and a huge pain to deal with.
------------------------------
Date: Fri, 17 Apr 1998 17:16:52 +0200
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: multi-lingual program in perl
Message-Id: <35377264.524144494f47414741@radiogaga.harz.de>
LMK (lmk@moon.csc.cuhk.edu.hk) wrote:
: According to some guidelines, writing multilingual programs should
: put user interface messages in resource files. Now, I wanna know which
: place is the best to store such pieces of information in perl.
: Resource file as Package? Object Class? Simple file? DBM?
I very much liked a solution that was once posted to c.l.p.m.
cu,
Martin
[--cut--]
From: philippe.verdret@eurolang.fr
Subject: Re: Writing Multilingual Software
Date: Fri, 30 Jan 1998 03:11:11 -0600
Newsgroups: comp.lang.perl.misc
Bekman Stanislav <sbekman@iil.intel.com> wrote:
> Anyway I wrote a tool in Perl. Now I have to port it (its output of all
> print() calls ) to a different human languages, (french, italian,
> russian and etc.)
You can certainly derived a useful solution of the following code:
#################### The Babel Class ################
{
package Babel;
require 5.000;
use strict;
use Carp;
use vars qw($VERSION);
$VERSION = sprintf("%d.%02d", q$Revision: 1.01 $ =~ /(\d+)\.(\d+)/);
my $debug = 0;
my $pkg = caller || '';
sub new {
my $self = shift;
my $class = (ref $self or $self);
if ($class eq $pkg) {
$class = defined $_[0] ? $_[0] : "\U$ENV{'LANG'}";
}
if ($class eq '') {
$class = 'EN'; # En disespoir de cause ;-)
}
print STDERR "Current language is $class\n" if $debug;
if (ref $self) { # Object method
$self = bless { %{$self} }, $class;
} else { # class method
$self = bless { }, $class;
}
$self;
}
sub message {
my $self = shift;
if (@_) {
$self->{_message} = { @_ };
} else {
$self->{_message}
}
}
sub language {
my $self = shift;
ref($self);
}
sub compose {
my $self = shift;
my $id = shift;
my $msg = $self->{_message}->{$id};
unless (defined $msg) {
my $class = ref $self;
croak qq!no message for "$id" in the "$class" class!;
}
my $argnum = @_;
my @formats = ($msg =~ /((?:[^%]|^)(?:%%)*%)/g);
my $formatnum = @formats;
if ($argnum != $formatnum) {
croak qq!bad argument number in message "$id": $argnum, $formatnum expected\n$msg!;
}
sprintf($msg, @_);
}
sub debug {
my $self = shift;
$debug ^= 1;
}
1;
}
{
package FR;
@FR::ISA = qw(Babel);
my %messages = (
'msg1' => 'un premier message en frangais : %s',
'msg2' => 'un second message en frangais : %s, %s'
);
sub new {
my $class = shift;
my $self = $class->SUPER::new();
$self->message( %messages );
bless $self, $class;
}
1;
}
{
package WO;
@WO::ISA = qw(Babel);
my %messages = (
'msg1' => 'li dieuk tchi Wolof: %s',
'msg2' => 'nya rel bi tchi Wolof: %s, %s'
);
sub new {
my $class = shift;
my $self = $class->SUPER::new();
$self->message( %messages );
bless $self, $class;
}
1;
}
{
package EN;
@EN::ISA = qw(Babel);
my %messages = (
'msg1' => 'a first message in english: %s',
'msg2' => 'a second message in english: %s, %s'
);
sub new {
my $class = shift;
my $self = $class->SUPER::new();
$self->message( %messages );
bless $self, $class;
}
1;
}
#use Babel;
my $errmes = FR->new;
print $errmes->compose(qw(msg1 arg1)),"\n";
$errmes = WO->new;
print $errmes->compose(qw(msg1 arg1)),"\n";
$errmes = EN->new;
print $errmes->compose(qw(msg2 arg1 arg2)),"\n";
--
| Martin Vorlaender | VMS & WNT programmer
Ceterum censeo | work: mv@pdv-systeme.de
Redmondem delendam esse. | http://www.pdv-systeme.de/users/martinv/
| home: martin@radiogaga.harz.de
------------------------------
Date: Fri, 17 Apr 1998 14:47:21 GMT
From: Benjamin Sugars <bsugars@canoe.ca>
To: Zenin <zenin@archive.rhps.org>
Subject: Re: Multi-tasking/threading
Message-Id: <35376B96.77D8@canoe.ca>
[ ...posted and mailed ... ]
Zenin wrote:
> Dado Colussi <gdc@xenetic.fi> wrote:
> : How about embedding the perl interpreter in a multithreaded
> : program and running scripts in several threads at the same
> : time?
>
> Sure, but you gain little. The scripts in the different threads
> could not share data directly for one thing.
Without a threaded Perl, you can't properly embed in a multi-threaded
environment at all. All the calls out to the Perl runtime need to be
serialised, which hoses the multi-threaded application.
-Ben
--
Ben Sugars <bsugars@canoe.ca>
Senior Webmaster,
CANOE Canadian Online Explorer,
http://www.canoe.ca/
------------------------------
Date: Fri, 17 Apr 1998 16:30:00 +0100
From: "Gareth Dunlop" <dunlopg@bathroom.tibus.net>
Subject: ODBC and Perl
Message-Id: <892830606.1368@sparc.tibus.net>
I am using Perl to talk to an Access database via ODBC on a WinNT platform. I
have completed a script which works fine running it through a command shell, and
returns my output perfectly. However, when I run this script through a browser,
it will not return any values from the database. When I check my ODBC log, I
see the following message:
od 183:186 EXIT SQLDriverConnectW with return code -1 (SQL_ERROR)
HDBC 0x00d60960
HWND 0x00000000
WCHAR * 0x6a9a7284 [ -3] "******\ 0"
SWORD -3
WCHAR * 0x6a9a7284
SWORD -3
SWORD * 0x00000000
UWORD 0 <SQL_DRIVER_NOPROMPT>
DIAG [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and
no default driver specified (0)
Does anyone know what I'm doing wrong, what I should do, or point me to a web
page which can help me out. Thanks,
Gareth.
--
--------------------------
Gareth Dunlop
(Please remove "bathroom." from my email address when replying.)
------------------------------
Date: 17 Apr 1998 15:12:35 GMT
From: daniel.mendyke@digital.com (Daniel)
Subject: Re: OOPS and several parents
Message-Id: <6h7rh3$ora$1@nntpd.lkg.dec.com>
In article <ErIDu6.FBM@cre.canon.co.uk>, abw@cre.canon.co.uk says...
>If you call multiple base class constructors then you run the risk of
>creating multiple objects.
Yes, this is the problem I've been trying to find away around.
It looks as if the best answer is "Don't do it".
>In this case, the Grandpa constructor is called (via inheritance) to
>create the Child and then calls the Child _init() which in turn calls
>the Father _init() which in turn calls the Grandpa _init(). The Child
>object correctly has the 'kid', 'pa' and 'gramps' data members set.
This approach is very good. With the exception of not allowing more
than one parent. It's main advantange seems to be that only one
object is actually 'created'.
>The final (and most flexible) approach would be to create a constructor
>for your derived class which instantiates each of the parent classes
>
> package Combo;
>
> use vars qw( @ISA );
> @ISA = qw( Foo Bar );
>
> sub new {
> my $class = shift;
> bless { %{ Foo->new() }, %{ Bar->new() } }, $class;
> }
>
This example has been presented to me in several ways. But they
all come back to my main intent. That is how to create the
constructor for class Combo in such a way that I could add
additional members to ISA without having also change Combo::new.
The main problem is what to do with parent objects that bless
themselfs. A few very interesting solutions to this problem
have been already been posted. But I think the best solution
for me is to rethink my design. I may be trying to use Perl
as I would C++.
-Daniel
------------------------------
Date: Fri, 17 Apr 1998 14:40:01 GMT
From: ptkwt@user1.teleport.com (Phil Ptkwt Kristin)
Subject: Operator overloading questions
Message-Id: <6h7pjs$95c$1@user1.teleport.com>
Is there any way to overload operators for the builtin scalar types. As
in:
use overload
'&' => \&myand,
'|' => \&myor;
$a = 0;
undef $b; #as in unknown
$c = 1;
$output1 = $a & $b; #should return unknown
$output2 = $a & $c;
sub myand {
my($x, $y, $op) = @_;
if(defined($x) && defined($y)){
return ($x && $y);
}
else{
return undef;
}
}
#similar for myor
Since the subroutine myand never gets called I must conclude that you
can only overload operators for user defined types and that you cannot
overload the builtin scalar type - is this true? If so, are there other
ways to do this?
I'm trying to eval logic equations read from a file - I
could just use the built in binary operators, but I need to account for
the condition when a variable may be in an unknown state and actually
also for a high-impedance state 'z', so the values that a variable could
take on are: (1,0,X(undef),z).
So given an equation read from a file:
'$output = $a & !$b'
I need to eval the equation with the overloaded '&' operator such that:
$a $b $output
0 0 0
0 1 0
1 0 0
1 1 1
- X X
X - X
Z - X
- Z X #NOTE: never get a Z out of an and, but other gates may
#produce Z on output.
BTW: Yes I know that I also need to eval the overload specification in
order for the overloaded operator to work in a eval context.
pt
------------------------------
Date: Fri, 17 Apr 1998 14:47:31 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Operator overloading questions
Message-Id: <35376CE5.6834@min.net>
Phil Ptkwt Kristin wrote:
>
> Is there any way to overload operators for the builtin scalar types...
>
> Since the subroutine myand never gets called I must conclude that you
> can only overload operators for user defined types and that you cannot
> overload the builtin scalar type - is this true? If so, are there other
> ways to do this?
You could turn those scalars into "user-defined types".
Since a blessed reference (object) can be any kind of reference,
it can be a reference to scalar.
I'll bet you also currently have other functionality which would
be better as methods of this new class, such as input validation.
hth,
John Porter
------------------------------
Date: Fri, 17 Apr 1998 09:12:44 -0600
From: emmanuel_astier@yahoo.com
Subject: Pb with LWP
Message-Id: <6h7o0s$sqk$1@nnrp1.dejanews.com>
Hi,
I have strange result with the timeout of UserAgent(s).
I make several useragent to test a server, and simulate 100 clients at the
same time, and to measure how long it take to answer.
So I create N UserAgent :
for ($i=1; $i<=$N; i++)
{
$ua[$i] = new LWP::UserAgent;
$ua[$i]->timeout(4*60); # that's 240 Sec ??
}
And later, I use them :
for (<SNIP>)
{
<SNIP>
$temps_req = time;
$res[$i] = $ua[$i]->request( <a request> ) ;
$temps_req = time - $temps_req;
print "time for request $i : $temps_req \n" ;
<SNIP>
}
...
And in my results, I obtain answers like : 650 sec.
Am I wrong, or 240 is smaller than 650 ? So why doesn't the request end with a
timeout ?
If someone has a kind of an answer, I'd appreciate it...
Thanx,
Emmanuel
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Fri, 17 Apr 1998 16:28:50 +0200
From: Mattias Eriksson <c96men@cs.umu.se>
Subject: Re: PERL aware code editor
Message-Id: <35376722.8C9272B8@cs.umu.se>
>
> Windows: Ultraedit
> Unix: vim *evil grin*
>
> /Niclas
You can use vim 5.0 under win95 also. That way you have the same easy to
use :) editor in both environments.
/Mattias
------------------------------
Date: Fri, 17 Apr 1998 10:39:30 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Perl library for INI file
Message-Id: <Pine.A41.3.96.980417103111.63622N-100000@ginger.libs.uga.edu>
On Fri, 17 Apr 1998, James Lim wrote:
> Is there any library for reading/writing INI file format out there?
> Thanks.
See IniConf in CPAN. See below for a routine I wrote recently. (Anybody
who wants to pick at my code is welcome! I'll consider it free expert
advice.)
Hope this helps,
Brad Baxter
UGA
ps: obviously, YMMV on that first line ...
#!/usr/local/bin/perl -w
use strict;
#######################################################################
### Program: initest
### Author: Brad Baxter
### Date: 3/19/98
### Purpose: to demonstrate the &ini routine
### Notes: The syntax for the .ini file is assumed to be:
### #comment
### [section]
### setting = value (-or-)
### setting=value
### where comments begin with a pound sign,
### 'section' is the section name,
### 'setting' is the name of a particular setting, and
### 'value' is the value of that setting
### Settings may be repeatable within a section:
### setting = value1
### setting = value2
### Sections are *sort of* repeatable: if you put the same
### section name in the file twice, the settings are
### merged together as though there were only one section.
### For example, the two versions below are loaded the same:
### [abc] [abc]
### a = 1 a=1
### [xyz] b=2
### z = 2 [xyz]
### [abc] z=2
### b = 2
###
### Sample: if your input file, "test.ini", looks like this:
###
### ### begin test.ini
### [xyz]
### x = test1
### x = testone
### x = testwon
### x = testwan
### y = test2
### z = test3
### [abc]
### a = 1
### b = 2
### b = two
### b = too
### b = to
### c = 3
### see = far
### [xyz]
### z = TestZ!
### ### end test.ini
###
### The output of this program should look like this:
###
### --- sections in file order ---
### Section: 'xyz'
### Setting: 'x' value(s): 'test1' 'testone' 'testwon' 'testwan'
### Setting: 'y' value(s): 'test2'
### Setting: 'z' value(s): 'test3' 'TestZ!'
### Section: 'abc'
### Setting: 'a' value(s): '1'
### Setting: 'b' value(s): '2' 'two' 'too' 'to'
### Setting: 'c' value(s): '3'
### Setting: 'see' value(s): 'far'
###
### --- sections in alpha order ---
### Section: 'abc'
### Setting: 'a' value(s): '1'
### Setting: 'b' value(s): '2' 'two' 'too' 'to'
### Setting: 'c' value(s): '3'
### Setting: 'see' value(s): 'far'
### Section: 'xyz'
### Setting: 'x' value(s): 'test1' 'testone' 'testwon' 'testwan'
### Setting: 'y' value(s): 'test2'
### Setting: 'z' value(s): 'test3' 'TestZ!'
###
#######################################################################
my( %inihash, @sections ) = ();
my( $value, $setting, $section ) = ( '' );
### load the .ini file data
&ini( "test.ini", \%inihash, \@sections );
### print sections in the same order as found in file
print "--- sections in file order ---";
foreach $section ( @sections ) {
print "\nSection: '$section'";
foreach $setting ( sort keys %{$inihash{ $section }} ) {
print "\n Setting: '$setting' value(s): ";
foreach $value ( @{$inihash{ $section }{ $setting }} ) {
print "'$value' ";
} # foreach value
} # foreach setting
} # foreach section
### print sections in alpha order, using subroutines
print "\n\n--- sections in alpha order ---";
foreach $section ( sort keys %inihash ) {
print "\nSection: '$section'";
foreach $setting ( &get_settings( \%inihash, $section ) ) {
print "\n Setting: '$setting' value(s): ";
foreach $value ( &get_values( \%inihash, $section, $setting ) ) {
print "'$value' ";
} # foreach value
} # foreach setting
} # foreach section
print "\n";
exit;
#######################################################################
### ini: read a .ini file and load into a hash of hashes of arrays
### in addition, store the section names in a separate array
sub ini {
my( $file, $hash_ref, $array_ref ) = @_;
my( $linein, $section ) = ( '' );
open( FILE, $file ) or die "Can't open $file";
while( defined( $linein = <FILE> ) ) {
next if $linein =~ /^\s*#/; ### skip comments
next if $linein =~ /$^/; ### skip blank lines
chomp $linein;
if( $linein =~ /^\s*\[([^\]]+)\]/ ) {
$section = $1;
push( @{$array_ref}, $section )
unless defined ${$hash_ref}{ $section };
} # if section name
elsif( $linein =~ /^\s*([^=]+?)\s*=\s*(.*)\s*$/ ) {
push( @{${$hash_ref}{ $section }{ $1 }}, $2 );
} # elsif setting
else {
### bad syntax in .ini file, print error if desired
} # else
} # while
close( FILE );
} # end sub ini
#######################################################################
### get_settings: given a hash and a section name, get its settings
### (returns an array of keys)
sub get_settings {
my( $hash_ref, $section ) = @_;
return( sort keys %{${$hash_ref}{ $section }} );
} # end sub get_settings
#######################################################################
### get_values: given a hash, a section name and a setting, get the
### value or values (returns an array of values)
sub get_values {
my( $hash_ref, $section, $setting ) = @_;
return( @{${$hash_ref}{ $section }{ $setting }} );
} # end sub get_values
__END__
------------------------------
Date: 17 Apr 1998 11:14:39 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Perl Oddity
Message-Id: <6h7rkv$pfp$1@monet.op.net>
Keywords: bellyache Berra inaudible toolsmith
My program, `py', writes yacc-style parser programs in Perl.
That's not what's odd.
What's odd is the way it does it. It looks at the debugging output of
`bison -v' and steals the state tables from there.
You can read about it in detail at
<URL:http://www.plover.com/~mjd/perl/py/>
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.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 2348
**************************************