<div dir="ltr">Yes, all of that is understood and working fine. So, for example, I have a controller PaymentOut.pm, which allows the database table payment_out to be accessed, updated, etc., using normal CRUD operations.<div>
<br></div><div>What I now want to do is add in some procedural code so that:</div><div>a) payment_out.state is set to &quot;new&quot;</div><div>b) following saving a new record, the method process_record() is run on the new record.</div>
<div><br></div><div>That has to be a simple thing to do, right?</div><div><br></div><div>Thanks in advance for any advice.</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jun 5, 2014 at 10:44 PM, Hernan Lopes <span dir="ltr">&lt;<a href="mailto:hernanlopes@gmail.com" target="_blank">hernanlopes@gmail.com</a>&gt;</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>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 &quot;Content-Type&quot; which must indicate that content being sent is &quot;application/json&quot;. 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: &quot;application/json&quot;. 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-&gt;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"><div><div class="h5">On Thu, Jun 5, 2014 at 7:27 AM, Andy Holyer <span dir="ltr">&lt;<a href="mailto:andyh.enable@gmail.com" target="_blank">andyh.enable@gmail.com</a>&gt;</span> wrote:<br>

</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div style="font-family:arial,sans-serif;font-size:13px">I&#39;ve been coding in Perl for years, but I&#39;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&#39;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__-&gt;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&#39;s the canonical way to do this? I&#39;m guessing it means defining a begin method, but I&#39;d really like to know the &quot;proper&quot; way to do this. Can&#39;t see this anywhere in the docs (unless I&#39;m looking in the wrong place), but it&#39;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></div></div>_______________________________________________<br>
List: <a href="mailto:Catalyst@lists.scsys.co.uk" target="_blank">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>
<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>