[26046] in Perl-Users-Digest
Perl-Users Digest, Issue: 8254 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 15 14:05:41 2005
Date: Fri, 15 Jul 2005 11:05:04 -0700 (PDT)
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, 15 Jul 2005 Volume: 10 Number: 8254
Today's topics:
Can't find module <Mark.Fenbers@NOSPAMnoaa.gov>
Re: copy contructor <moritz.karbach@desy.de>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 15 Jul 2005 10:42:31 -0400
From: Mark <Mark.Fenbers@NOSPAMnoaa.gov>
Subject: Can't find module
Message-Id: <db8ibk$9ho$1@news.nems.noaa.gov>
I wrote a Perl program which works fine on my Linux box, but not another
one. It uses XML::Simple. When run on this other box, I get this error:
XMLin() requires either XML::SAX or XML::Parser at /tmp/hg.pl line 342
So this sounds like a simple module-location issue that is easy to
solve, right? Not to me, anyway. The strange part is that when I print
the contents of @INC, it shows me the expected PATH list and I have
verified that XML/Parser.pm does indeed exist in at least one place in
that PATH list. I don't understand why Perl can't find Parser.pm on
this other box when it is clearly in the PATH. Could it be that
XML/Simple.pm modifies @INC? If so, I couldn't find where... I tried
moving XML/Parser.pm to other places in the PATH, including the same
place that XML/Simple.pm exists, but still get the same error.
Here is the contents of @INC that I print out:
/usr/local/perl5.8.5/lib/site_perl/5.8.5/i686-linux
/usr/local/perl5.8.5/lib/site_perl/5.8.5
/usr/lib/perl5/vender_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0
/usr/local/perl5.8.5/lib/site_perl/5.8.5/ChartDirector
/usr/local/perl/lib/site_perl/5.8.5/i686-linux
/usr/local/perl/lib/site_perl/5.8.5
/usr/local/perl/lib/site_perl
/usr/local/perl/lib/5.8.5/i686-linux
/usr/local/perl/lib/5.8.5
/usr/local/perl/lib
/usr/local/perl5.8.5/lib/5.8.5/i686-linux
/usr/local/perl5.8.5/lib/5.8.5
/usr/local/perl5.8.5/lib/site_perl
Some places were added specifically to try to solve this problem, so
there is more than there really needs to be for now... Parser.pm exists
here:
/usr/lib/perl5/vender_perl/5.8.0/i386-linux-thread-multi/XML/Parser.pm
Any ideas?
Mark
------------------------------
Date: Fri, 15 Jul 2005 16:51:18 +0200
From: Moritz Karbach <moritz.karbach@desy.de>
Subject: Re: copy contructor
Message-Id: <db8ihi$d616$1@claire.desy.de>
>> I'm writing some code in object oriented Perl, and I'm missing a default
>> copy constructor. Are there some default workarounds?
>
> Huh? Standard OO doesn't know about copy constructors. They come
> into play with operator overloading, but even then you don't necessarily
> have to define one.
You're right. But IIRC at least C++ copies all attributes (or class members
or how you call it) of a class, if you say
Class1 object1;
Class1 object2;
/* modify members of object2... */
object1 = object2;
using the "standard copy constructor".
But nevertheless, my problem is simply the following: I've got a class with
about 50 attributes, and I need to get a exact clone of an object of this
class.
Therefore I've written a clone() method like
sub clone # ()
{
my $this = shift;
my $clone = new ClassName();
$clone->{att1} = $this->{att1};
# ...
@{$clone->{arr1}} = @{$this->{arr1}};
# ...
%{$clone->{hash1}} = %{$this->{hash1}};
return $clone;
}
Since this gets really huge and I'll also have to adjust this if I'm going
to add some new attributes, I was looking for an alternative a little more
sexy.
Cheers,
- Moritz
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 8254
***************************************