Gideon::Manual::Updating - Updating objects
version 0.0.3
Gideon can update a single object or a group objects depending on how it is invoked, please make sure you read and understand the documentation as missues of this method can cause data corruption
update( %changes )
When update is invoked for a Gideon class it updates all records in a data store with %changes.
update
%changes
# Update all objects in the data store People->update( status => 'active' );
When update is invoked for a Gideon class instance it updates that particular record and not the rest of the records
# Update one object People->find_one( id => 1 )->update( id => 2 );
save
Additionally you can use the save method to update a particular object.
my $person = People->find_one( id => 1 ); # Update only the name $person->update( name => 'John Doe' ); # Query: UPDATE ... SET name = 'John Doe' WHERE id = 1 # Update names $person->name('John Doe'); $person->save; # Query: UPDATE ... SET id = 1, name = 'John Doe', ... WHERE id = 1
The difference between save and update is that update gives you a fine grained control on which fields to update. save sends the entire record as a whole to the data store.
Updating objects with Gideon
Mariano Wahlmann, Gines Razanov
This software is copyright (c) 2013 by Mariano Wahlmann, Gines Razanov.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Gideon, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Gideon
CPAN shell
perl -MCPAN -e shell install Gideon
For more information on module installation, please visit the detailed CPAN module installation guide.