upgrade pain
Sphinx 0.9.8 is out. but I think I would upgrade it after 1 week or more.
upgrade is painful.
Thanks.
Perl is not the whole part of life. I know!
my $ad = DBICx::AutoDoc->new(Full code can be found in http://foorum.googlecode.com/svn/trunk/bin/misc/dbicx_autodoc.pl
schema => 'Foorum::Schema',
output => File::Spec->catdir($Bin, '..', '..', 'docs'),
);
# rewrite the Schema pm POD
use Template;
my $tt2 = Template->new( { INCLUDE_PATH => $ad->include_path, POST_CHOMP => 0, PRE_CHOMP => 0 } );
my $vars = $ad->get_vars;
# first get the lists of all Foorum::Schema pm files
my @sources = @{ $vars->{sources} };
foreach my $source (@sources) {
my $class = $source->{class}; # Foorum::Schema::User
# make file dir
my @parts_of_modules = split('::', $class);
$parts_of_modules[-1] .= '.pm';
my $file_dir = File::Spec->catfile( $Bin, '..', '..', 'lib', @parts_of_modules );
my $output;
$tt2->process('pod.html', { source => $source }, \$output)
|| die $tt2->error(), "\n";
# replace POD in real module
open(my $fh, '<', $file_dir);
local $/ = undef;
my $in = <$fh>;
close($fh);
my ($code, $pod) = split(/\n1;\n/, $in);
open(my $fh2, '>', $file_dir);
print $fh2 "$code\n1;\n__END__\n\n$output\n";
close($fh2);
print "working on $class\n";
}
Labels: Foorum
Labels: Foorum
Labels: Foorum
sub test : Local {
my ($self, $c) = @_;
my $test = {
a => $c->req->param('a'),
b => $c->req->param('b'),
c => $c->req->param('c'),
};
$c->res->body(Dumper(\$test));
} then try to visit test?b=1, guess what we get? that's not what we expected. $VAR1 = \{
'1' => 'c',
'a' => 'b'
}; a weird result!sub test : Local {
my ($self, $c) = @_;
my $test = {
a => $c->req->params->{'a'},
b => $c->req->params->{'b'},
c => $c->req->params->{'c'},
};
$c->res->body(Dumper(\$test));
} and get what we want:$VAR1 = \{
'a' => undef,
'b' => '1',
'c' => undef
};Labels: Catalyst