| Object-Capsule documentation | view source | Contained in the Object-Capsule distribution. |
Object::Capsule - wrap any object in a flavorless capsule
version 0.011
$Id: /my/cs/projects/capsule/trunk/lib/Object/Capsule.pm 27815 2006-11-11T02:55:13.563463Z rjbs $
use Object::Capsule; use Widget; my $widget = new Widget; my $capsule = encapsulate($widget); $capsule->some_widget_method; # performs method on widget print ref $capsule; # prints "Object::Capsule" print ref $$capsule; # prints "Widget"
An Object::Capsule is a thin, permeable membrane that fits nicely around an object. Method calls are passed on to the object, which functions normally inside the capsule. The object can be retrieved by dereferencing the capsule as a scalar.
My intent is to use an object capsule subclass to allow the inflation of multiple object types from a single column in Class::DBI.
encapsulate($object) This function encases the given object in an Object::Capsule and returns the capsule. It's exported by default and is otherwise non-existent.
Ricardo Signes, <rjbs@cpan.org>
Please report any bugs or feature requests to
bug-object-capsule@rt.cpan.org, or through the web interface at
http://rt.cpan.org. I will be notified, and then you'll automatically
be notified of progress on your bug as I make changes.
The proxy overloading code is hideous. The "future" version in the code had bizarre problems that I couldn't quite solve, but I'll try again sometime.
Copyright 2004 Ricardo Signes, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Object-Capsule documentation | view source | Contained in the Object-Capsule distribution. |