[29948] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1191 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jan 13 09:09:42 2008

Date: Sun, 13 Jan 2008 06:09:04 -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           Sun, 13 Jan 2008     Volume: 11 Number: 1191

Today's topics:
    Re: Active State perl for windows not working. <invalid@invalid.net>
    Re: Converting milliseconds to seconds <nospam-abuse@ilyaz.org>
    Re: csv data file, but with a twist <rvtol+news@isolution.nl>
        HOW TO MAKE EASY MONEY AT HOME andrewladams@gmail.com
        new CPAN modules on Sun Jan 13 2008 (Randal Schwartz)
        Objects containing objects <SteveSpamTrap@yahoo.com>
    Re: Objects containing objects <waveright@gmail.com>
    Re: Objects containing objects <mritty@gmail.com>
    Re: Objects containing objects <invalid@invalid.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sun, 13 Jan 2008 02:10:35 -0700
From: "Gerry Ford" <invalid@invalid.net>
Subject: Re: Active State perl for windows not working.
Message-Id: <1200214790_3967@sp12lax.superfeed.net>



"John Bokma" <john@castleamber.com> wrote in message 
news:Xns9A2254CB89D7castleamber@130.133.1.4...
> "Reagan Revision" <invalid@invalid.net> wrote:
>

>> I use perl as a hobby and don't face issues that
>> say, a sysadmin might.
>
> Your computer is connected to the Internet, right? In that case you might
> not care about the issues, but others connected to the Internet /do/. Most
> spam and other garbage nowadays comes from computers that got infected
> because their owner was (and still is) careless.
I disagree that spam, garbage or republicans come from others' Perl bin. 
Spam comes from England, to complement their cuisine.  Garbage comes from 
comp.lang.c.  Republicans come from AZ.

-- 

Gerry Ford

"Und es begab sich"
~ BoM, german version

3 Republican Square
251 Michigan Av.
GR, MI 49503 




------------------------------

Date: Sun, 13 Jan 2008 08:36:30 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Converting milliseconds to seconds
Message-Id: <fmciie$2svu$1@agate.berkeley.edu>

[A complimentary Cc of this posting was NOT [per weedlist] sent to
Jürgen Exner 
<jurgenex@hotmail.com>], who wrote in article <hrtio3d2mf132qo44iatbi88nhthe2gnfm@4ax.com>:
> I happen to read the NGs in which I am posting.

If you think this is enough, you know little about Usenet propagation
semantic.  (By definition: unreliable.)

> >I assure you that int() does nothing else but rounding-to-0.

> As I said: you are greatly mistaken about the intended semantic of int(). 
> You may want to read the documentation for clarification.

As I said, the existing state of documentation of Perl is, at most,
pitiful.  (If you still do not realize this, I wrote some
[significant?] part of implementation of Perl's int().  *This* is why
I feel so hurt by this bug of mine.  ;-)

Hope this helps,
Ilya


------------------------------

Date: Sun, 13 Jan 2008 13:13:43 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: csv data file, but with a twist
Message-Id: <fmd2tq.1c8.1@news.isolution.nl>

Martien Verbruggen schreef:

