Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

FormFu / FormBuilder + Custom Actions

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


rod.taylor at gmail

Aug 26, 2008, 7:30 AM

Post #1 of 2 (356 views)
Permalink
FormFu / FormBuilder + Custom Actions

Both FormFu and FormBuilder controller "Actions" appear to have issues
with their special variables disappearing when using an additional
ActionClass.

Below is a FormFu example. Carl asked me to repost it here for discussion.

2008/08/22 23:02:23] [catalyst] [ERROR] Caught exception in
SK::Controller::Client->edit "Can't call method "get_field" on an
undefined value at
/usr/home/rbt/work/sk/SK/script/../lib/SK/Controller/Client.pm line
284."

use parent qw{Catalyst::Controller::HTML::FormFu};
...
sub edit : Local FormConfig ActionClass('+SK::Action::Test) {
my ( $self, $c, $clientName ) = @_;

my $form = $c->stash->{'form'};

my $field = $form->get_field(name => 'some_field');
$field->default('Default Value');

return $self;
}



Any ActionClass will break it, including one virtually empty as found
in the Catalyst documentation:

package SK::Action::Test;

use strict;
use warnings;
use version 0.74;
our $VERSION = version->new(qw$Revision: 162 $);

use Class::C3;
use base 'Catalyst::Action';

sub execute {
my $self = shift;
my ($controller, $c, @args) = @_;

# put your 'before' code here

my $r = $self->next::method(@_);

# put your 'after' code here

return $r;
}

1;
__END__



Thanks,

Rod

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


dbix-class at trout

Aug 26, 2008, 2:45 PM

Post #2 of 2 (329 views)
Permalink
Re: FormFu / FormBuilder + Custom Actions [In reply to]

On Tue, Aug 26, 2008 at 10:30:47AM -0400, Rod Taylor wrote:
> Both FormFu and FormBuilder controller "Actions" appear to have issues
> with their special variables disappearing when using an additional
> ActionClass.

An object can't be blessed into two classes at once.

If you want to add an extra class, create an action class that inherits
from both the FormFu one and the additional one and :ActionClass that.

--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director http://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platform?
http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.