hello,
I tried to register a vmethod to an object using this way:
use strict;
use warnings;
use Template;
use Template::Stash;
$Template::Stash::SCALAR_OPS-{field} = sub {
my $self = shift;
$self-field(@_);
}
but it doesn't work: $self can't be a reference to be handled by
SCALAR_OPS.
On Mon, Jul 28, 2008 at 4:07 AM, Marc Chantreux [EMAIL PROTECTED]
wrote:
hello,
I tried to register a vmethod to an object using this way:
use strict;
use warnings;
use Template;
use Template::Stash;
$Template::Stash::SCALAR_OPS-{field} = sub {
my $self = shift;
On Mon, Jul 28, 2008 at 10:10 AM, Sean McAfee [EMAIL PROTECTED] wrote:
On Mon, Jul 28, 2008 at 4:07 AM, Marc Chantreux
[EMAIL PROTECTED] wrote:
hello,
I tried to register a vmethod to an object using this way:
use strict;
use warnings;
use Template;
use Template::Stash;
hello Sean,
I'm afraid it does the same ...
On Mon, Jul 28, 2008 at 11:26:05AM -0700, Sean McAfee wrote:
sub Foo::field { $_[1] }
$Template::Stash::HASH_OPS-{foo} = sub { shift-field(@_) };
Template-new-process(\[% x.foo(42) %], { x = bless({ }, 'Foo' });
--
Marc Chantreux
BibLibre, expert
On Mon, Jul 28, 2008 at 3:13 PM, Marc Chantreux [EMAIL PROTECTED]
wrote:
hello Sean,
I'm afraid it does the same ...
I'm not sure what you mean. Here's a less abbreviated example:
use Template;
use Template::Stash;
use strict;
package Object;
sub new {
my ($class, $addend) = @_;