Blob Blame History Raw
From: =?UTF-8?q?Juli=C3=A1n=20Moreno=20Pati=C3=B1o?= <julian@debian.org>
Date: Sat, 27 Feb 2016 01:15:12 +0300
Subject: [PATCH] Fix "use UNIVERSAL" is a fatal error since perl 5.22
 following http://search.cpan.org/~shay/perl-5.22.1/lib/UNIVERSAL.pm
 documentation Bug: https://github.com/OpenSIPS/opensips/issues/804


diff --git a/modules/perl/lib/perl/OpenSIPS/LDAPUtils/LDAPConnection.pm b/modules/perl/lib/perl/OpenSIPS/LDAPUtils/LDAPConnection.pm
index 9275341..d0d1bb2 100644
--- a/modules/perl/lib/perl/OpenSIPS/LDAPUtils/LDAPConnection.pm
+++ b/modules/perl/lib/perl/OpenSIPS/LDAPUtils/LDAPConnection.pm
@@ -52,7 +52,6 @@ package OpenSIPS::LDAPUtils::LDAPConnection;
 use OpenSIPS::LDAPUtils::LDAPConf;
 use Net::LDAP;
 use Authen::SASL;
-use UNIVERSAL qw( isa );
 
 my $ldap_singleton = undef;
 
@@ -185,7 +184,7 @@ sub search {
 
     my $ldap = undef;
 
-    if( isa($conf ,"OpenSIPS::LDAPUtils::LDAPConnection") ) {
+    if( $conf->isa("OpenSIPS::LDAPUtils::LDAPConnection") ) {
       $ldap = $conf;
     } else {
       if( ! $ldap_singleton ) {
diff --git a/modules/perl/lib/perl/OpenSIPS/VDB.pm b/modules/perl/lib/perl/OpenSIPS/VDB.pm
index 7b7d4dd..0668552 100644
--- a/modules/perl/lib/perl/OpenSIPS/VDB.pm
+++ b/modules/perl/lib/perl/OpenSIPS/VDB.pm
@@ -45,7 +45,6 @@ use OpenSIPS::VDB::Result;
 use OpenSIPS::VDB::Value;
 use OpenSIPS::VDB::VTab;
 
-use UNIVERSAL qw ( can );
 
 our @ISA = qw ( OpenSIPS::Utils::Debug );
 
@@ -87,12 +86,12 @@ sub use_table {
 
 		OpenSIPS::log(L_DBG, "perlvdb:VDB: Setting VTab: v is $v (pkg is $pkg, func/method is $3)\n");
 
-		if (can($pkg, $3)) {
+		if ($pkg->can($3)) {
 			$self->{vtabs}->{$v} = new OpenSIPS::VDB::VTab( func => $pkg . "::" . $3);
-		} elsif (can($v, "init")) {
+		} elsif ($v->can("init")) {
 			$v->init();
 			$self->{vtabs}->{$v} = new OpenSIPS::VDB::VTab( obj => $v );
-		} elsif (can($v, "new")) {
+		} elsif ($v->can("new")) {
 			my $obj = $v->new();
 			$self->{vtabs}->{$v} = new OpenSIPS::VDB::VTab( obj => $obj );
 		} else {