Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
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
Comment on Tie::AssignWrapper
Download Code

Back to Snippets Section

Log In?
Username:
Password:

What's my password?
Create A New User
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 cooling their heels in the Monastery: (6)
As of 2015-07-04 04:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls