Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I was thinking about just doing the parts something like:
And then accessing category-related subs like MyScript::Categories::Add, etc. but I've noticed it's rather a pain to do it that way. So then I thought of doing something like:package MyScript::Categories; sub MainPage { ...main categories page... } sub Add { ...add categories page... } ..etc..
Then I was thinking I could access my library subs through $library and review-related subs through $reviews anywhere in the script.my $ms = new MyScript; # this would go up at the top package MyScript; sub new { my $class = shift; our $library = new MyScript::Library; our $reviews = new MyScript::Reviews; bless {}, $class; } package MyScript::Library; sub new { my $class = shift; bless {}, $class; } # all library subs go here package MyScript::Reviews; sub new { my $class = shift; bless {}, $class; } # all subs related to reviews go here
I'm not sure how either of the two OO strategies will handle with lots of code and such so I was hoping my fellow monks could give me some suggestions. These two designs might even be too poor to use in the long run so please, please point me in the right direction :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Best OOP strategy?
by DamnDirtyApe (Curate) on Aug 16, 2002 at 04:50 UTC | |
|
Re: Best OOP strategy?
by djantzen (Priest) on Aug 16, 2002 at 04:33 UTC | |
|
Re: Best OOP strategy?
by Ryszard (Priest) on Aug 16, 2002 at 12:51 UTC | |
|
Re: Best OOP strategy?
by Zaxo (Archbishop) on Aug 16, 2002 at 06:31 UTC | |
|
Re: Best OOP strategy?
by BUU (Prior) on Aug 16, 2002 at 04:20 UTC | |
|
Re: Best OOP strategy?
by agentv (Friar) on Aug 16, 2002 at 20:54 UTC | |
|
Re: Best OOP strategy?
by thunders (Priest) on Aug 16, 2002 at 18:41 UTC | |
|
Re: Best OOP strategy?
by Spudnuts (Pilgrim) on Aug 16, 2002 at 17:25 UTC |