and maintainer of:
A spanish guy contacted me, since he wanted to implement Date::Holidays::ES. He had some issues with Date::Holidays, which proofed to be a bug.
So I went through the module, which was getting more and more hard to maintain with weird exceptions in all corners of the module.
I added Kwalitee and Perl::Critic tests and started to clean, since there is more to good code than passing these tests
I read up on the Adapter pattern and thought that this was just what I needed.
Here are the Changes for the 0.09 release:
- Added no_indexing of t/ directory to Build.PL
- Updated README with pod2text appending of Date::Holidays POD
- Code cleaned a bit, much work still to be done
- Wrote some better DIAGNOSTICS and added 3 more Exceptions
- Added a few tests adapters for some of the tests dating before the
refactoring (all tests now pass)
- Renamed _loader in Date::Holidays to _fetch and _load, see also the similar
methods in Date::Holidays::Adapter
_loader.t obsolete and removed
- Introduced use of Error (Exceptions) for better diagnostics:
- Refactored the whole thing to a variation of an object adapter pattern,
tests are located in t/Adapter:
- Set severity to 3 for Test::Perl::Critic test
ran code through perltidy to remove hard tabs
- Set severity to 4 for Test::Perl::Critic test
added use warnings statement
- Changed the constructor to no longer be able to initialize a shallow object.
If you want to make use of Date::Holidays ability to check all countries for
a given holiday please, use it using full namespace. POD updated
- Addressed issue with method calling problems, OOP vs. Procedural vs. the weird
mix I personally had boiled up, thanks to Florian Merges for reporting this.
This has resulted in a minor cleanup and again I can see that the current
architecture is not optimal, I am planning a major rewrite, to eliminate
the problems of handling new classes introduced in the Date::Holidays::*
I am not an authority of any kind, I just attempt to get things to play
New files introduced:
and the test classes (in t/lib/Date/Holidays):
- Updated MANIFEST.SKIP with more contemporary version
- Added t/critic.t, Test::Perl::Critic test, currently at severity 5.
In addition to this I changed the 'return undef's scattered all over the code
to simple return statements.
- Added t/kwalitee.t, Test::Kwalitee test, diabled check for symlinks since
it reacted on symlinked
.releaserc in directory, which however is NOT in the
distribution even though it thinks so
Added the following as a result of the Kwalitee test:
- Added use of Module::Load to Build.PL and to own _loader routine in
Date::Holidays. I also added:
t/_loader.t to isolate the actual test
This module might not be of much use in the real world, but at least it lets me practice a few things, which I do not always have the time with such isolated cases.
From Date::Holidays 0.09 I have gotten the following:
- Hands-on with the Adapter pattern
- More experience with Error and Exceptions in Perl
- A sense for some more of the best practices from PBP
- Try out with the distribution file layout of one-sub, one-test file so when refactoring you just introduce the tests with the new subs and the ones that go you simply delete the
- Use of
- Hands-on with the Komodo debugger
0.09 will result in a 0.10, when the smoke settles , but it felt good to get the refactoring done, much POD to be written though and more tests to be implemented.