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:
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;
Wouldn't you want $obj1->bar
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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
Outside of code tags, you may need to use entities for some characters:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||