[Pdx-pm] I think that I'm trying to make things too hard.

benh ben.hengst at gmail.com
Mon Oct 23 21:59:55 PDT 2006


So I'm building a small site for a client. Durring the process I
started playing with the idea that every page is a module, there are
some that just needed to be text, others that needed to do things.
Though, things didn't go as easily as I would have liked, and I ended
up going about things the longer way to make it all go. But I was
wondering if there was a cleaner/better way of doing this.

The crux of things is that I am attempting to use a var to call these
module/pages. So I was hopeing for something along the lines of:

my $action=CGI::param('action');
$data->{'body'}=local::$action::generate_page_data();

problem is that I get a 'bad name after local::' error.

So my second go was to use require, and then just call
generate_page_data(). But it looks like require doesn't append to name
space the way use does so I keep getting undefined subroutine
&main::generate_page_data();

so in the end I just ditched things and built subs in page and called
them... it works but its not as elegant as I would like it to be....
so I'm tossing this out to the group. How would you have solved this
kinda problem? Is my thinking off? I think that it's an idea that I
want to take another stab at but just looking for some input.

thanks
-- 
benh~


More information about the Pdx-pm-list mailing list