onfly —
| Attribute | Pos. | Req. | Default | Description |
|---|---|---|---|---|
| text | ||||
| create | ||||
| interpolate | 0 | interpolate output? | ||
| hide | 0 | Hide the tag return value? |
Interchange 5.9.0:
Source: code/SystemTag/onfly.coretag
Lines: 14
# Copyright 2002-2007 Interchange Development Group and others # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. See the LICENSE file for details. # # $Id: onfly.coretag,v 1.4 2007-03-30 23:40:49 pajamian Exp $ UserTag onfly Order code quantity UserTag onfly addAttr UserTag onfly PosNumber 2 UserTag onfly Version $Revision: 1.4 $ UserTag onfly MapRoutine Vend::Order::onfly
Source: lib/Vend/Order.pm
Lines: 717
sub onfly {
my ($code, $qty, $opt) = @_;
my $item_text;
if (ref $opt) {
$item_text = $opt->{text} || '';
}
else {
$item_text = $opt;
$opt = {};
}
# return create_onfly() if $opt->{create};
my $joiner = $::Variable->{MV_ONFLY_JOINER} || '|';
my $split_fields= $::Variable->{MV_ONFLY_FIELDS} || undef;
$item_text =~ s/\s+$//;
$item_text =~ s/^\s+//;
my @parms;
my @fields;
$joiner = quotemeta $joiner;
@parms = split /$joiner|\0/, $item_text;
my ($k, $v);
my $item = {};
if(defined $split_fields) {
@fields = split /[,\s]+/, $split_fields;
@{$item}{@fields} = @parms;
}
else {
for(@parms) {
($k, $v) = split /=/, $_;
$item->{$k} = $v;
}
}
$item->{mv_price} = $item->{price}
if ! $item->{mv_price};
$item->{code} = $code if ! $item->{code};
$item->{quantity} = $qty if ! $item->{quantity};
return $item;
}