There are some newer web technologies that seem to lack Perl libraries (for example WebAuthn). However, most of these technologies do have PHP implementations, alongside other common languages like Python or Ruby. Since PHP is generally similar in syntax to Perl, it occurred to me a library like this one could reasonably simply be reimplemented in Perl. As I scan the code, it's hard to spot much that would be difficult to rewrite as Perl code.
I could do it by going line by line and replacing whatever was done in PHP in Perl syntax instead, but it made me think, "if only there were a set of regex for things that are easy to convert," e.g. variable declarations, switching from class
to sub
, etc. That would save an enormous amount of time.
I haven't been able to find anything to do PHP to Perl translation, am I missing it or is it just a matter that it hasn't been implemented? (Realizing manual work will need to be done, just trying to figure out how to do the obvious stuff with as little manual intervention as possible.)
UPDATE: I discovered there is a WebAuthn library I'd missed on CPAN, but the question might still be worth asking, since that is just an example -- not the only time such a semi-automated translation might be useful.