#!/usr/bin/perl -w use strict; use warnings; use Object; use L; use Data::Dumper; package Foo; use strict; use warnings; use base 'Object'; sub new { my ($pkg, @args) = @_; my $self = $pkg->SUPER::new(@args); $self->rule(['cow'], ['legs'], sub { $_[2] = $_[1] * 4; }); return $self; } sub get_cow { return 1; } package main; my $f = Foo->new({cow => 10}); $f->cow(10); p "cow:", $f->cow; p Dumper($f);