Pad-Tie

 view release on metacpan or  search on metacpan

lib/Pad/Tie/Plugin/List.pm  view on Meta::CPAN


sub INV         () { 0 }
sub METHOD      () { 1 }
sub FETCH_CACHE () { 2 }
sub STORE_COUNT () { 3 }
sub STORE_CACHE () { 4 }

# XXX this looks familiar too
sub TIEARRAY {
  my ($class, $inv, $method) = @_;
  bless [ $inv, $method ] => $class;
}

BEGIN {
  for my $unimp (qw(STORESIZE EXISTS DELETE PUSH POP SHIFT UNSHIFT
    SPLICE)) {
    no strict 'refs';
    *$unimp = sub { Carp::croak "invalid operation for list method: $unimp" };
  }
}

lib/Pad/Tie/Plugin/Scalar.pm  view on Meta::CPAN

  my $class = ref($plugin) || $plugin;
  $args = $plugin->canon_args($args);
  for my $method (keys %$args) {
    my $name = $args->{$method};
    tie $ctx->{"\$$name"}, $class, $self, $method;
  }
}

sub TIESCALAR {
  my ($class, $inv, $method) = @_;
  return bless [ $inv, $method ] => $class;
}

sub FETCH {
  my ($self, $method) = @{+shift};
  return $self->$method;
}

sub STORE {
  my ($self, $method) = @{+shift};
  $self->$method(@_);

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 2.147 seconds using v1.00-cache-2.02-grep-82fe00e-cpan-f5108d614456 )