[Catalyst] still not sure if I have the hang of this ...

Andreas Marienborg omega at palle.net
Tue Dec 27 23:43:43 CET 2005


On 27. des. 2005, at 21.14, Joe Landman wrote:

> (I haven't used DBIx::Class and its ilk before so this might be a  
> dumb question)
>
> I create a form.  I submit with that form.  I see the request go to  
> the test server with the data.
>
> Now I want to take this data and stuff it into one of my model's  
> tables.  I presume it is something like
>
> 	__PACKAGE__->find_or_create({ key1 => $value1, key2 =>  
> $value2, ...} );
>

You usually have to replace __PACKAGE__ with the actual model- 
package, like MyApp::Model::Table->find_or_create

In a controller, __PACKAGE__ equals the package of the controller,  
and that controller, most likely, lacks a find_or_create method.

>
> from the controller.  This seems wrong to me though, in that  
> wouldn't we want to go through the model?  I think I am missing  
> something fundamental here.
>
> Is there a really dumb/simple example out there for perusal which  
> demonstrates taking data from a form and putting it into a database  
> using Catalyst?  I can't seem to wrap my mind around the correct  
> method, as I don't see an example of it.  I looked through the  
> Agave site, and it seems to be missing a few of the methods  
> (addcomment is pretty much what I want to see, but it doesn't  
> appear to be in the tree).
>

Check out the BookDB example from dev.catalyst.perl.org


> Thanks.
>
> Joe
>
>
>
> -- 
> Joseph Landman, Ph.D
> Founder and CEO
> Scalable Informatics LLC,
> email: landman at scalableinformatics.com
> web  : http://www.scalableinformatics.com
> phone: +1 734 786 8423
> fax  : +1 734 786 8452
> cell : +1 734 612 4615
>
>
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst




More information about the Catalyst mailing list