this might require reading all the way through...
I'm wishing for something like
!$obj->not_found
perhaps
$obj->found ?
Rose Docs:
not_found
Returns true if the previous call to load failed because a row in
the database table with the specified primary or unique key did not
exist, false otherwise.
perhaps what I'm wanting is similar to
Rose::DB::Object::Util::is_in_db
is_in_db OBJECT
Given the Rose::DB::Object-derived object OBJECT, returns true if the
object was loaded from, or has ever been saved into, the database, or
false if it has not.
however, looking at source, is_in_db seems to be a wrapper for
STATE_IN_DB, and STATE_IN_DB seems to be the inverse of not_found in
most places... but STATE_IN_DB seems to also be affected by updates
to class data-- which i'm not so concerned about
in terms of functionality, I'm looking for something this (yes, this
is a ridiculous example i made up)
==========
sub load {
my ( $self )= @_;
eval {
$self->{__rose_obj}= MyApp::Rose::DB::Object::Subclassed->new(
id=>
1 );
my $result= $self->{__rose_obj}->load( speculative=> 1 );
if ( !$result ) {
die;
}
# continue working
};
return $self->{__rose_obj}->found ? 1 : 0 ;
}
==========
so, in the example above, i still want the rose object around --
because I'll want to update it then save... but i need to use
speculative, because I don't want to cause a die
does my idea make sense?
right now, i seem to be able to do what i want by either
a_ !$obj->not_found
double negatives are bad
b_ using multiple recursive eval blocs
messy
c_ using elaborate conditionals
even messier
thanks,
// Jonathan Vanasco
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Rose-db-object mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object