> while (<DATA>)
> {
>     print, next if $. == 1;
>     my @l = split /,/;
>     if (@l != 9)
>     {
> $l[1] = join " - ", @l[1 .. @l - 8];
> splice @l, 2, @l - 9;
> print join ",", @l;
>     }
>     else
> [...]
>
> __DATA__
> SKU,DESC,LIST,COST,FLAG1,FLAG2,FLAG3,RELATED,FLAG4
> 0120    ,HOOK, TAPERED ,0004.57,0002.74,N,O, ,254-72  ,001

I really like this approach, but some people wil not appreciate the
magical "9" in the code. It could be derived from the header of course.
We were told that the "3rd field always has the format XXXX.XX", so I
wrote a variant that uses that:

while (<DATA>) {
  print and next if 1 == $.;  # skip header
  chomp;
  my @data = split /,/;
  while ($data[2] !~ /^\s*[0-9]{4}[.][0-9]{2}\s*$/) {
    @data = ($data[0], "$data[1] - $data[2]", @data[3..$#data]);
  }
  /^\s|\s$/ and s/(.*)/"$1"/ for @data;  # protect extreme whitespace
  print join(",", @data), "\n";
}


A shorter variant, that removes extreme whitespace early:

while (<DATA>) {
  print and next if 1 == $.;  # skip header
  my @data = split /\s*,\s*/;
  while ($data[2] !~ /^[0-9]{4}[.][0-9]{2}$/) {
    @data = ($data[0], "$data[1] - $data[2]", @data[3..$#data]);
  }
  print join ",", @data;
}

-- 
Affijn, Ruud

"Gewoon is een tijger."



------------------------------

Date: Sat, 12 Jan 2008 21:51:59 -0800 (PST)
From: andrewladams@gmail.com
Subject: HOW TO MAKE EASY MONEY AT HOME
Message-Id: <d4a2f92f-73d4-42ca-b471-12db7ab167aa@q39g2000hsf.googlegroups.com>

A little while back, I was browsing these newsgroups, just like you

 are now, and came across an article similar to this that said you

 could make thousands of dollars within weeks with only an initial

 investment of $5.00 !  So I thought, "Yeah, right, this must be a

 scam", like most of us, but I was curious, like most of us, so I kept

 reading. Anyway, it said that you send $1.00 to each of the 5 names

 and address stated in the article. You then place your own name and

 address in the bottom of the list of #5, and post the article in at

 least 200 newsgroups.(There are thousands) No catch, that was it.



So after thinking it over, and talking to a few people first, I

thought about trying it. I figured what I have got to lose except 5

stamps and $5.00, right?



Like most of us I was a little skeptical and a little worried about

the legal aspects of it all. So I checked it out with U.S. Post

Office(1-800-725-2161) and they confirmed that it is indeed lega!

Then I invested the measly $5.00................

\\

\Well GUESS WHAT! !..... With in 7 days, I started getting money in

the mail! I was shocked! I still figured it end soon, and didn't give

it another thought. But the money just coming in. In my first week, I

made about $20.00 to $30.00 dollars. By the end of the second week I

had made total of over $1,000.00!!!!!!  In the third week I had over

$10,000.00 and it's still growing. This is now my fourth week and I

have made a total of just over $42,000.00 and it's still comming in

 .......  It's certainly worth $5.00, and 5 stamps, I spent more than

that on the lottery!!



Let me tell you how this works and most importantly, Why it works....

also, make sure you print a copy of this article NOW, so you can get

the information of it as you need it. The process is very simple and

consists of 3 easy steps :



STEP 1 : Get 5 separate pieces of paper and write the following on

each piece of paper "PLEASE PUT ME ON YOUR MAILING LIST." now get 5

$1.00 bills and place ONE inside EACH of the 5 pieces of paper so the

bill will not be seen through the envelopes to prevent thievery. Next,


place on paper in each of the 5 envelopes and seal them. You should

now have 5 sealed envelopes, each with a piece of paper stating the

above phrase and a $1.00 bill. What you are doing is creating a

service by this. THIS IS PERFECTLY LEGAL!



Mail the 5 envelopes to the following addresses :


#1  Occupant
      P.O. Box 54230
      Houston, Tx.
      77272-1193
      U.S.A.


#2  Kevin Michael
      1006 Abercorn Place
      Sherwood, AR 72120
      U.S.A.


#3   Chang
       P.O.Box 502651
       San Diego CA 92150-2651
       U.S.A.


#4   Belchior Mira
      R. Jose Dias Coelho, 7, 1 DT
      Bom-Sucesso, ALVERCA
      2615
      PORTUGAL


#5   Andrew
	801 West 24th Street Rm. 803
	Austin, TX 78705
	U.S.A.


STEP 2 : Now take the #1 name off the list that you see above, move

the other names up ( 5 becomes 4, 4 becomes 3, etc...) and add YOUR

Name as number 5 on the list.



STEP 3 : Change anything you need to, but try to keep this article as

close to original as possible. Now, post your mended article to at

least 200 newsgroups. (I think there are close to 18,000 groups) All

you need is 200, but remember, the more you post, the more money you

make! Don't know How post in the newsgroups? Well do exactly the

following :



FOR NETSCAPE USERS,


     1) Click on any newsgroups, like normal. Then click on "To News",


which is in the top left corner of the newsgroups page. This will

bring up a message box.


     2) Fill in the SUBJECT with a flashy title, like the one I used,

something to catch the eye!!!


     3) Now go to the message part of the box and retype this letter

exactly as it tis here, with exception of your few changes. (remember

to add your name to number 5 and move the rest up)


     4) When you're done typing in the WHOLE letter, click on 'FILE'

above the send button. Then, 'SAVE AS..' DO NOT SEND YOUR ARTICLE

UNTIL YOU SAVE IT. (so you don't have to type this 200 times :-)


     5) Now that you have saved the letter, go ahead and send your

first copy! (Click the 'SEND' button in the top left corner)


     6) This is where you post all 200! OK, go to ANY newsgroup

