Sistren and Brethren,
This is one of those moments where you're thinking of solutions so fast that you can't seem to get out enough brain swallows to understand what it is you're thinking. Here's my issue:
-I've got a base class that lives at ClientName::SupplySite;
-I'm using it in a CGI environment and what it does is setup my $query = new CGI, database connection, and set's a few other variables;
-I'm going to have ClientName::SupplySite::POSearch and I'd like POSearch methods to have access to the internal data structures created from my constructor in ClientName::SupplySite;
-I'd sort of like to be able to do the following whenever I need something from a subclass:
my $ss = new ClientName::SupplySite;
my %searchResult = $scc->POSearch->search('supplier', 'foo');
But really not really; I really just want to be able to have access to subclass methods in a convenient way, with them having access to ClientName::SupplySite's $self hash
I'm not interested in the funky stuff in the second line of code there. I've considered making ClientName::SupplySite inherit from it's subclasses, but the down side is that there will probably be multiple sublclasses with methods of the same name. Then I thought about including some magic dust in ClientName::SupplySite the get it to DTRT and
new the appropriate subclass when needed so that I'm not loading extra packages for scripts that don't need them. But in the code example above would the
search method be fed the $self from the constructor? Yes it would methinks. Maybe I just answered my own question. Everyone, my knowledge of object orientation is spotty.
Pardon my incoherency,
dpatrick
- I think
scsh is cool.
Open Sourceror, Perlmonk
http://perlmonk.org/~dpatrick
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
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:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.