Remove smartmatch/given/when to work with Perl 5.18

NOTE: The change from ~~ to == on line 65 is experimental, and may cause
issues.