Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

94 lines (77 sloc) 2.091 kb
__NAME__ purpose
generic subroutine mapper
__END__
__NAME__ see also
CodeDef,UserTag,Filter,ActionMap,FormAction,GlobalSub,ItemAction,CoreTag
__END__
Fix the entry, then insert the missing _ at the beginning of line
_NAME__ synopsis
<group choice='req'>
<arg choice='plain'>
<literal>Sub</literal>
<replaceable>perl_code</replaceable>
</arg>
</group>
_END__
__NAME__ missing
synopsis
replace plain words with entities in description
more description
__END__
__NAME__ description
A generic &PERL; subroutine mapper which allows mapping of subroutines to
&glos-ActionMap;s,
CoreTags, &conf-UserTag;s,
&glos-filter;s,
&glos-form-action;s,
&conf-GlobalSub;s,
ItemActions,
SearchOps,
LocaleChanges,
OrderChecks,
and Widgets.
<itemizedlist>
<listitem><para>
SearchOp definition needs to be a function that creates and returns a
search function. The search function will receive the data to match
and should return <literal>1</literal> if the value matches.
</para></listitem>
</itemizedlist>
__END__
__NAME__ example: Defining a subroutine
__END__
__NAME__ example: Defining a custom SearchOp
Here's an exemplary "<literal>find_hammer</literal>" SearchOp that
should be placed in &gcf;:
<programlisting><![CDATA[
CodeDef find_hammer SearchOp find_hammer
CodeDef find_hammer Routine <<EOR
sub {
# Called with:
# $self - search object
# $i - index into coordinated search array
# $string - data to match
# $opname - name of the specified mv_column_op
my($self, $i, $string, $opname);
#::logDebug("Calling fake SearchOp");
return sub {
#::logDebug("testing with fake SearchOp");
my $string = shift;
$string =~ /hammer/i;
};
}
EOR
]]></programlisting>
The above simple function does not honor <mv>mv_negate</mv> or other
variables. See <function>Vend::Search::create_text_query</function>
for an example of how to create a proper search routine and honor
various associated search parameters.
__END__
__NAME__ example: Widgets with multiple selections
CodeDef checkbox Multiple 1
__END__
__NAME__ notes
__END__
__NAME__ missing
PORT_OLD
__END__
Jump to Line
Something went wrong with that request. Please try again.