| 1 |
# |
| 2 |
# $Id: Pair.pm 757 2007-01-05 10:56:28Z bastian $ |
| 3 |
# |
| 4 |
# Perl module for Kamailio |
| 5 |
# |
| 6 |
# Copyright (C) 2006 Collax GmbH |
| 7 |
# (Bastian Friedrich <[email protected]>) |
| 8 |
# |
| 9 |
# This file is part of Kamailio, a free SIP server. |
| 10 |
# |
| 11 |
# Kamailio is free software; you can redistribute it and/or modify |
| 12 |
# it under the terms of the GNU General Public License as published by |
| 13 |
# the Free Software Foundation; either version 2 of the License, or |
| 14 |
# (at your option) any later version |
| 15 |
# |
| 16 |
# Kamailio is distributed in the hope that it will be useful, |
| 17 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 |
# GNU General Public License for more details. |
| 20 |
# |
| 21 |
# You should have received a copy of the GNU General Public License |
| 22 |
# along with this program; if not, write to the Free Software |
| 23 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 24 |
# |
| 25 |
|
| 26 |
=head1 Kamailio::VDB::Pair |
| 27 |
|
| 28 |
This package represents database key/value pairs, consisting of a |
| 29 |
key, a value type, and the value. |
| 30 |
|
| 31 |
This package inherits from Kamailio::VDB::Value and thus has the same methods. |
| 32 |
|
| 33 |
=cut |
| 34 |
|
| 35 |
package Kamailio::VDB::Pair; |
| 36 |
|
| 37 |
use Kamailio::VDB::Value; |
| 38 |
|
| 39 |
our @ISA = qw ( Kamailio::VDB::Value Kamailio::Utils::Debug ); |
| 40 |
|
| 41 |
=head2 new(key,type,name) |
| 42 |
|
| 43 |
Constructs a new Column object. |
| 44 |
|
| 45 |
=cut |
| 46 |
|
| 47 |
sub new { |
| 48 |
my $class = shift; |
| 49 |
my $key = shift; |
| 50 |
my $type = shift; |
| 51 |
my $data = shift; |
| 52 |
|
| 53 |
my $self = new Kamailio::VDB::Value($type, $data); |
| 54 |
|
| 55 |
bless $self, $class; |
| 56 |
|
| 57 |
$self->{key} = $key; |
| 58 |
|
| 59 |
return $self; |
| 60 |
} |
| 61 |
|
| 62 |
|
| 63 |
=head2 key() |
| 64 |
|
| 65 |
Returns or sets the current key. |
| 66 |
|
| 67 |
=cut |
| 68 |
|
| 69 |
sub key { |
| 70 |
my $self = shift; |
| 71 |
if (@_) { |
| 72 |
$self->{key} = shift; |
| 73 |
} |
| 74 |
|
| 75 |
return $self->{key}; |
| 76 |
} |
| 77 |
|
| 78 |
1; |