article and click the 'TO NEWS' button again. Type in your flashy

subject in the 'SUBJECT BOX', then go to the message and place your

cursor here. Now click on 'ATTACHMENT' which is right below the

'SUBJECT BOX'. Click on attach file then find your letter wherever you


saved it. Click once on your file then click 'OPEN' then click 'OK'.

If you did this right, you should see your filename in the 'ATTACHMENT


BOX' and it will be shaded.

 NOW POST AWAY!!




IF YOU'RE USING INTERNET EXPLORER :


     It's just as easy, holding down the left mouse button, highlight

this entire article, then press the 'CTRL' key and 'C' key at the same


time to copy this article. Then print the article for your records to

have the names of those you will be sending $1.00 to.


     Next, go to the newsgroups and press 'POST AN ARTICLE' type in

your flashy subject and click the large window below. Press 'CTRL' and


'V' and the article will appear in the message window. **BE SURE TO

MAKE YOUR ADDRESS CHANGES TO THE 5 NAMES.**. Now re-highlight the

article andre-copy it so you have the changes..... then all you have

to do for each newsgroups is 'CTRL' and 'V' and press 'POST'. It's

that easy!!!



THAT'S IT! ALL you have to do is jump to different newsgroups and post


away, after you get the hang of it, it will take about 30 seconds for

each newsgroup!  **REMEMBER, THE MORE NEWSGROUPS YOU POST IN, THE MORE


MONEY YOU WILL MAKE!! BUT YOU HAVE TO POST A MINIMUM OF 200 **



That's it! you will begin receiving money from around the world within


day's! You may eventually want to rent a P.O.Box due to the large

amount of mail you receive. If you wish to stay anonymous, you can

invent a name to use, as long as the postman will deliver it.  ** JUST


MAKE SURE ALL THE ADDRESS ARE CORRECT. **



Now the WHY part :

     Out of 200 postings, say I receive only 5 replies (a very low

example). So then I made $5.00 with my name at #5 on the letter. Now,

each of the 5 persons who just sent me $1.00 make the MINIMUM 200

postings, each with my name at #4 and only 5 persons respond to each

of the original 5, that is another $25.00 for me, now those 25 each

make 200 MINIMUM postings with my name at #3 and only 5 replies each,

I will bring in an additional $125.00! Now, those 125 persons turn

around and post the MINIMUM 200 with my name at #2 and only receive 5

replies each, I will make an additional $625.00! OK, now here is the

fun part, each of those 625 persons post a MINIMUM 200 letters with my


name #1 and the each only receive 5 replies, that just made me

$3,125.00!!! With a original investment of only $5.00! AMAZING! And as


I said 5 respones is actually VERY LOW! Average is probable 20 to 30!

So lets put those figures at just 15 responses per person. Here is

what you will make :


     at #5  $15.00

     at #4  $225.00

     at #3  $3,375.00

     at #2  $50,625.00

     at #1  $759,375.00



When your name is no longer on the list, you just take the latest

posting in the newsgroups, and send out another $5.00 to names on the

list, putting your name at number 5 again. And start posting again.

the thing to remember is, do you realize that thousands of people all

over the world are joining the internet and reading these articles

everyday, JUST LIKE YOU are now!! So can you afford $5.00 and see if

it really works?? I think so...  People have said, "What if the plan

is played out and no one sends you the money? So what! What are the

chances of that happening when there are tons of new honest users and

new honest people who are joining the internet and newsgroups everyday


and are willing to give it a try? Estimates are at 20,000 to 50,000

new users, every day, with thousands of those joining the actual

internet. Remember, play FAIRLY and HONESTLY and this will work. You

just have to be honest. Make sure you print this article out RIGHT

NOW, also. Try to keep a list of everyone that sends you money and

always keep an eye on the newsgroups to make sure everyone is playing

fairly. Remember, HONESTY IS THE BEST POLICY. You don't need to cheat

