Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Just another Perl shrine
 
PerlMonks  

Re: Objects as arrays but with autogenerated getters + setters

by Solo (Deacon)
on Jun 26, 2006 at 17:02 UTC ( [id://557662]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Objects as arrays but with autogenerated getters + setters

You might want to look at Class::MakeMethods.

--Solo

--
You said you wanted to be around when I made a mistake; well, this could be it, sweetheart.
  • Comment on Re: Objects as arrays but with autogenerated getters + setters

Replies are listed 'Best First'.
Re^2: Objects as arrays but with autogenerated getters + setters
by tinita (Parson) on Jun 26, 2006 at 17:38 UTC
    thanks, I'll have a look at it. after a quick glance, I didn't find out how to use get_attr and set_attr method names, though.

      package Foo; use Class::MakeMethods::Template::Array ( 'new' => 'new', 'scalar' => [ -interface=> { 'get_*'=>'get', 'set_*'=>'set' }, qw/ name age city job salary /, ], ); package main; use Data::Dumper; my $foo = Foo->new(); $foo->set_name("foo"); $foo->set_age(100); warn Data::Dumper->Dump([$foo], ['foo']); print $foo->get_age,$/; $foo->set_age(23); print $foo->get_age,$/;

      --Solo

      --
      You said you wanted to be around when I made a mistake; well, this could be it, sweetheart.
        thank you so much. sometimes one needs such an example to get a starting point =)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://557662]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.