pythonizer
pythonizer copied to clipboard
Translator (or more correctly transcriber) from Perl to Python
Translation of: return; to: return() actually returns an empty tuple. The proper code should be: return
`my @arr = ` generates incorrect code. The `my` throws it off into generating `readline()` instead of `readlines()`.
Multiple undef's in a list unpack only generate one in the python code. For example: (undef, undef, $i) = @arr; Will generate: [Null, i] = arr
The -v 0 option should make the script run quietly. The output to the terminal should be suppressed with this option.
Implement the perl `reverse` function. See https://perldoc.perl.org/functions/reverse
Diamond operator with glob expression generates bad code. For example: while() ... Empty diamond operator `` is supposed to read all the files from `@ARGV`, but instead only reads `STDIN`....
Open generates an empty argument when trying to open an expression instead of a scalar. For example: open(FY, $dir.'/'.$file);
Pythonizer can't handle lines with only ; Error produced: `Use of uninitialized value $ValClass[0] in string eq at ../pythonizer line ...`
Pythonizer can't handle whitespace after q, qq, qw, etc, for example: use Fcntl qw (:flock); it sets the delimiter to `' '` and keep looking until it finds another space...
LHS substr generates bad code. For example: sub THE {"THE"} substr($string,0,3) = THE; generates: replacement79.= string=string[:0 3=