the basic idea to make the money!!



GOOD LUCK to all and please play fairly and reap the huge rewards from


this, which is tons of extra CASH.  ** By the way, if you try to

deceive people by posting the message with your name in the list and

not sending the money to the rest of the people already on the list,

you will NOT get as much. Someone I talked to knew someone who did

that and he only made about $150.00, and that's after seven or eight

weeks! Then he sent the 5 $1.00 bills, people added him to their

lists, and in 4-5 weeks he had over $10k. This is the fairest and most


honest way I have ever seen to share the wealth of the world with

costing anything but our time!!! You also may want to but mailing and

e-mail lists for future dollars.



Please remember to declare your extra income. Thanks once again....


------------------------------

Date: Sun, 13 Jan 2008 05:42:16 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sun Jan 13 2008
Message-Id: <JuKIIG.15u2@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Acme-JavaTrace-0.07
http://search.cpan.org/~saper/Acme-JavaTrace-0.07/
Module for using Java-like stack traces 
----
Acme-MetaSyntactic-daleks-1.02
http://search.cpan.org/~saper/Acme-MetaSyntactic-daleks-1.02/
EXTERMINATE! EXTERMINATE! EXTERMINATE! 
----
BSD-Getfsent-0.15
http://search.cpan.org/~schubiger/BSD-Getfsent-0.15/
Get file system descriptor file entry 
----
CPAN-Dependency-0.12
http://search.cpan.org/~saper/CPAN-Dependency-0.12/
Analyzes CPAN modules and generates their dependency tree 
----
Cache-Memcached-LibMemcached-0.00001
http://search.cpan.org/~dmaki/Cache-Memcached-LibMemcached-0.00001/
Perl Interface to libmemcached 
----
Cache-Memcached-LibMemcached-0.00002
http://search.cpan.org/~dmaki/Cache-Memcached-LibMemcached-0.00002/
Perl Interface to libmemcached 
----
Catalyst-Plugin-Scheduler-0.08
http://search.cpan.org/~agrundma/Catalyst-Plugin-Scheduler-0.08/
Schedule events to run in a cron-like fashion 
----
Catalyst-View-TT-0.26
http://search.cpan.org/~mramberg/Catalyst-View-TT-0.26/
Template View Class 
----
CatalystX-Foorum-0.1.2
http://search.cpan.org/~fayland/CatalystX-Foorum-0.1.2/
Forum/BBS system based on Catalyst 
----
Config-Pit-0.03
http://search.cpan.org/~satoh/Config-Pit-0.03/
Manage settings 
----
Coro-4.35
http://search.cpan.org/~mlehmann/Coro-4.35/
coroutine process abstraction 
----
DBD-Oracle-1.20
http://search.cpan.org/~pythian/DBD-Oracle-1.20/
Oracle database driver for the DBI module 
----
Data-FeatureFactory-0.01
http://search.cpan.org/~sixtease/Data-FeatureFactory-0.01/
evaluate features normally or numerically 
----
Data-FeatureFactory-0.02
http://search.cpan.org/~sixtease/Data-FeatureFactory-0.02/
evaluate features normally or numerically 
----
Data-FeatureFactory-0.03
http://search.cpan.org/~sixtease/Data-FeatureFactory-0.03/
evaluate features normally or numerically 
----
Data-Libra-0.0.4
http://search.cpan.org/~hiratara/Data-Libra-0.0.4/
Generates unique and random values from a string. 
----
Date-Simple-3.03_03
http://search.cpan.org/~izut/Date-Simple-3.03_03/
a simple date object 
----
Devel-DTrace-0.07
http://search.cpan.org/~andya/Devel-DTrace-0.07/
Enable dtrace probes for subroutine entry, exit 
----
Devel-SimpleTrace-0.07
http://search.cpan.org/~saper/Devel-SimpleTrace-0.07/
See where you code warns and dies using stack traces 
----
Device-USB-MissileLauncher-RocketBaby-1.01
http://search.cpan.org/~pen/Device-USB-MissileLauncher-RocketBaby-1.01/
interface to toy missile launchers from Dream Cheeky 
----
FCGI-Engine-0.01
http://search.cpan.org/~stevan/FCGI-Engine-0.01/
A flexible engine for running FCGI-based applications 
----
FCGI-Engine-0.02
http://search.cpan.org/~stevan/FCGI-Engine-0.02/
A flexible engine for running FCGI-based applications 
----
Finance-PremiumBonds-0.01
http://search.cpan.org/~bigpresh/Finance-PremiumBonds-0.01/
Perl extension to check Premium Bond holder's numbers 
----
Games-BonDigi-0.01
http://search.cpan.org/~cosimo/Games-BonDigi-0.01/
----
HTML-Template-Compiled-Filter-Whitespace-0.04
http://search.cpan.org/~steffenw/HTML-Template-Compiled-Filter-Whitespace-0.04/
whitespace filter for HTML output 
----
Handel-1.00009
http://search.cpan.org/~claco/Handel-1.00009/
A cart/order/checkout framework with AxKit/TT/Catalyst support 
----
IO-Socket-SSL-1.12_1
http://search.cpan.org/~sullr/IO-Socket-SSL-1.12_1/
Nearly transparent SSL encapsulation for IO::Socket::INET. 
----
LEOCHARRE-Database-1.12
http://search.cpan.org/~leocharre/LEOCHARRE-Database-1.12/
common database methods for oo 
----
Locale-SubCountry-1.40
http://search.cpan.org/~kimryan/Locale-SubCountry-1.40/
convert state, province, county etc. names to/from code 
----
Mango-0.01000_08
http://search.cpan.org/~claco/Mango-0.01000_08/
An ecommerce solution using Catalyst, Handel and DBIx::Class 
----
Math-Complex-1.44
http://search.cpan.org/~jhi/Math-Complex-1.44/
complex numbers and associated mathematical functions 
----
Metadata-ByInode-1.17
http://search.cpan.org/~leocharre/Metadata-ByInode-1.17/
Extend metadata in relation to file's inode using a database. 
----
Metadata-DB-1.06
http://search.cpan.org/~leocharre/Metadata-DB-1.06/
----
MooseX-Object-Pluggable-0.0006
http://search.cpan.org/~groditi/MooseX-Object-Pluggable-0.0006/
Make your classes pluggable 
----
P2P-Transmission-0.01
http://search.cpan.org/~bgilmore/P2P-Transmission-0.01/
Interface to the Transmission BitTorrent client 
----
P2P-Transmission-0.02
http://search.cpan.org/~bgilmore/P2P-Transmission-0.02/
Interface to the Transmission BitTorrent client 
----
P2P-Transmission-0.03
http://search.cpan.org/~bgilmore/P2P-Transmission-0.03/
Interface to the Transmission BitTorrent client 
----
POE-Component-Server-Echo-1.56
http://search.cpan.org/~bingos/POE-Component-Server-Echo-1.56/
A POE component that implements an RFC 862 Echo server. 
----
POE-Component-WWW-Search-Mininova-0.01
http://search.cpan.org/~zoffix/POE-Component-WWW-Search-Mininova-0.01/
non-blocking POE wrapper for WWW::Search::Mininova 
----
Parley-0.58_12
http://search.cpan.org/~chisel/Parley-0.58_12/
Message board / forum application 
----
Parse-Marpa-0.001_070
http://search.cpan.org/~jkegl/Parse-Marpa-0.001_070/
(pre-Alpha) Jay Earley's general parsing algorithm, with LR(0) precomputation 
----
Perl6-Doc-0.34_1
http://search.cpan.org/~lichtkind/Perl6-Doc-0.34_1/
all useful Perl 6 Docs in your command line 
----
RT-Client-Console-0.0.5
http://search.cpan.org/~dams/RT-Client-Console-0.0.5/
Text based RT console 
----
Regexp-CharClasses-1.2
http://search.cpan.org/~abigail/Regexp-CharClasses-1.2/
Provide character classes 
----
Sledge-Request-Apache-I18N-0.02
http://search.cpan.org/~horiuchi/Sledge-Request-Apache-I18N-0.02/
----
Text-Markdown-1.0.5
http://search.cpan.org/~bobtfish/Text-Markdown-1.0.5/
----
Tk-Bounded-1.0
http://search.cpan.org/~dmpetit/Tk-Bounded-1.0/
Base class for widgets derived and bound binded from others 
----
Video-PlaybackMachine-0.06
http://search.cpan.org/~stephen/Video-PlaybackMachine-0.06/
Perl extension for creating a television station 
----
Video-Xine-0.12
http://search.cpan.org/~stephen/Video-Xine-0.12/
Perl interface to libxine 
----
WWW-Bebo-API-0.0.01
http://search.cpan.org/~clscott/WWW-Bebo-API-0.0.01/
Bebo API implementation 
----
WWW-Myspace-Data-0.16
http://search.cpan.org/~oalders/WWW-Myspace-Data-0.16/
WWW::Myspace database interaction 
----
WWW-Myspace-FriendAdder-0.16
http://search.cpan.org/~oalders/WWW-Myspace-FriendAdder-0.16/
Interactively add friends to your Myspace account 
----
WWW-Search-Mininova-0.02
http://search.cpan.org/~zoffix/WWW-Search-Mininova-0.02/
Interface to www.mininova.org Torrent site 
----
WWW-Search-Mininova-0.03
http://search.cpan.org/~zoffix/WWW-Search-Mininova-0.03/
Interface to www.mininova.org Torrent site 
----
WWW-Zorpia-Upload-0.04
http://search.cpan.org/~fayland/WWW-Zorpia-Upload-0.04/
upload photos to www.zorpia.com 
----
WebService-LastFM-0.04
http://search.cpan.org/~kentaro/WebService-LastFM-0.04/
Simple interface to Last.FM Web service API 
----
YAML-Tiny-1.24_01
http://search.cpan.org/~adamk/YAML-Tiny-1.24_01/
Read/Write YAML files with as little code as possible 
----
warnings-compat-0.06
http://search.cpan.org/~saper/warnings-compat-0.06/
warnings.pm emulation for pre-5.6 Perls 


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


