Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

63 lines (59 sloc) 1.536 kb
# 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: db_hash.coretag,v 1.5 2007-03-30 23:40:54 pajamian Exp $
UserTag db-hash Order table column key
UserTag db-hash PosNumber 3
UserTag db-hash addAttr
UserTag db-hash Version $Revision: 1.5 $
UserTag db-hash Routine <<EOR
sub {
my($table, $col, $key, $opt) = @_;
$col =~ s/:+(.*)//s;
my $out;
my $rest = $1;
my $val = ::tag_data($table,$col,$key);
my $ref;
if ($val !~ /\S/) {
$ref = {};
}
else {
$ref = $Vend::Interpolate::ready_safe->reval($val);
if (! ref $ref) {
$ref = {};
}
}
if (! $rest) {
return $val unless defined $opt->{value};
}
my @extra;
@extra = split /:+/, $rest;
my $final = pop @extra;
my $curr = $ref;
$out .= "Original key request: $rest\n";
$out .= "\nFinal key: $final\n";
for(@extra) {
$out .= "key --> $_\n";
$curr = $curr->{$_};
if (! ref $curr) {
return "BAD HASH: $out" if $opt->{show_error};
return;
}
}
if($opt->{keys}) {
return join get_joiner($opt->{joiner}), sort keys %$curr;
}
elsif(! defined $opt->{value}) {
return $curr->{$final};
}
else {
$curr->{$final} = $opt->{value};
tag_data($table, $col, $key, { value => uneval_it($ref) });
return $curr->{$final};
}
}
EOR
Jump to Line
Something went wrong with that request. Please try again.