<div dir="ltr"><div>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 it.<br>
<br></div><div>So you should get that working and understood before you can proceed. Check if you are receiving some content in the correct controller.<br></div><div>Try do Dump the contents of $c->req and make sure you are getting the correct contents with the respective content types.<br>
<br></div><div>cheers,<br><br>Hernan Lopes<br><br><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jun 5, 2014 at 7:27 AM, Andy Holyer <span dir="ltr"><<a href="mailto:andyh.enable@gmail.com" target="_blank">andyh.enable@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="font-family:arial,sans-serif;font-size:13px">I've been coding in Perl for years, but I'm still pretty new to Catalyst, so please excuse the newbie question.</div>
<div style="font-family:arial,sans-serif;font-size:13px">
<br></div><span style="font-family:arial,sans-serif;font-size:13px">I'm putting together a Catalyst application which uses Calalyst::Controller::DBIC::</span><span style="font-family:arial,sans-serif;font-size:13px">API::REST to interface with the database.</span><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">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.</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">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.</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">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.</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Thanks in Advance.</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
Andy Holyer, Brighton, UK</div></div>
<br>_______________________________________________<br>
List: <a href="mailto:Catalyst@lists.scsys.co.uk">Catalyst@lists.scsys.co.uk</a><br>
Listinfo: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst" target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a><br>
Searchable archive: <a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/" target="_blank">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a><br>
Dev site: <a href="http://dev.catalyst.perl.org/" target="_blank">http://dev.catalyst.perl.org/</a><br>
<br></blockquote></div><br></div>