| 1 |
# |
| 2 |
# $Id: VTab.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::VTab |
| 27 |
|
| 28 |
This package handles virtual tables and is used by the Kamailio::VDB class to store |
| 29 |
information about valid tables. The package is not inteded for end user access. |
| 30 |
|
| 31 |
=cut |
| 32 |
|
| 33 |
package Kamailio::VDB::VTab; |
| 34 |
|
| 35 |
use Kamailio; |
| 36 |
|
| 37 |
our @ISA = qw ( Kamailio::Utils::Debug ); |
| 38 |
|
| 39 |
=head2 new() |
| 40 |
|
| 41 |
Constructs a new VTab object |
| 42 |
|
| 43 |
=cut |
| 44 |
|
| 45 |
sub new { |
| 46 |
my $class = shift; |
| 47 |
return bless { @_ }, $class; |
| 48 |
} |
| 49 |
|
| 50 |
=head2 call(op,[args]) |
| 51 |
|
| 52 |
Invokes an operation on the table (insert, update, ...) with the |
| 53 |
given arguments. |
| 54 |
|
| 55 |
=cut |
| 56 |
|
| 57 |
sub call { |
| 58 |
my $self = shift; |
| 59 |
my $operation = shift; |
| 60 |
my @args = @_; |
| 61 |
|
| 62 |
if( my $obj = $self->{obj} ) { |
| 63 |
return $obj->$operation(@args); |
| 64 |
} else { |
| 65 |
no strict; |
| 66 |
return &{$self->{func}}($operation, @args); |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
1; |