stephanealnet / ccnq1.5

This URL has Read+Write access

commit  0cddc9639df2dde1f566069aa74a97b9f12dbf5f
tree    1524c635fb0e0abef8ed7a86094467319e7f2fe5
parent  286cd2552352f09b6be3bd851650d94039585211
ccnq1.5 / q.pl
100755 55 lines (45 sloc) 1.626 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/perl
# Copyright (C) 2006, 2007 Stephane Alnet
#
# 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 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
 
#
# For more information visit http://carrierclass.net/
#
use strict; use warnings;
 
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use DBI;
 
use lib '/var/www';
use configuration;
 
our $dbi_info = "DBI:mysql:database=${configuration::db_name};host=${configuration::db_host}";
 
sub run
{
    $CGI::DISABLE_UPLOADS = 1;
    $CGI::POST_MAX=1024 * 100;
    
    my $cgi = new CGI;
    my $db = DBI->connect ($dbi_info,$configuration::db_login,$configuration::db_password)
        or die $DBI::errstr;
    my $class = $cgi->param('_class');
    die unless defined $class;
    die unless $class =~ /^\w+$/;
    my $c = undef;
    my $eval = "use lib '/var/www'; use CCNQ::Proxy::$class; \$c = new CCNQ::Proxy::$class (\$cgi,\$db,\$configuration::sip_challenge)";
    eval $eval;
    die "use $class in eval($eval): $@" if $@;
    die "$class: new failed" unless defined $c;
    
    $c->run();
        
    $db->disconnect;
}
 
run();