[Catalyst] Subject: Simple question: setting pre-set fields/creation actions in Catalyst::Controller::DBIC::API::REST

Hernan Lopes hernanlopes at gmail.com
Thu Jun 5 21:44:57 GMT 2014

first things first. In a restful environment, a client might create a
request with json content and a header that specifys the content type which
is being sent to the web server. The web server will receive that request
containing XYZ-content then it will look up the request header
"Content-Type" which must indicate that content being sent is
"application/json". Then, it can correctly parse that XYZ-content into the
proper content type and transform it into a perl structure that you can
store or do something else. Then, you will process that content and
generate a response for the requesting client. If your app will respond to
the client with a json content you must specify that into the response
header: content-type: "application/json". That way when the client receives
that response it will know the content is a json and correctly understand

So you should get that working and understood before you can proceed. Check
if you are receiving some content in the correct controller.
Try do Dump the contents of $c->req and make sure you are getting the
correct contents with the respective content types.


Hernan Lopes

On Thu, Jun 5, 2014 at 7:27 AM, Andy Holyer <andyh.enable at gmail.com> wrote:

> I've been coding in Perl for years, but I'm still pretty new to Catalyst,
> so please excuse the newbie question.
> I'm putting together a Catalyst application which uses
> Calalyst::Controller::DBIC::API::REST to interface with the database.
> So, in lib/MyApp/Controller/ there are a bunch of files of the form
> {Table}.pm, which each consists of basically a __PACKAGE__->config() call
> setting various things, including create_requires, create_allows and so on.
> Simple question: Several of these tables require status etc. to be set
> heardwired in code, and several of the others have some business logic
> which needs to take place on e.g. creation.
> What's the canonical way to do this? I'm guessing it means defining a
> begin method, but I'd really like to know the "proper" way to do this.
> Can't see this anywhere in the docs (unless I'm looking in the wrong
> place), but it's such a common occurrence it *must* be a FAQ.
> Thanks in Advance.
> Andy Holyer, Brighton, UK
> _______________________________________________
> 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@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/catalyst/attachments/20140605/92bfb620/attachment.htm>

More information about the Catalyst mailing list