DEV Community

Jonas Brømsø
Jonas Brømsø

Posted on

Release 1.30 of Date::Holidays - more holiday for the French

I received a PR (#53) some time ago, but due to being busy with other open source activities I did not get around to to it right away.

The PR was a bug fix to the Perl distribution Date::Holidays, which is an adapter class for a namespace/set of distribution on CPAN.

This was a minor fix to US holiday calendar adapter and it was most welcome - thanks @qorron.

Release 1.30, the first release in over a year, is now available on CPAN.

After a few days I checked the CPAN-testers reports and they did not look as good as I expected.

Date::Holidays Test Results for release 1.30

I checked the reports which was coming in and they reported issue with Date::Holidays::FR, which is one of the distributions adapted by Date::Holidays.

The test-suite for Date::Holidays has some tests which assert the adaptability of the different distributions and if they break the contract or, as in this case, fulfill the contract the test breaks.

I looked at the latest release of Date::Holidays::FR and it's changes and guess who was responsible for the breaking tests - me!

0.04 2021-01-27

  • follow the guidelines for Date::Holidays::XX modules (thanks to JONASBN)
  • clean up the code (thanks again JONASBN)

I had completely forgotten that I had contributed to the Date::Holidays::FR distribution and because I had not run any tests, I had not discovered the change.

On a timeline:

2020-11-13          2021-01-27              2022-03-01
D::H release 1.29   D::H::FR release 0.04   D::H release 1.29
Enter fullscreen mode Exit fullscreen mode

I have followed up with:

  • Date::Holidays release 1.31 today
  • Task::Date::Holidays release 0.11 yesterday

Both repositories have been configured with scheduled test runs, so a test run is made every 30 days, so we will not observe these long periods, where obvious bugs can roam.

Task::Date::Holidays is a helper distribution, which downloads everything Date::Holidays, which makes it faster and easier to develop.

From .github/workflows/ci.yaml

name: Dist::Zilla Action
    - cron: '0 * */30 * *'

    runs-on: ubuntu-latest
    name: "dzil run"
      - name: "Checkout repository"
        uses: actions/checkout@v3
      - name: "Installing dependencies and testing all using dzil"
        uses: jonasbn/github-action-perl-dist-zilla@0.2.0
          dzil-arguments: 'test --all'
Enter fullscreen mode Exit fullscreen mode

I think the capability of running scheduled actions, can be but to valuable use and I have some other repositories that can benefit from something similar, so I will dig some more into this.

Now we have more holiday for the French, I hope the scheduled jobs will not interfere with my holiday plans.

Top comments (6)

matthewpersico profile image
Matthew O. Persico

I must be dense today - where are the holiday listings?

jonasbn profile image
Jonas Brømsø

Hi @matthewpersico

Well I do not really outline that, so it is not you being dense, the release announcement is somewhat internal from that point of view, so let me try describe it more thoroughly.

On CPAN a lot of distributions emerged, inspired by each other, which implemented calendars for different countries. The distributions used API patterns where the name of the country was embedded in the API naming. For example the Danish calendar implementation exposed:

  • is_dk_holiday
  • dk_holidays

And the French calendar implemention:

  • is_fr_holiday
  • fr_holidays

This API would make is hard to implement a sort of polymorphic interface to all of the marvelous calendar data - so I created Date::Holidays, which implemented adapters and a common interface. In addition I created an abstract class and a generic super class:

So I could educate myself on:

  • OOP, inheritance and aggregation
  • the adapter pattern

Over the years more and more distributions have implemented the proposed generic API of:

  • is_holiday
  • holidays

In addition to the methods with the embedded country name. And now the French calendar also holds this implementation.

I have create a diagram to explain it visually:

diagram of Date::Holidays and related classes

So long story short, they are in Date::Holidays::FR

matthewpersico profile image
Matthew O. Persico

Thank you for such a detailed reply! That was above and beyond what was necessary.

Thread Thread
jonasbn profile image
Jonas Brømsø

Thanks, but I was thinking about extending the documentation with that information, so you just sort of got first draft.

Thread Thread
matthewpersico profile image
Matthew O. Persico

I don't mind beta testing...

Thread Thread
jonasbn profile image
Jonas Brømsø

Thanks @matthewpersico I will let you know, when I have a draft ready