[Catalyst] Show Catalyst info page
Gavin Henry
ghenry at perl.me.uk
Wed Apr 16 20:18:47 BST 2008
<quote who="dreel">
> I just found that cat 5.7 Ánd 5.12 have many differences.
> For example, action stats changed and old version has broken.
>
> I want to do a back compatibility with 5.7/
> I can get $Catalyst::VERSION in controller, but I don't know where to find
> it in "c." for TT Template.
> If I can retrieve c.catalyst.version in TT than I can use conditional
> blocks for 5.7 and 5.12
http://search.cpan.org/~mramberg/Catalyst-View-TT-0.26/lib/Catalyst/View/TT.pm#CATALYST_VAR
To set the var, if that's what you mean.
>
> Or may be someone already done the universal stats?
>
> P.s.
> And I have an idea to make an CatInfo page such as phpinfo. It will be
> useful to have all information about
> Catalyst environment in -Debug mode /
Like loaded modules and versions etc?
I remember seeing this on the list or on Chisel Wrights website and use it
somewhere myself:
177 =head2 modules
178
179 =cut
180
181 sub modules : Local {
182 my ( $self, $c ) = @_;
183 $c->stash->{template} = 'admin/modules.tt';
184 my $inc_data;
185
186 my @inc_loaded = grep { s/\//::/g; s/\.pm//g; } sort keys %INC;
187
188 for my $module_name (@inc_loaded) {
189 eval {
190 $inc_data->{ $module_name } = $module_name->VERSION();
191 };
192 push @{$c->stash->{loaded_module_data}},
193 {
194 name => $module_name,
195 version => $inc_data->{ $module_name },
196 };
197 }
198 }
199
200 =head podhtml
201
202 Convert our loaded modules to html for reading
203
204 =cut
205
206 sub podhtml : Local Args(1) {
207 my ( $self, $c, $pm ) = @_;
208
209 my $podtohtml = Pod::Simple::HTML->new();
210
211 $pm =~ s/::/\//g;
212 $pm .= '.pm';
213
214 $c->res->body( $podtohtml->parse_from_file($INC{$pm}) );
215 $c->res->content_type('text/html');
216 }
More information about the Catalyst
mailing list