Ok here's my problem. I want to 10 different model classes to inherit from
the same base class. And be able to use the base classes " : Exported "
methods.

so my current set up was.

MyApp::CarLoan
use base qw(Maypole::Model::CDBI);

MyApp::MortgageLoan
use base qw(Maypole::Model::CDBI);

MyApp::PersonalLoan
use base qw(Maypole::Model::CDBI);

Ok so I figured all these classes have the same basic funtions let me pull
that out.

so I tried to make an outside package that wasn't in the MyApp namespace. I
just wanted to create a package that wasn't in the MyApp namespace. I'm
thinking this is my first mistake. (I did this becuase ::MyApp:Loan is a
table in my database that holds data on all the loans, not specific to any
one type.)

MyPackage::Loan
use base qw(Maypole::Model::CDBI);

sub apr :Exported {
    my ($class, $r) = @;

   # &clean_classs_name routine just seperates "MyApp::ModelClass" into
"MyApp" and "ModelClass" and
   # returns "ModelClass".

    my $template = "&clean_class_name($class)" . "/apr";

    $r->template($template); # so the template is "ModelClass/tmp" i.e
"CarLoan/tmp"
}

sub balance :Exported {...}

.....

And then I ...

MyApp::CarLoan
use base qw(MyPackage::Loan)





When I try to use the url I like http://~/myapp/CarLoan/apr

is_public failed . action is apr. self is MyApp::CarLoan at /usr/local/
lib/perl5/site_perl/5.8.8/Maypole/Model/Base.pm line 206, <GEN8> line 3.

So what I want to do is basically create a base model class that my other
model classes can inherit from.

Or lets say I just wanted to inherit from an exisiting class. Is there a way
to have the existing functions :Exported without writing fowarding functions
for all of them?

So ..

MyApp::CarLoan
use base qw(M::M::CDBI Finance:::Loan);

then in a template
[% use carloan =  Class(MyApp::CarLoan) %]
[% carloan.getmonthlypayments%]


or would I have to write some type of accessor for getmonthlypayments

sub getmonthlypayments :Exported {
    my $class  = shift;
    $class->getmonthlypayments;
}

Hopefully you guys understand what I'm getting at. I'm not exactly a
programmer. So this is kicking my butt.

Thanks,

Chris




-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Maypole-users mailing list
Maypole-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/maypole-users

Reply via email to