|
NAMESPOPS::Loopback - Simple SPOPS class used for testing rules and other goodiesSYNOPSISuse SPOPS::Initialize; my %config = ( test => { class => 'LoopbackTest', isa => [ qw( SPOPS::Loopback ) ], field => [ qw( id_field field_name ) ], id_field => 'id_field', }, ); SPOPS::Initialize->process({ config => \%config }); my $object = LoopbackTest->new; $object->save; $object->remove; DESCRIPTIONThis is a simple SPOPS class that returns success for all operations. The serialization methods ("save()", "fetch()", "fetch_group()" and "remove()") all call the pre/post action methods just like any other objects, so it is useful for testing out rules.METHODSfetch( $id )Returns a new object initialized with the ID $id, calling the "pre/post_fetch_action()" methods first. If the object has been previously saved we pull it from the in-memory storage, otherwise we return a new object initialized with $id. fetch_group( \%params ) Returns an arrayref of previously saved objects. If no objects have been saved, it returns an arrayref of new objects initialized with numeric IDs. We grab the 'where' clause out of "\%params" but do only some rudimentary parsing to return previously stored objects. (Patches welcome.) save() Returns the object you called the method on. If this is an unsaved object (if it has not been fetched or saved previously), we call "pre_fetch_id()" and "post_fetch_id()" to trigger any key-generation actions. Saved and unsaved objects both have "pre/post_save_action()" methods called. This also stores the object in-memory so you can call "fetch()" on it later. remove() Calls the "pre/post_remove_action()" and removes the object from the in-memory storage. peek( $id, $field ) Peeks into the in-memory store for the value of $field for object $id. Must be called as class method. SEE ALSOSPOPSCOPYRIGHTCopyright (c) 2001-2004 intes.net, inc.. All rights reserved.This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. AUTHORSChris Winters <chris@cwinters.com>
Visit the GSP FreeBSD Man Page Interface. |