- or download this
$obj->[0] = 'foo';
...
$obj->{'bar'} = 'bar';
$obj->{'baz'} = 'baz';
- or download this
package Class::Of::Obj;
...
$obj->[$bar_idx] = 'bar';
$obj->[$baz_idx] = 'baz';
- or download this
package Super::Class;
...
# Everything's hardwired up there and the Super::Class
# isn't telling me. I'm stuck.
- or download this
package Super::Class;
...
# oops! NEXT_IDX() is still set to '0' up there, and we just set
# OTHER_IDX to 1, clobbering whatever's in the BAR_IDX field!
- or download this
package Super::Class;
...
use constant OTHER_IDX => __PACKAGE__>SUPER::NEXT_IDX();
#now at 3, after BAZ_IDX
- or download this
package Super::Class;
...
use constant DIFFERENT_IDX => __PACKAGE__>SUPER::NEXT_IDX();
#now at 4, after OTHER_IDX
- or download this
package Super::Class;
...
use constant OTHER_IDX => __PACKAGE__>SUPER::NEXT_IDX();
#now at 4, DIFFERENT THAN LAST TIME!
- or download this
package Super::Class;
...
use constant OTHER_IDX => __PACKAGE__->SUPER::NEXT_IDX();
#also set to 3
- or download this
package Distant::Sub::Class;
...
#both OTHER_IDX and DIFFERENT_IDX point to index 3. Whoops.
- or download this
package Super::Class;
...
use constant OTHER_IDX => __PACKAGE__->SUPER::NEXT_IDX();
#also set to 0
- or download this
my $obj = Sub::Class->new();
$obj->[CLASS_IDX]->[OTHER_IDX];