Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

«TypeError: Cannot call method 'require' of undefined» after compiling expand-solitaire-multi-card-moves #23

Open
shlomif opened this issue Oct 20, 2014 · 2 comments

Comments

@shlomif
Copy link
Collaborator

shlomif commented Oct 20, 2014

After I compile perlito and run it on the code here - https://github.com/shlomif/fc-solve/tree/Games-Solitaire-Verify--for-Perlito--Get-Rid-of-Getopt-Long , I'm getting an error:

shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ perl perlito5.pl -Cjs -I src5/lib/ -I/home/shlomif/progs/freecell/git/fc-solve/cpan/Games-Solitaire-Verify/Games-Solitaire-Verify/lib /home/shlomif/progs/freecell/git/fc-solve/cpan/Games-Solitaire-Verify/Games-Solitaire-Verify/script/expand-solitaire-multi-card-moves > ~/e.js
shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ node ~/e.js
/home/shlomif/e.js:2330
                p5pkg["Perlito5::Grammar::Use"]["require"]([p5str('Games::Solitaire::Verify:
                                                          ^
TypeError: Cannot call method 'require' of undefined
    at p5pkg.Fcntl.List_ISA (/home/shlomif/e.js:2330:45)
    at /home/shlomif/e.js:2389:4
    at Object.<anonymous> (/home/shlomif/e.js:8435: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)
    at node.js:906:3

Please look into fixing it.

Regards, -- @shlomif

@fglock
Copy link
Owner

fglock commented Oct 21, 2014

I believe this is because the pre-compiled script is already "detached"
from the compiler - it can't do "require" anymore. It can't also "do FILE"
or "eval STRING".

The compiler consists of the list of modules at the start of "src5/util/
perlito5.pl" - basically the Grammar and Emitter modules.

I'll look into a way to force linking the full compiler into the script if
it is needed anywhere at runtime. Alternately, this could be a compiler
command-line option, such as "-M".

2014-10-20 21:50 GMT+02:00 Shlomi Fish notifications@github.com:

After I compile perlito and run it on the code here -
https://github.com/shlomif/fc-solve/tree/Games-Solitaire-Verify--for-Perlito--Get-Rid-of-Getopt-Long
, I'm getting an error:

shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ perl perlito5.pl -Cjs -I src5/lib/ -I/home/shlomif/progs/freecell/git/fc-solve/cpan/Games-Solitaire-Verify/Games-Solitaire-Verify/lib /home/shlomif/progs/freecell/git/fc-solve/cpan/Games-Solitaire-Verify/Games-Solitaire-Verify/script/expand-solitaire-multi-card-moves > /e.js
shlomif@telaviv1:
/Download/unpack/perl/Perlito/Perlito$ node ~/e.js
/home/shlomif/e.js:2330
p5pkg["Perlito5::Grammar::Use"]["require"]([p5str%28'Games::Solitaire::Verify:
^
TypeError: Cannot call method 'require' of undefined
at p5pkg.Fcntl.List_ISA %28/home/shlomif/e.js:2330:45)
at /home/shlomif/e.js:2389:4
at Object. (/home/shlomif/e.js:8435: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)
at node.js:906:3

Please look into fixing it.

Regards, -- @shlomif https://github.com/shlomif


Reply to this email directly or view it on GitHub
#23.

@fglock
Copy link
Owner

fglock commented Dec 11, 2017

update on this: module pre-compilation is in the TODO list;

this is a low priority task because replacing "require" with "use" will precompile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants