From: Joe Atzberger Date: Tue, 11 May 2010 01:56:37 +0000 (+0000) Subject: Get rid of weird evals, useless use's X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=29ae5acf32bba54244d8a0123a4935a6aea0bb7f;p=SIPServer.git Get rid of weird evals, useless use's There are no scripts committed that use DATA handles, so those eval blocks are not part of a known application. And that behavior is super sketchy, especially with multiple scripts, likely in combination! --- diff --git a/Sip/Checksum.pm b/Sip/Checksum.pm index 8d18ddd..4a91c3d 100644 --- a/Sip/Checksum.pm +++ b/Sip/Checksum.pm @@ -28,7 +28,6 @@ our @EXPORT_OK = qw(checksum verify_cksum); sub checksum { my $pkt = shift; - return (-unpack('%16C*', $pkt) & 0xFFFF); } @@ -49,10 +48,8 @@ sub verify_cksum { return (($cksum + $shortsum) & 0xFFFF) == 0; } -{ - no warnings qw(once); - eval join('',) || die $@ unless caller(); -} +1; + __END__ # @@ -70,5 +67,3 @@ while (<>) { chomp; test($_); } - -1; diff --git a/Sip/Configuration.pm b/Sip/Configuration.pm index 72ee83e..9313e82 100644 --- a/Sip/Configuration.pm +++ b/Sip/Configuration.pm @@ -107,25 +107,22 @@ sub find_service { return $self->{listeners}->{$portstr}; } -# -# Testing -# - - -{ - no warnings qw(once); - eval join('',) || die $@ unless caller(); -} - 1; __END__ - my $config = new Sip::Configuration $ARGV[0]; +=head1 NAME + +Sip::Configuration - abstraction/accessor for SIP configs + +=head1 SYNOPSIS +use Sip::Configuration; +my $config = Sip::Configuration->new($ARGV[0]); foreach my $acct ($config->accounts) { - print "Found account '", $acct->name, "', part of '" + print "Found account: '", $acct->id, "', part of '"; print $acct->institution, "'\n"; } -1; +=cut + diff --git a/Sip/Configuration/Account.pm b/Sip/Configuration/Account.pm index 8084ae3..c8d55fb 100644 --- a/Sip/Configuration/Account.pm +++ b/Sip/Configuration/Account.pm @@ -17,24 +17,18 @@ # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # -# -# -# package Sip::Configuration::Account; use strict; use warnings; -use English; -use Exporter; sub new { my ($class, $obj) = @_; my $type = ref($class) || $class; if (ref($obj) eq "HASH") { - # Just bless the object - return bless $obj, $type; + return bless $obj, $type; # Just bless the object } return bless {}, $type; @@ -42,19 +36,16 @@ sub new { sub id { my $self = shift; - return $self->{id}; } sub institution { my $self = shift; - return $self->{institution}; } sub password { my $self = shift; - return $self->{password}; } diff --git a/Sip/Configuration/Institution.pm b/Sip/Configuration/Institution.pm index 3c8b71c..de77e6f 100644 --- a/Sip/Configuration/Institution.pm +++ b/Sip/Configuration/Institution.pm @@ -17,24 +17,18 @@ # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # -# -# -# package Sip::Configuration::Institution; use strict; use warnings; -use English; -use Exporter; sub new { my ($class, $obj) = @_; my $type = ref($class) || $class; if (ref($obj) eq "HASH") { - # Just bless the object - return bless $obj, $type; + return bless $obj, $type; # Just bless the object } return bless {}, $type; @@ -42,7 +36,6 @@ sub new { sub name { my $self = shift; - return $self->{name}; } diff --git a/Sip/Configuration/Service.pm b/Sip/Configuration/Service.pm index eb239de..1c1fb7f 100644 --- a/Sip/Configuration/Service.pm +++ b/Sip/Configuration/Service.pm @@ -17,24 +17,18 @@ # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # -# -# -# package Sip::Configuration::Service; use strict; use warnings; -use English; -use Exporter; sub new { my ($class, $obj) = @_; my $type = ref($class) || $class; if (ref($obj) eq "HASH") { - # Just bless the object - return bless $obj, $type; + return bless $obj, $type; # Just bless the object } return bless {}, $type; @@ -42,7 +36,6 @@ sub new { sub timeout { my $self = shift; - return $self->{timeout} || $self->SUPER::timeout(); }