fglock / Perlito

"Perlito" Perl programming language compiler
http://fglock.github.io/Perlito/
Other
414 stars 47 forks source link

perldoc -f open (and possibly some other related filehandle functions?) is not implemented yet #29

Closed shlomif closed 8 years ago

shlomif commented 9 years ago

perldoc -f open (and possibly some other related filehandle functions?) is not implemented yet. If I do using the fc-solve git master this:

shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ bash /home/shlomif/progs/freecell/git/fc-solve/cpan/Games-Solitaire-Verify/pack-for-perlito.bash > ~/e.js
shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ pi-make-microsoft-freecell-board -t 24 | fc-solve -p -t -sam -sel > ~/24.sol
shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ node ~/e.js ~/24.sol

/home/shlomif/e.js:7145
                                                p5or(p5pkg["Games::Solitaire::Verify::App::CmdLine::Expand"].open([v_fh,
                                                                                                             ^
TypeError: Object [object Object] has no method 'open'
    at tmp499 [as run] (/home/shlomif/e.js:7145:68)
    at p5call (/home/shlomif/e.js:156:44)
    at /home/shlomif/e.js:7172:2
    at Object.<anonymous> (/home/shlomif/e.js:7173:3)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)

Please look into fixing it.

Regards,

-- Shlomi Fish

fglock commented 9 years ago

If you will run this in the browser, you will need to provide the i/o operations. Where is the file stored? Maybe you need to define "open" to be an AJAX operation, or to access data from an html element.

If running in node.js then take a look at: src5/lib/Perlito5/Javascript2/IO.pm

2014-12-14 13:08 GMT+01:00 Shlomi Fish notifications@github.com:

perldoc -f open (and possibly some other related filehandle functions?) is not implemented yet. If I do using the fc-solve git master this:

shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ bash /home/shlomif/progs/freecell/git/fc-solve/cpan/Games-Solitaire-Verify/pack-for-perlito.bash > ~/e.js shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ pi-make-microsoft-freecell-board -t 24 | fc-solve -p -t -sam -sel > ~/24.sol shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ node ~/e.js ~/24.sol

/home/shlomif/e.js:7145 p5or(p5pkg["Games::Solitaire::Verify::App::CmdLine::Expand"].open([v_fh, ^ TypeError: Object [object Object] has no method 'open' at tmp499 as run at p5call (/home/shlomif/e.js:156:44) at /home/shlomif/e.js:7172:2 at Object. (/home/shlomif/e.js:7173:3) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16)

Please look into fixing it.

Regards,

-- Shlomi Fish

— Reply to this email directly or view it on GitHub https://github.com/fglock/Perlito/issues/29.

shlomif commented 9 years ago

@fglock: thanks for the input - I'll try.

fglock commented 9 years ago

note that slurp() is implemented. if you just need to read a whole file:

src5/lib/Perlito5/Grammar/Use.pm
236:    my $source = Perlito5::IO::slurp( $realfilename );
fglock commented 8 years ago

this works now:

$ node perlito5.js -I src5/lib -e ' my $f; open $f, "<", "perlito5.pl"; print <$f> '

Do not edit this file - Generated by Perlito5 9.0

...

shlomif commented 8 years ago

Thanks for fixing it!