NAME post526sigfix - Fixup attribute/signatures code between 5.26 and 5.28+ style SYNOPSIS Usage: post526sigfix [OPTIONS] [FILES] post526sigfix -u perl526file >perl528file post526sigfix -d perl528file >perl526file post526sigfix -d --pmc lib/My/Module.pm >lib/My/Module.pmc post526sigfix -u -i $(find lib -name '*.pm') post526sigfix -d -i --pmc $(find lib -name '*.pm') Options: -u, --upgrade Upgrade 5.26 syntax to 5.28 syntax -d, --downgrade Downgrade 5.28 syntax to 5.26 syntax -i, --inplace Modify target file(s) in place --pmc Generate .pmc w/goto::file to load .pm on other versions INSTALLING There's a fatpacked copy currently available next to this file at: http://trout.me.uk/perl/post526sigfix WORKED EXAMPLE Starting with an unpacked List-Lazy-0.3.0 which was the last version to have attributes and signatures on the same subroutine, and perl 5.26 and 5.28 installs with its dependencies installed, perl526$ prove -l t # passes perl528$ prove -l t # explodes Now, if we run perl$ post526sigfix -u lib/List/Lazy.pm >lib/List/Lazy.pmc then we find that perl526$ prove -l t # explodes perl528$ prove -l t # passes Having tested the upgraded version works, we can upgrade the .pm in place - perl$ rm lib/List/Lazy.pmc perl$ post526sigfix -i -u lib/List/Lazy.pm and once again, perl526$ prove -l t # explodes perl528$ prove -l t # passes Now, to complete the fixage, we want to also create a .pmc file for the downgrade case, which we can do using either perl$ post526sigfix -d --pmc lib/List/Lazy.pm >lib/List/Lazy.pmc or the shorter perl$ post526sigfix -i -d --pmc lib/List/Lazy.pm This now means that as well as the 5.28 compatible .pm file, we have a 5.26 compatible .pmc file - and that pmc file starts with use if $] >= 5.028, 'goto::file', __FILE__; so if loaded on a 5.28+ perl, it automatically jumps back to the .pm file instead. Which means: perl526$ prove -l t # passes perl528$ prove -l t # passes (with the exception of t/00-compile.t which hardcodes .pm and so misses the .pmc on 5.26, but the functional tests do indeed all work) Which means that if he ever wants to, YANICK should totally be able to switch back to using attributes and signatures on the same subroutine again - and now it's (sort of) safe for you to use them both, too! AUTHOR mst - Matt S. Trout (cpan:MSTROUT) CONTRIBUTORS None yet. Well volunteered? :) COPYRIGHT Copyright (c) 2018 the post526sigfix "AUTHOR" and "CONTRIBUTORS" as listed above. LICENSE This library is free software and may be distributed under the same terms as perl itself.