App::perl2js - A module that transpile Perl code to JavaScript as readable as possible.
use App::perl2js::Converter; print App::perl2js::Converter->new->convert(q[ package Hoge; sub hoge { my $self = $_[0]; if ($_[1]) { $self->{hoge} = $_[1]; } else { return $self->{hoge}; } } ]); # ---- output ---- # 'use strict'; # function print() { console.log.apply(console.log, arguments) } # ... some runtime helplers # # var Hoge = (function() { # var Hoge = { # hoge() { # if (this !== undefined) { Array.prototype.unshift.call(arguments, this) } # var $self = arguments[0]; # if (arguments[1]) { # $self["hoge"] = arguments[1]; # } else { # return $self["hoge"] # } # }, # } # return Hoge; # })(); # export { Hoge }
App::perl2js is a transpiler from Perl to JavaScript. this module aim to help porting from Perl to JavaScript, not to output runnable code.
Copyright (C) hatz48.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
hatz48 <hatz48@hatena.ne.jp>
To install App::perl2js, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::perl2js
CPAN shell
perl -MCPAN -e shell install App::perl2js
For more information on module installation, please visit the detailed CPAN module installation guide.