I've created a "/mason/subroutine.mas" mason file that I want to keep all my subroutines in.
I also want to share these subroutines with all the subcomponents.
I'm declaring this in my autohandler.

What is the proper way to do this?

I'm getting this error:
Error during compilation of /www/htdocs/autohandler:
syntax error at /www/htdocs/autohandler line 106, near "return"
syntax error at /www/htdocs/autohandler line 112, near "}"



Trace begun at /usr/lib/perl5/site_perl/5.8.8/HTML/Mason/Interp.pm line 845
HTML::Mason::Interp::_compilation_error('HTML::Mason::Interp=HASH(0x94e5ecc)', '/www/htdocs/autohandler', 'Error during compilation of :^Jsyntax error at /www/htdocs/autohandler line 106, near "return"^Jsyntax error at /www/htdocs/autohandler line 112, near "}"^J^J^JStack:^J [/usr/lib/perl5/site_perl/5.8.8/HTML/Mason/Interp.pm:441]^J [/usr/lib/perl5/site_perl/5.8.8/HTML/Mason/Interp.pm:767]^J [/usr/lib/perl5/site_perl/5.8.8/HTML/Mason/Component.pm:328]^J [/usr/lib/perl5/site_perl/5.8.8/HTML/Mason/Request.pm:422]^J') called at /usr/lib/perl5/site_perl/5.8.8/HTML/Mason/Interp.pm line 445 HTML::Mason::Interp::load('HTML::Mason::Interp=HASH(0x94e5ecc)', '/autohandler') called at /usr/lib/perl5/site_perl/5.8.8/HTML/Mason/Interp.pm line 767 HTML::Mason::Interp::find_comp_upwards('HTML::Mason::Interp=HASH(0x94e5ecc)', '/admin/users', 'autohandler') called at /usr/lib/perl5/site_perl/5.8.8/HTML/Mason/Component.pm line 328 HTML::Mason::Component::parent('HTML::Mason::Component::FileBased=HASH(0x9bc13b0)') called at /usr/lib/perl5/site_perl/5.8.8/HTML/Mason/Request.pm line 422
eval {...} at /usr/lib/perl5/site_perl/5.8.8/HTML/Mason/Request.pm line 411
HTML::Mason::Request::exec('HTML::Mason::Request::ApacheHandler=HASH(0x9bc1e18)') called at /usr/lib/perl5/site_perl/5.8.8/HTML/Mason/ApacheHandler.pm line 168 HTML::Mason::Request::ApacheHandler::exec('HTML::Mason::Request::ApacheHandler=HASH(0x9bc1e18)') called at /usr/lib/perl5/site_perl/5.8.8/HTML/Mason/ApacheHandler.pm line 826 HTML::Mason::ApacheHandler::handle_request('HTML::Mason::ApacheHandler=HASH(0x93c5df8)', 'Apache=SCALAR(0x93acf14)') called at (eval 33) line 8 HTML::Mason::ApacheHandler::handler('HTML::Mason::ApacheHandler', 'Apache=SCALAR(0x93acf14)') called at /dev/null line 0
eval {...} at /dev/null line 0

In my authoandler I have:

<%shared>
<& /mason/subroutines.mas &>
</%shared>

And my /mason/subroutines.mas looks like:

<%perl>
   sub printDropdownMenu {

my ( $id_column, $id_name_column, $selected_id, $table, $html_element_name ) = @_;

   my $SQL = "SELECT $id_column, $id_name_column FROM $table";

   my $hash_ref = $dbh->selectall_hashref($SQL, "$id_column");

   my $values_list = [ sort(keys(%$hash_ref)) ];
my $labels_href = { map {$_->{"$id_column"} => $_->{"$id_name_column"}} values(%$hash_ref) };

   print $cgi->popup_menu(-name=>"$html_element_name",
                                           -values=>$values_list,
                                           -labels=>$labels_href,
                                           -default=>$selected_id);

   }
</%perl>


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Mason-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to