GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
SPOPS::Loopback(3) User Contributed Perl Documentation SPOPS::Loopback(3)

SPOPS::Loopback - Simple SPOPS class used for testing rules and other goodies

    use 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;

This 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.

fetch( $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.

SPOPS

Copyright (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.

Chris Winters <chris@cwinters.com>
2004-06-02 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.