I have 3 websites that have been running off a proprietary mod_perl2 framework that I've been trying to standardize for eventual public distribution. ( and to answer some questions preemptively: I started work on this long before catalyst or jifty were around , when tt and mason were the only viable options )

Right now I'm trying to standardize a behavior in the dispatch class. I'm hoping someone can offer advice

The framework works pretty much like this:

Each instance of MyApp::PageController (ie: MyApp1 , MyApp2 ) has the following 2 vars:

Modules can register themselves on startup to allow uploads or a 'fatter' max upload than default via a Getter+Setter method , and the first stage of every MyApp handler call is to build an ApacheRequest object using the information stored in the MyApp::PageController class.

My problem is:

Under the current design of the framework, the modules register against URI_enabled_fat/URI_enabled_upload as class variables, not object instance variables. Because of that, I have the getter/setter methods implemented in each MyApp::PageController class -- not in P2XLP::PageController-- I also have the function to build an ApacheRequest object in there too.

The issue is with migrating the getter/setters and builder into P2XLP::PageController -- I can't imagine any other way of accomplishing this other than an eval, which I try to avoid at all costs.

Can someone suggest a way to move the getter/setter/builder into the P_2XLP namespace, and still have it access the MyApp namespace for vars and calls efficiently and without using evals ?

Basically, I want to keep roughly this syntax:

package MyApp; my $aprObject= MyApp::PageController::build_apr_object(); package MyApp::Page::PhotoUpload; MyApp::PageController::register_enable_upload('/my/photos/upload'); MyApp::PageController::register_enable_fat('/my/photos/upload',100_000 +);
but i want the functions and vars to be maintained here:
package MyApp::PageController; our (%URI_enabled_fat , %URI_enabled_upload); package P_2XLP::PageController; sub register_enable_upload{}; sub register_enable_fat{}; sub build_apr_object{};

I have no idea how to accomplish this in a logical way -- or even if its possible. what I'm trying to do is very counter-intuitive to many 'better' programming paradigms. Unfortunately, my design requirement is to maintain the variables as package/class variables within the subclass, while maintaing the functions in the super class.

If anyone can offer suggestions, I'd be very appreciative.


In reply to Need help migrating functionality from subclass to super class by 2xlp

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.