From: Joe Atzberger Date: Fri, 1 Oct 2010 23:21:17 +0000 (+0000) Subject: VERSIONing, it's good for you. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ba1da199b14ab1a54ef8d25a92c0d1ec6d99afc2;p=SIPServer.git VERSIONing, it's good for you. --- diff --git a/SIPServer.pm b/SIPServer.pm index ac983c5..60fef83 100644 --- a/SIPServer.pm +++ b/SIPServer.pm @@ -38,6 +38,7 @@ use Sip::MsgType; use constant LOG_SIP => "local6"; # Local alias for the logging facility +our $VERSION = 0.02; our @ISA = qw(Net::Server::PreFork); # # Main @@ -51,7 +52,7 @@ my %transports = ( # Read configuration -my $config = new Sip::Configuration $ARGV[0]; +my $config = Sip::Configuration->new($ARGV[0]); my @parms; @@ -122,7 +123,7 @@ sub process_request { $self->{service} = $config->find_service( $sockaddr, $port, $proto ); if (! defined($self->{service})) { - syslog( "LOG_ERR", "process_request: Unknown recognized server connection: %s:%s/%s", + syslog( "LOG_ERR", "process_request: Unrecognized server connection: %s:%s/%s", $sockaddr, $port, $proto ); die "process_request: Bad server connection"; } diff --git a/Sip.pm b/Sip.pm index df75664..065e7ff 100644 --- a/Sip.pm +++ b/Sip.pm @@ -35,6 +35,7 @@ use Socket qw(:crlf); use Sip::Constants qw(SIP_DATETIME); use Sip::Checksum qw(checksum); +our $VERSION = 0.02; our @ISA = qw(Exporter); our @EXPORT_OK = qw(y_or_n timestamp add_field maybe_add add_count diff --git a/Sip/Checksum.pm b/Sip/Checksum.pm index 7e84ab1..85b17a2 100644 --- a/Sip/Checksum.pm +++ b/Sip/Checksum.pm @@ -24,8 +24,9 @@ use strict; use warnings; use integer; # important -our @ISA = qw(Exporter); +our $VERSION = 0.02; our @EXPORT_OK = qw(checksum verify_cksum); +our @ISA = qw(Exporter); our $debug = 0; sub debug_print { diff --git a/Sip/Configuration.pm b/Sip/Configuration.pm index 9313e82..e15f895 100644 --- a/Sip/Configuration.pm +++ b/Sip/Configuration.pm @@ -24,8 +24,9 @@ package Sip::Configuration; +our $VERSION = 0.02; + use strict; -use English; use warnings; use XML::Simple qw(:strict); @@ -33,19 +34,25 @@ use Sip::Configuration::Institution; use Sip::Configuration::Account; use Sip::Configuration::Service; -my $parser = new XML::Simple( KeyAttr => { login => '+id', - institution => '+id', - service => '+port' }, - GroupTags => { listeners => 'service', - accounts => 'login', - institutions => 'institution', }, - ForceArray=> [ 'service', - 'login', - 'institution' ], - ValueAttr => { 'error-detect' => 'enabled', - 'timeout' => 'value', - 'min_servers' => 'value', - 'max_servers' => 'value'} ); +my $parser = new XML::Simple( + KeyAttr => { + login => '+id', + institution => '+id', + service => '+port' + }, + GroupTags => { + listeners => 'service', + accounts => 'login', + institutions => 'institution', + }, + ForceArray => [ 'service', 'login', 'institution' ], + ValueAttr => { + 'error-detect' => 'enabled', + 'timeout' => 'value', + 'min_servers' => 'value', + 'max_servers' => 'value' + } +); sub new { my ($class, $config_file) = @_; @@ -53,7 +60,7 @@ sub new { my %listeners; foreach my $acct (values %{$cfg->{accounts}}) { - new Sip::Configuration::Account $acct; + new Sip::Configuration::Account $acct; } # The key to the listeners hash is the 'port' component of the @@ -63,13 +70,13 @@ sub new { # find_server() when building the keys to search the hash. foreach my $service (values %{$cfg->{listeners}}) { - new Sip::Configuration::Service $service; - $listeners{lc $service->{port}} = $service; + new Sip::Configuration::Service $service; + $listeners{lc $service->{port}} = $service; } $cfg->{listeners} = \%listeners; foreach my $inst (values %{$cfg->{institutions}}) { - new Sip::Configuration::Institution $inst; + new Sip::Configuration::Institution $inst; } return bless $cfg, $class; @@ -77,24 +84,21 @@ sub new { sub error_detect { my $self = shift; - return $self->{'error-detect'}; } sub timeout { my $self = shift; - return $self->{'timeout'} } sub accounts { my $self = shift; - return values %{$self->{accounts}}; } sub find_service { - my ($self, $sockaddr, $port, $proto) = @_; + my ( $self, $sockaddr, $port, $proto ) = @_; my $portstr; $proto = lc($proto); diff --git a/Sip/Constants.pm b/Sip/Constants.pm index 9f136a1..bdfe341 100644 --- a/Sip/Constants.pm +++ b/Sip/Constants.pm @@ -29,9 +29,10 @@ use strict; use warnings; use Exporter; -our (@ISA, @EXPORT_OK, %EXPORT_TAGS); +our (@ISA, @EXPORT_OK, %EXPORT_TAGS, $VERSION); BEGIN { + $VERSION = 0.02; @ISA = qw(Exporter); %EXPORT_TAGS = ( diff --git a/Sip/MsgType.pm b/Sip/MsgType.pm index 6805294..edcefc8 100644 --- a/Sip/MsgType.pm +++ b/Sip/MsgType.pm @@ -36,10 +36,11 @@ use Sip::Checksum qw(verify_cksum); use Data::Dumper; -our (@ISA, @EXPORT_OK); +our (@ISA, @EXPORT_OK, $VERSION); @ISA = qw(Exporter); @EXPORT_OK = qw(handle); +$VERSION = 0.02; # Predeclare handler subroutines use subs qw(handle_patron_status handle_checkout handle_checkin diff --git a/t/SIPtest.pm b/t/SIPtest.pm index 4205263..e339464 100644 --- a/t/SIPtest.pm +++ b/t/SIPtest.pm @@ -27,6 +27,7 @@ use Exporter; use Data::Dumper; our @ISA = qw(Exporter); +our $VERSION = 0.02; our @EXPORT_OK = qw(run_sip_tests no_tagged_fields $datepat $textpat