Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Tie::AssignWrapper

by japhy (Canon)
on Sep 24, 2000 at 03:16 UTC ( #33808=snippet: print w/replies, xml ) Need Help??
Description: This is a module, but it's so damn tiny, it's a snippet. There's an example of its use in the POD.
package Tie::AssignWrapper;
sub TIESCALAR { bless \( $::{"$_[1]::"}{new}->(@_[1..$#_]) ), $_[0] }
sub FETCH { ${ $_[0] } }
sub STORE { (${ $_[0] })->AWstore($_[1]) }
sub DESTROY { (${ $_[0] })->DESTROY }
1;

__END__

=head1 NAME

Tie::AssignWrapper - catch assignments to objects

=head1 SYNOPSIS

  use Some::Module;
  use Tie::AssignWrapper;
  tie $obj, Tie::AssignWrapper => Some::Module => @args;
  print $obj->value;
  $obj = "new value";
  print $obj->value;

=head1 DESCRIPTION

This module intercepts the assignment operator, and passes
off the assignment to the module beneath it.  It calls the
C<AWstore> method (so make sure that's what you call it).

=head1 AUTHOR

  Jeff "japhy" Pinyan
  CPAN ID: PINYAN
  japhy@pobox.com

=cut
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: snippet [id://33808]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2023-09-25 20:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?