[Catalyst] Page load time
fayland
fayland at gmail.com
Fri Apr 14 08:46:00 CEST 2006
Hi, all.
I need a function like "This page took 2.15273690223694 seconds to
load." so I create this patch against r3907
It's easy, just couple of lines. but it's difficult to write a
same-function plugin.
Index: Catalyst.pm
===================================================================
--- Catalyst.pm (revision 3907)
+++ Catalyst.pm (working copy)
@@ -1378,6 +1378,12 @@
$class->log->info(
"Request took ${elapsed}s ($av/s)\n" . $t->draw );
+
+ {
+ no strict 'refs';
+ *{"$class\::elapsed_time"} = sub { $elapsed };
+ }
+
}
else { $status = &$handler }
so that u can call "This page took [% c.elapsed_time %] seconds to
load." in TT files.
attachment is a patch, hope u guys like it.
--
Fayland Lam // http://www.fayland.org/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: catalyst.patch
Url: http://lists.rawmode.org/pipermail/catalyst/attachments/20060414/de3a2f97/attachment.diff
More information about the Catalyst
mailing list