------------------------------

Date: Sun, 13 Jan 2008 00:53:13 -0500
From: Steve <SteveSpamTrap@yahoo.com>
Subject: Objects containing objects
Message-Id: <5utna2F1ioi07U1@mid.individual.net>

	I have a class that takes in an object in its constructor, and stores 
it as a member variable as follows:

# INSIDE CONSTRUCTOR
 ...
$self->{MY_OBJECT} = shift;
 ...


	I can make calls to this member object's methods inside the 
constructor, and they work fine:

 ...
print $self->{MY_OBJECT}->myMethod();
 ...


	I have a getter method in this top-level object that returns the member 
object:

sub getMyObject {
	my $self = shift;
	return $self->{MY_OBJECT};
}


	However, when other code retrieves this object using the getter method, 
it is unable to make method calls against that object.  For example, 
this code:

$topObject->getMyObject()->myMethod();

	... generates an error message like this:

Can't call method "myMethod" without a package or object reference at 
myScript.pl line 30.


	Can anyone point me in the right direction as to what I might be 
missing here?  Thanks in advance!


------------------------------

Date: Sun, 13 Jan 2008 03:02:15 -0800 (PST)
From: Todd Wade <waveright@gmail.com>
Subject: Re: Objects containing objects
Message-Id: <4b92486b-dd1d-4e36-b24f-94ab68ccb84e@21g2000hsj.googlegroups.com>

