CatalystX-CRUD

 view release on metacpan or  search on metacpan

lib/CatalystX/CRUD/Controller.pm  view on Meta::CPAN


    1;
}

=head2 update

Alias for save(), just for consistency with the U in CRUD.

=cut

sub update : PathPart Chained('fetch') Args(0) {
    my ( $self, $c ) = @_;
    $self->save($c);
}

=head2 rm

Attribute: chained to fetch(), expecting no arguments.

Checks the can_write() and has_errors() methods before proceeeding.

lib/CatalystX/CRUD/ModelAdapter.pm  view on Meta::CPAN

=cut

sub read { shift->throw_error("must implement read()") }

=head2 update( I<context>, I<object> )

Should implement the U in CRUD.

=cut

sub update { shift->throw_error("must implement update()") }

=head2 delete( I<context>, I<object> )

Should implement the D in CRUD.

=cut

sub delete { shift->throw_error("must implement delete()") }

1;

lib/CatalystX/CRUD/ModelAdapter/File.pm  view on Meta::CPAN

    my ( $self, $c, $file ) = @_;
    $file->read;
}

=head2 update( I<context>, I<file_object> )

Implements required CRUD method.

=cut

sub update {
    my ( $self, $c, $file ) = @_;
    $file->update;
}

=head2 delete( I<context>, I<file_object> )

Implements required CRUD method.

=cut

lib/CatalystX/CRUD/Object.pm  view on Meta::CPAN


CatalystX::CRUD::Object - an instance returned from a CatalystX::CRUD::Model

=head1 SYNOPSIS

 package My::Object;
 use base qw( CatalystX::CRUD::Object );
 
 sub create { shift->delegate->save }
 sub read   { shift->delegate->load }
 sub update { shift->delegate->save }
 sub delete { shift->delegate->remove }
 
 1;

=head1 DESCRIPTION

A CatalystX::CRUD::Model returns instances of CatalystX::CRUD::Object.

The assumption is that the Object knows how to manipulate the data it represents,
typically by holding an instance of an ORM or other data model in the

lib/CatalystX/CRUD/Object.pm  view on Meta::CPAN

=item delete

Remove an existing object from store.

=back

=cut

sub create { shift->throw_error("must implement create") }
sub read   { shift->throw_error("must implement read") }
sub update { shift->throw_error("must implement update") }
sub delete { shift->throw_error("must implement delete") }

=head2 is_new

Return results should be boolean indicating whether the object
already exists or not. Expectation is code like:

 if ($object->is_new) {
     $object->create;
 }

lib/CatalystX/CRUD/Object/File.pm  view on Meta::CPAN

    return $self;
}

=head2 update

Just like create() only no check is made if the file exists prior to writing
to it. Returns the number of bytes written.

=cut

sub update {
    my $self = shift;
    return $self->_write;
}

=head2 delete

Remove the file from the filesystem.

=cut

lib/CatalystX/CRUD/REST.pm  view on Meta::CPAN

=cut

sub read { shift->next::method(@_) }

=head2 update( I<context> )

Overrides base method to disable chaining.

=cut

sub update { shift->next::method(@_) }

=head2 postcommit( I<context>, I<object> )

Overrides base method to redirect to REST-style URL.

=cut

sub postcommit {
    my ( $self, $c, $o ) = @_;
    my $id = $self->make_primary_key_string($o);



( run in 2.079 seconds using v1.01-cache-2.11-cpan-95122f20152 )