NAME

ASCOPE::Class::Null - Aaron's dummy class thingy.


SYNOPSIS

 package Foo::Bar;
 use base qw (My::Class::DBI);
 use ASCOPE::Class::Null;
 __PACKAGE__->has_a(next_id => "Foo::Bar",
                    # We the next_id method for
                    # this object is called execute
                    # this subroutine:
                    inflate => sub {
                      # Do we have a next_id?
                      ($_[0]) ?
                        # Yes, return an object
                        # of class Foo::Bae
                        Foo::Bar->retrieve($_[0]) :
                            # No next_id. Return an
                            # object which when tested
                            # ( e.g. if($obj)) will return
                            # false (specificall, nothing.)
                            ASCOPE::Class::Null->new() 
                    });


DESCRIPTION

This is a hack.

It was written to deal with a ``feature'' in Class::DBI that prevents you from doing stuff like setting up a next_id relationship with a class to itself.

Eventually, the last next_id in the chain will be 0 which will cause Class::DBI 's retrieve method to return undef which will cause the automagic relationship generator to blow it's brains out.

This may be the Right Way To Do It but it's also very annoying.

This package returns a blessed scalar reference to an undefined string and then overloads ``'' to return nothing. Which can be used in conjuction with Class::DBI 's inflate hooks to DWIM.

Although it was written with Class::DBI in mind, it may prove useful in other situations.


CAVEATS


VERSION

1.1


DATE

$Date: 2003/03/09 14:36:43 $


AUTHOR

Aaron Straup Cope


LICENSE

Copyright (c) 2003 Aaron Straup Cope. All Rights Reserved.

This is free software, you may use it and distribute it under the same terms as Perl itself.