From: Chris W. <ch...@cw...> - 2002-06-05 14:50:54
|
* Ewa...@ap... (Ewa...@ap...) [020605 10:15]: > How can I extract the class from a variable (object) in a Template? > > The result of an Dump is ([% Dumper.dump(object) %]): > $VAR1 = bless( { 'url' => '/nats', 'security' => 'yes', 'startup_id' => '1' > }, 'oit::Startup' ); > > But how can I get the 'oit::Startup'?? Getting a class within the template is kind of odd -- what would you do with it? -- but you can pass a subroutine to the template to do this for you: return $R->template->handler( {}, { ref_me => sub { return ref $_[0] }, myobject => $object }, { name => 'mypkg::mytemplate' } ); And call it: My class is: [% ref_me( myobject ) %] Chris |