On Jan 13, 2:53=A0pm, Steve <SteveSpamT...@yahoo.com> wrote:
> =A0 =A0 =A0 =A0 I have a getter method in this top-level object that retur=
ns the member
> object:
>
> sub getMyObject {
> =A0 =A0 =A0 =A0 my $self =3D shift;
> =A0 =A0 =A0 =A0 return $self->{MY_OBJECT};
>
> }
>
> =A0 =A0 =A0 =A0 However, when other code retrieves this object using the g=
etter method,
> it is unable to make method calls against that object. =A0For example,
> this code:
>
> $topObject->getMyObject()->myMethod();
>
> =A0 =A0 =A0 =A0 ... generates an error message like this:
>
> Can't call method "myMethod" without a package or object reference at
> myScript.pl line 30.
>
> =A0 =A0 =A0 =A0 Can anyone point me in the right direction as to what I mi=
ght be
> missing here? =A0Thanks in advance!

What you're trying to do works fine so I'm guessing you aren't really
returning the marshalled object from getMyObject. This code works
fine:

use warnings;
use strict;

package MyObject;

sub new {
  my $class =3D shift;
  bless { }, $class;
}

sub myMethod {
  print "called me!\n";
}

package MyProxy;

sub new {
  my $class =3D shift;
  bless { MY_OBJECT =3D> shift }, $class;
}

