commit 72d3cb2fea726d1e9655803a08f2df67a0ededd3
Author: Ray Mroz <mroz@cpan.org>
Date: Tue Dec 21 04:32:36 2010 -0400
Some cleaning up, checking in version 0.17
diff --git a/MANIFEST b/MANIFEST
index 2a2d4e2..1b2abff 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,6 +1,13 @@
Changes
+GPL.txt
Makefile.PL
MANIFEST
README
+RFC3927.txt
t/LinkLocal-IPv4-Interface.t
lib/LinkLocal/IPv4/Interface.pm
+lib/LinkLocal/IPv4/Interface/ARP.pm
+lib/LinkLocal/IPv4/Interface/Cache.pm
+lib/LinkLocal/IPv4/Interface/Constants.pm
+lib/LinkLocal/IPv4/Interface/Logger.pm
+lib/LinkLocal/IPv4/Interface/Types.pm
\ No newline at end of file
diff --git a/README b/README
index 46b94a6..73b0284 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-LinkLocal-IPv4-Interface version 0.16
+LinkLocal-IPv4-Interface version 0.17
=====================================
This package represents a lightweight, pure Perl implementation of the specification
diff --git a/lib/LinkLocal/IPv4/Interface.pm b/lib/LinkLocal/IPv4/Interface.pm
index a0fcb92..dfaf280 100644
--- a/lib/LinkLocal/IPv4/Interface.pm
+++ b/lib/LinkLocal/IPv4/Interface.pm
@@ -1,6 +1,6 @@
package LinkLocal::IPv4::Interface;
-our $VERSION = '0.16';
+our $VERSION = '0.17';
require 5.010_000;
diff --git a/lib/LinkLocal/IPv4/Interface/ARP.pm b/lib/LinkLocal/IPv4/Interface/ARP.pm
index 639a480..9e35a8c 100644
--- a/lib/LinkLocal/IPv4/Interface/ARP.pm
+++ b/lib/LinkLocal/IPv4/Interface/ARP.pm
@@ -1,6 +1,6 @@
package LinkLocal::IPv4::Interface::ARP;
-our $VERSION = '0.16';
+our $VERSION = '0.17';
require 5.010_000;
@@ -22,7 +22,14 @@ require 5.010_000;
use Moose;
use Moose::Util::TypeConstraints;
use LinkLocal::IPv4::Interface::Types;
+
+use Net::Frame::Layer::ETH qw(:consts);
use Net::Frame::Simple;
+use Net::Frame::Dump::Online;
+use Net::Frame::Device;
+use Net::Write::Layer2;
+use Net::Netmask;
+
# ==========
# = packet =
@@ -42,6 +49,7 @@ has 'packet' => (
coerce => 1,
);
+
sub send {
my $this = shift;
# TODO Handle send, packet object will be passed into a "sender machine"
@@ -55,8 +63,7 @@ __PACKAGE__->meta->make_immutable;
=head1 NAME
LinkLocal::IPv4::Interface::ARP - An ARP packet wrapper, this class allows for the easy construction
-of either Probe or Announce ARP Requests, both of which are central to dynamic link-local address
-configuration.
+of either link-local Probe or Announce ARP Requests.
=head1 SYNOPSIS
diff --git a/lib/LinkLocal/IPv4/Interface/Cache.pm b/lib/LinkLocal/IPv4/Interface/Cache.pm
index ef14793..ea021c3 100644
--- a/lib/LinkLocal/IPv4/Interface/Cache.pm
+++ b/lib/LinkLocal/IPv4/Interface/Cache.pm
@@ -1,6 +1,6 @@
package LinkLocal::IPv4::Interface::Cache;
-our $VERSION = '0.16';
+our $VERSION = '0.17';
require 5.010_000;
@@ -46,7 +46,6 @@ sub _build_cache {
my $filename; # Cache file name
try {
-
# Determine the file name based on OS
given ($^O) {
when ( m/linux/ || m/bsd/ ) { # Linux || (Free|Open|Net)BSD
@@ -67,7 +66,7 @@ sub _build_cache {
}
# Create IO::File object and return
- return new IO::File( "$filename", O_RDWR | O_CREAT );
+ return new IO::File( $filename, O_RDWR | O_CREAT );
}
catch {
die "Error while opening cache file: $!";
diff --git a/lib/LinkLocal/IPv4/Interface/Constants.pm b/lib/LinkLocal/IPv4/Interface/Constants.pm
index a476e45..38ddeae 100644
--- a/lib/LinkLocal/IPv4/Interface/Constants.pm
+++ b/lib/LinkLocal/IPv4/Interface/Constants.pm
@@ -1,6 +1,6 @@
package LinkLocal::IPv4::Interface::Constants;
-our $VERSION = '0.16';
+our $VERSION = '0.17';
# Copyright (C) 2010 Raymond Mroz
#
diff --git a/lib/LinkLocal/IPv4/Interface/Logger.pm b/lib/LinkLocal/IPv4/Interface/Logger.pm
index 319164c..e8d4909 100644
--- a/lib/LinkLocal/IPv4/Interface/Logger.pm
+++ b/lib/LinkLocal/IPv4/Interface/Logger.pm
@@ -302,7 +302,7 @@ class type.
Refer to RFC-3927, I<Dynamic Configuration of IPv4 Link-Local Adresses>, the complete
text of which can be found in the top level of the package archive.
-L<perl>, L<Moose>, L<MooseX::Params::Validate>, L<Sys::Syslog>
+L<perl>, L<Moose>, L<MooseX::Params::Validate>, L<Sys::Syslog>, L<Try::Tiny>
This project is also hosted on github at:
git@github.com:raymroz/LinkLocal--IPv4.git
diff --git a/lib/LinkLocal/IPv4/Interface/Types.pm b/lib/LinkLocal/IPv4/Interface/Types.pm
index 2c50ca6..453de2e 100644
--- a/lib/LinkLocal/IPv4/Interface/Types.pm
+++ b/lib/LinkLocal/IPv4/Interface/Types.pm
@@ -1,6 +1,6 @@
package LinkLocal::IPv4::Interface::Types;
-our $VERSION = '0.16';
+our $VERSION = '0.17';
require 5.010_000;
commit b6cf37ce8f08a0aa7bcf7caf77d7fdfa215c5fd4
Author: Ray Mroz <mroz@cpan.org>
Date: Sun Dec 19 15:38:22 2010 -0400
Added Try::Tiny exception checking to Logger.pm
diff --git a/Makefile.PL b/Makefile.PL
index 48fcc1f..74b8542 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -6,7 +6,7 @@ use ExtUtils::MakeMaker;
WriteMakefile(
'NAME' => 'LinkLocal::IPv4::Interface',
- 'VERSION_FROM' => 'lib/LinkLocal/IPv4/Interface.pm', # finds $VERSION
+ 'VERSION_FROM' => 'lib/LinkLocal/IPv4/Interface.pm',
'BUILD_REQUIRES' => {
'FindBin' => '0',
'Moose::Role' => '0',
diff --git a/README b/README
index 5097488..46b94a6 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-LinkLocal-IPv4-Interface version 0.15
+LinkLocal-IPv4-Interface version 0.16
=====================================
This package represents a lightweight, pure Perl implementation of the specification
diff --git a/lib/LinkLocal/IPv4/Interface/Logger.pm b/lib/LinkLocal/IPv4/Interface/Logger.pm
index 2777e70..319164c 100644
--- a/lib/LinkLocal/IPv4/Interface/Logger.pm
+++ b/lib/LinkLocal/IPv4/Interface/Logger.pm
@@ -4,10 +4,26 @@ our $VERSION = '0.16';
require 5.010_000;
+# Copyright (C) 2010 Raymond Mroz, Tony Li Xu
+#
+# 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/>.
+
use LinkLocal::IPv4::Interface::Types;
-use Sys::Syslog qw/ :standard :macros /;
use Moose;
use MooseX::Params::Validate;
+use Try::Tiny;
+use Sys::Syslog qw/ :standard :macros /;
use feature ':5.10';
@@ -56,75 +72,130 @@ sub open_log {
facility => { isa => 'Str', optional => 1, default => 'user' }
);
- openlog( $params{indent}, $params{options}, $params{facility} );
+ try {
+ openlog( $params{indent}, $params{options}, $params{facility} );
+ }
+ catch {
+ die "Unable to open syslog instance for writing: $!";
+ };
}
sub _set_log_mask {
my $this = shift;
- setlogmask( ~( &Sys::Syslog::LOG_MASK(NOTICE) ) );
+ try {
+ setlogmask( ~( &Sys::Syslog::LOG_MASK(NOTICE) ) );
+ }
+ catch {
+ die "Error while setting log mask: $!";
+ };
}
sub emerg {
my $this = shift;
my ($message) = pos_validated_list( \@_, { isa => 'Str' } );
- syslog( 'emerg', "%8s: %s", "Emerg", $message );
+ try {
+ syslog( 'emerg', "%8s: %s", "Emerg", $message );
+ }
+ catch {
+ die "Error while writing to syslog: $!";
+ };
}
sub alert {
my $this = shift;
my ($message) = pos_validated_list( \@_, { isa => 'Str' } );
- syslog( 'alert', "%8s: %s", "Alert", $message );
+ try {
+ syslog( 'alert', "%8s: %s", "Alert", $message );
+ }
+ catch {
+ die "Error while writing to syslog: $!";
+ };
}
sub critical {
my $this = shift;
my ($message) = pos_validated_list( \@_, { isa => 'Str' } );
- syslog( 'crit', "%8s: %s", "Critical", $message );
+ try {
+ syslog( 'crit', "%8s: %s", "Critical", $message );
+ }
+ catch {
+ die "Error while writing to syslog: $!";
+ };
}
sub error {
my $this = shift;
my ($message) = pos_validated_list( \@_, { isa => 'Str' } );
- syslog( 'err', "%8s: %s", "Error", $message );
+ try {
+ syslog( 'err', "%8s: %s", "Error", $message );
+ }
+ catch {
+ die "Error while writing to syslog: $!";
+ };
}
sub warning {
my $this = shift;
my ($message) = pos_validated_list( \@_, { isa => 'Str' } );
- syslog( 'warning', "%8s: %s", "Warning", $message );
+ try {
+ syslog( 'warning', "%8s: %s", "Warning", $message );
+ }
+ catch {
+ die "Error while writing to syslog: $!";
+ };
}
sub notice {
my $this = shift;
my ($message) = pos_validated_list( \@_, { isa => 'Str' } );
- syslog( 'notice', "%8s: %s", "Notice", $message );
+ try {
+ syslog( 'notice', "%8s: %s", "Notice", $message );
+ }
+ catch {
+ die "Error while writing to syslog: $!";
+ };
}
sub info {
my $this = shift;
my ($message) = pos_validated_list( \@_, { isa => 'Str' } );
- syslog( 'info', "%8s: %s", "Info", $message );
+ try {
+ syslog( 'info', "%8s: %s", "Info", $message );
+ }
+ catch {
+ die "Error while writing to syslog: $!";
+ };
}
sub debug {
my $this = shift;
my ($message) = pos_validated_list( \@_, { isa => 'Str' } );
- syslog( 'debug', "%8s: %s", "Debug", $message );
+ try {
+ syslog( 'debug', "%8s: %s", "Debug", $message );
+ }
+ catch {
+ die "Error while writing to syslog: $!";
+ };
}
sub close_log {
my $this = shift;
- closelog();
+ try {
+ closelog();
+ }
+ catch {
+ die "Error while closing syslog: $!";
+ };
}
no Moose;