[dancer-users] Dancer::Plugin::SimpleCRUD and 'add_edit_row_pre_save' hook question

Tappin, Chris (AU - Sydney) ctappin at deloitte.com.au
Tue Jul 15 03:26:30 BST 2014


Hi Dancer users

I hope you can help me.  I'm pretty new to Dancer and I'm trying to write a simple web service for note taking.  The SimpleCRUD module looks perfect for my needs, but I need to add a timestamp to the record that SimpleCRUD creates.

>From the documentation I assume the right way to do this is with the 'add_edit_row_pre_save' hook, but the code in that sub doesn't seem to ever get called.

simple_crud(
      record_title => 'Log item',
      prefix => '/crud',
      db_table => 'prototype',
      editable => 1,
editable_columns => [ qw( UFirstName ULastName Details Type KFirstName KLastName Outcome ) ],
add_edit_row_pre_save => sub {
            my $row = shift;
            open TESTOUTPUT, ">", "TEST.txt" or die "$!";
            print TESTOUTPUT "hello";
            close TESTOUTPUT;
},
);

Does anyone have some sample code or tips on how to implement 'add_edit_row_pre_save' that they would be willing to share?  My Googling turned up nothing.

Many thanks


Taps

</PRE>
<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Arial","sans-serif";
color:black'>See more with <a
href="http://www.deloitte.com/view/en_GX/global/index.htm"
target="_blank"><span style='color:#0066CC'>Deloitte</span></a>. </span><span
style='font-size:8.0pt;font-family:"Arial","sans-serif"'><a
href="http://www.deloitte.com/view/en_AU/au/news-research/media-releases/9f68f4021a001210VgnVCM100000ba42f00aRCRD.htm"
target="_blank"><span style='color:#0066CC'>2012 Employer of Choice for Women (EOWA)</span></a> and <a
href="http://www.deloitte.com/view/en_AU/au/about-us/awards/index.htm"target="_blank"><span style='color:#0066CC'>Inclusive Workplace of the Year (AHRI Diversity Awards)</a>. 

</span></o:p></span></p>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Arial","sans-serif"'>
This e-mail and any attachments to it are confidential. You must not use, disclose or act on the e-mail if you are not the intended recipient. If you have 

received this e-mail in error, please let us know by contacting the sender and deleting the original e-mail.<br>Liability limited by a scheme approved under Professional Standards Legislation. <br> Deloitte refers to one or more of 

Deloitte Touche Tohmatsu Limited, a UK private company limited by guarantee, and its network of member firms, each of which is a legally separate and 

independent entity. Please see <a href="http://www.deloitte.com/au/about" target="_blank"><span style='color:#0066CC'>www.deloitte.com.au/about</span></a> for a detailed 

description of the legal structure of Deloitte Touche Tohmatsu Limited and its member firms.<br><br>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20140715/fb7514c9/attachment-0001.html>


More information about the dancer-users mailing list