sub getMyObject { shift->{MY_OBJECT} }

package main;

my $proxy =3D MyProxy->new( MyObject->new );

prints "called me!" to STDOUT
$proxy->getMyObject->myMethod;


------------------------------

Date: Sun, 13 Jan 2008 04:39:51 -0800 (PST)
From: Paul Lalli <mritty@gmail.com>
Subject: Re: Objects containing objects
Message-Id: <8a150dc2-d2a1-4441-b845-a4c7b2ef5bb0@i12g2000prf.googlegroups.com>

On Jan 13, 12:53=A0am, Steve <SteveSpamT...@yahoo.com> wrote:
> =A0 =A0 =A0 =A0 I have a class that takes in an object in its constructor,=
 and stores
> it as a member variable as follows:
>
> # INSIDE CONSTRUCTOR
> ...
> $self->{MY_OBJECT} =3D shift;
> ...
>
> =A0 =A0 =A0 =A0 I can make calls to this member object's methods inside th=
e
> constructor, and they work fine:
>
> ...
> print $self->{MY_OBJECT}->myMethod();
> ...
>
> =A0 =A0 =A0 =A0 I have a getter method in this top-level object that retur=
ns the member
> object:
>
> sub getMyObject {
> =A0 =A0 =A0 =A0 my $self =3D shift;
> =A0 =A0 =A0 =A0 return $self->{MY_OBJECT};
>
> }
>
> =A0 =A0 =A0 =A0 However, when other code retrieves this object using the g=
etter method,
> it is unable to make method calls against that object. =A0For example,
> this code:
>
> $topObject->getMyObject()->myMethod();
>
> =A0 =A0 =A0 =A0 ... generates an error message like this:
>
> Can't call method "myMethod" without a package or object reference at
> myScript.pl line 30.
>
> =A0 =A0 =A0 =A0 Can anyone point me in the right direction as to what I mi=
ght be
> missing here? =A0Thanks in advance!

Somewhere between assigning to $self->{MY_OBJECT} and returning $self-
>{MY_OBJECT}, you've changed it.  It's no longer an object.

I suggest you use Data::Dumper to figure out what $self actually
contains in the getMyObject subroutine, and then trace through your
code to figure out where you went wrong.

I also suggest you read the posting guidelines, which will instruct
you to (among other things) post a short-but-complete program to
post.  Reducing your code to such a short-but-complete program often
reveals the answer directly.

Paul Lalli


------------------------------

Date: Sun, 13 Jan 2008 05:46:02 -0700
From: "Reagan Revision" <invalid@invalid.net>
Subject: Re: Objects containing objects
Message-Id: <1200227716_4041@sp12lax.superfeed.net>


"Todd Wade" <waveright@gmail.com> wrote in message 
news:4b92486b-dd1d-4e36-b24f-94ab68ccb84e@21g2000hsj.googlegroups.com...
On Jan 13, 2:53 pm, Steve <SteveSpamT...@yahoo.com> wrote:
> I have a getter method in this top-level object that returns the member
> object:
>
> sub getMyObject {
> my $self = shift;
> return $self->{MY_OBJECT};
>
> }
>
> However, when other code retrieves this object using the getter method,
> it is unable to make method calls against that object. For example,
> this code:
>
> $topObject->getMyObject()->myMethod();
>
> ... generates an error message like this:
>
> Can't call method "myMethod" without a package or object reference at
> myScript.pl line 30.
>
> Can anyone point me in the right direction as to what I might be
> missing here? Thanks in advance!

What you're trying to do works fine so I'm guessing you aren't really
returning the marshalled object from getMyObject. This code works
fine:

use warnings;
use strict;

package MyObject;

sub new {
  my $class = shift;
  bless { }, $class;
}

#snip
I can't find this syntax anywhere.  Not only am I weak on what shift does, 
but also with the bless, followed by the curly braces.  What happens with 
this sub?


-- 
Reagan Revision

"We are being told that a competent, trustworthy president is someone
who brandishes his religion like a neon sign, loads a gun and goes out
hunting for beautiful winged creatures, and tries to imitate a past
president who, by the way, never shot a bird or felt the need to imitate
anybody."

~~  Patti Davis Is Not Flattered by GOP Candidates' Pale Imitations of
Her Father



----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----


------------------------------

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 V11 Issue 1191
***************************************


home help back first fref pref prev next nref lref last post