<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Use <font face="Courier New" size="2" class="">find_or_new</font> instead, and then check <font face="Courier New" size="2" class="">$id-&gt;in_storage</font>. &nbsp;Make sure to call <font face="Courier New" size="2" class="">$id-&gt;insert</font> when <font face="Courier New" size="2" class="">$id-&gt;in_storage</font> is false.</div><div class=""><br class=""></div><div class="">This is explained in&nbsp;<a href="https://metacpan.org/pod/DBIx::Class::ResultSet#find_or_create" class="">the documentation for <font face="Courier New" size="2" class="">find_or_create</font></a>, starting with “If you need to know if an existing row was found or a new one created…”.</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Aug 18, 2017, at 10:34 , Rajeev Prasad &lt;<a href="mailto:rp.neuli@yahoo.com" class="">rp.neuli@yahoo.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><div style="background-color: rgb(255, 255, 255); font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;" class=""><div id="yui_3_16_0_ym19_1_1503077579332_3282" class="">How do we know wether this function 'found' or created whatever was being asked to 'find_or_create' ???</div><div id="yui_3_16_0_ym19_1_1503077579332_3312" class=""><br class=""></div><div id="yui_3_16_0_ym19_1_1503077579332_3313" dir="ltr" class="">my $id = $schema<br id="yui_3_16_0_ym19_1_1503077579332_3328" class="">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; -&gt;resultset('Node')<br id="yui_3_16_0_ym19_1_1503077579332_3329" class="">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; -&gt;find_or_create<br id="yui_3_16_0_ym19_1_1503077579332_3330" class="">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (<br id="yui_3_16_0_ym19_1_1503077579332_3331" class="">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; { nodeName =&gt; $node },<br id="yui_3_16_0_ym19_1_1503077579332_3332" class="">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; { key =&gt; 'nodeID' }<br id="yui_3_16_0_ym19_1_1503077579332_3333" class="">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; );<br id="yui_3_16_0_ym19_1_1503077579332_3334" class=""></div><div dir="ltr" class="">how do we know wether $id was already existing in table?<br class=""></div></div></div>_______________________________________________<br class="">List: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class" class="">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class</a><br class="">IRC: <a href="http://irc.perl.org" class="">irc.perl.org</a>#dbix-class<br class="">SVN: <a href="http://dev.catalyst.perl.org/repos/bast/DBIx-Class/" class="">http://dev.catalyst.perl.org/repos/bast/DBIx-Class/</a><br class="">Searchable Archive: <a href="http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk" class="">http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk</a></div></blockquote></div><br class=""></body></html>