I have some awk scripts that use gawk from cygwin. Now I need to pass these scripts to colleagues that don’t have cygwin installed, but do have Perl. I was hoping I can just use a2p that is included in cygwin, but it fails with errors like the following:
Undefined subroutine &main::gensub called at ./t.pl line 18, <> line 1.
I am hoping there are existing Perl libraries/modules that implement these methods. Any pointers?
The
gensub()function isn’t supported bya2p. If you modify your code to usegsub()instead then it should compile.Alternatively, you could add a
gensub()subroutine to the end of the translated Perl program to simulate thegensub()functionality.However, the Perl code produced by
a2pisn’t very maintainable so I’d only use it as a last resort.If your gawk program doesn’t make calls to other cygwin/unix utilities then it would probably be better to just distribute a Windows gawk executable to your colleagues along with the program.