From 360f77b3d74153e7be71f533cb36f2d40f7d13c7 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Wed, 7 Mar 2018 06:08:43 +0000 Subject: [PATCH] Various code fixes --- Changes.md | 10 ++++++++-- bin/timeline | 9 ++++----- lib/SVG/Timeline.pm | 8 +++++--- lib/SVG/Timeline/Event.pm | 3 +++ t/01-basic.t | 3 ++- t/load.t | 2 ++ xt/pod-coverage.t | 2 ++ xt/pod.t | 2 ++ 8 files changed, 28 insertions(+), 11 deletions(-) diff --git a/Changes.md b/Changes.md index dff17fb..d574bd7 100644 --- a/Changes.md +++ b/Changes.md @@ -1,5 +1,11 @@ # Change Log +## [0.0.6] - 2017-08-19 + +### Improved + +- Generally made the class easier to subclass. + ## [0.0.5] - 2017-08-19 ### Improved @@ -26,7 +32,7 @@ - Various packaing fixes for better kwalitee ## [0.0.1] - 2017-07-29 - + ### Added - + - All the things. Release early, release often. diff --git a/bin/timeline b/bin/timeline index 31fb164..64230fa 100755 --- a/bin/timeline +++ b/bin/timeline @@ -29,13 +29,13 @@ C) or an RGB string as recognised by SVG (e.g. C). An example input file might be: - World War I 1914 1918 - World War II 1939 1945 + World War I 1914 1918 + World War II 1939 1945 Or, with colours included: - World War I 1914 1918 red - World War II 1939 1940 blue + World War I 1914 1918 red + World War II 1939 1940 blue =head2 Command Line Options @@ -81,7 +81,6 @@ GetOptions( my $timeline = SVG::Timeline->new(%opts); -my @events; while (<>) { chomp; my %rec; diff --git a/lib/SVG/Timeline.pm b/lib/SVG/Timeline.pm index 0777eb4..21526d3 100644 --- a/lib/SVG/Timeline.pm +++ b/lib/SVG/Timeline.pm @@ -42,13 +42,10 @@ probably don't need any of these, but the following options are supported: =cut - package SVG::Timeline; use 5.010; -our $VERSION = '0.0.6'; - use Moose; use Moose::Util::TypeConstraints; use SVG; @@ -56,6 +53,8 @@ use List::Util qw[min max]; use Time::Piece; use Carp; +our $VERSION = '0.0.6'; + use SVG::Timeline::Event; subtype 'ArrayOfEvents', as 'ArrayRef[SVG::Timeline::Event]'; @@ -415,6 +414,9 @@ sub years { return $self->max_year - $self->min_year; } +no Moose; +__PACKAGE__->meta->make_immutable; + =head1 AUTHOR Dave Cross diff --git a/lib/SVG/Timeline/Event.pm b/lib/SVG/Timeline/Event.pm index 1e0d747..74c59e3 100644 --- a/lib/SVG/Timeline/Event.pm +++ b/lib/SVG/Timeline/Event.pm @@ -83,6 +83,9 @@ sub draw_on { )->cdata($self->text); } +no Moose; +__PACKAGE__->meta->make_immutable; + =head1 AUTHOR Dave Cross diff --git a/t/01-basic.t b/t/01-basic.t index 88916d1..70adfb5 100644 --- a/t/01-basic.t +++ b/t/01-basic.t @@ -1,4 +1,5 @@ - +use strict; +use warnings; use Test::More; use SVG::Timeline; diff --git a/t/load.t b/t/load.t index a8f5689..f9cf415 100644 --- a/t/load.t +++ b/t/load.t @@ -1,3 +1,5 @@ +use strict; +use warnings; use Test::More; BEGIN { diff --git a/xt/pod-coverage.t b/xt/pod-coverage.t index 03758e5..137d85e 100644 --- a/xt/pod-coverage.t +++ b/xt/pod-coverage.t @@ -1,3 +1,5 @@ +use strict; +use warnings; use Test::More; eval "use Test::Pod::Coverage 1.00"; plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage" if $@; diff --git a/xt/pod.t b/xt/pod.t index efb68f7..668bc9c 100644 --- a/xt/pod.t +++ b/xt/pod.t @@ -1,3 +1,5 @@ +use strict; +use warnings; use Test::More; eval "use Test::Pod 1.00";