-------configuration file(MyConfigTest.pm)--
-------startup file(mystartup.pl)-------package PBB::Packages::MyConfigTest; use strict; @PBB::Packages::MyConfigTest::ISA = qw(Exporter); %PBB::Packages::MyConfigTest::stash = ( "p_type" => "text/html", "p_charset" => "UTF-8", "p_theme" => "gnome-default", "css_files" => ["aa.js", "bb.js"], ); 1;
-------my module file(ControllerTest.pm)--#!/usr/bin/perl use lib qw(/path/myprj); use strict; 1;
Regards.package PBB::ControllerTest; use vars qw($q $t); use vars qw(%stash); use Apache2::RequestIO (); use Apache2::Const -compile => ':common'; use CGI qw(); use CGI::Carp qw(fatalsToBrowser); use PBB::Packages::MyConfigTest; use Data::Dumper; use strict; *stash = \%PBB::Packages::MyConfigTest::stash; sub handler{ my $r = shift; $q = new CGI; print $q->header(); $t = {}; @{$t->{stash}}{keys %stash} = values %stash; $t->{stash}->{css_files} = [@{$t->{stash}->{css_files}}, "a.js", " +b.js"]; #other code here return Apache2::Const::OK; } 1;
In reply to Please share your advice about my mod_perl program by beckheng
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |