in reply to Object Oriented configuration values
The way I understand it, I could write the following:
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.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
blokhead
|
---|