<?xml version="1.0" encoding="windows-1252"?>
<node id="989549" title="Re: How can I re-program the exists function?" created="2012-08-24 10:24:25" updated="2012-08-24 10:24:25">
<type id="11">
note</type>
<author id="616540">
moritz</author>
<data>
<field name="doctext">
&lt;blockquote&gt;Now, my real question is: How can you create a function that would act like the "exists" function?&lt;/blockquote&gt;

&lt;p&gt;I'd be happy to be proven wrong, but I'd say you can't. At least not in pure Perl. Maybe with XS code when you hook into the parser.&lt;/p&gt;

&lt;p&gt;In some cases you can [doc://tie] variables, in which [doc://exists] will call your &lt;c&gt;EXISTS&lt;/c&gt; method. But depending on what you actually want to achieve, that might not be a good solution.&lt;/p&gt;

&lt;p&gt;So, in the spirit of [XY Question], what is the larger problem your are trying to solve?&lt;/p&gt;

&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-616540"&gt;
[http://perl6.org/|Perl 6 - the future is here, just unevenly distributed]
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
989548</field>
<field name="parent_node">
989548</field>
</data>
</node>
