Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Object Oriented configuration values

by blokhead (Monsignor)
on Feb 10, 2003 at 06:45 UTC ( #234035=note: print w/replies, xml ) Need Help??

in reply to Object Oriented configuration values

I see a few strange things, but it could be because I don't completely understand what kind of objects these are supposed to be. Are they just an OOP wrapper API to these config files, or do they have other purposes? It seems like you're trying to have accessors defined on a per-object basis (you (re)generate the accessors every time the new method is called). But you create these accessors on a per-class basis, and all of your objects are of the same class. Do you only ever instantiate one of these OurApp objects per execution of your app?

The way I understand it, I could write the following:

use OurApp; my $obj1 = OurApp->new(conf_file => 'conf1'); my $obj2 = OurApp->new(conf_file => 'conf2'); # can use both foo and bar accessors on BOTH objects print $obj1->foo, $obj1->bar; print $obj2->foo, $obj2->bar; __END__ conf1 contains: foo=1 conf2 contains: bar=1
Wouldn't you want $obj1->bar and $obj2->foo to give an error like Can't locate object method "bar" via package "OurApp"? It won't happen if the OurApp namespace has been given both methods. Of course, if you don't plan on having multiple OurApp objects around this isn't a problem.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://234035]
[ambrus]: "could evacuate to open schoolyard and then call or go back to school" => wait what? like power cycling the school building by removing all the kids and then reentering them? how would that fix the problems?
[ambrus]: https://www.xkcd. com/723/ is relevant about earthquakes and phones

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (10)
As of 2017-01-18 12:38 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (161 votes). Check out past polls.