Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Setting the build directory for a module using Inline::C

by Corion (Patriarch)
on Apr 04, 2022 at 13:01 UTC ( [id://11142665]=note: print w/replies, xml ) Need Help??


in reply to Setting the build directory for a module using Inline::C

You need to move your use JavaScript::Duktape line outside of the BEGIN block, then it should work:

BEGIN { #mkdir '/tmp/pagecamel_helpers_javascript_inline'; $ENV{PERL_INLINE_DIRECTORY} = '/tmp/pagecamel_helpers_javascript_i +nline'; }; use JavaScript::Duktape;

The BEGIN { ... } block is first parsed, and during parsing, all use statements are executed when encountering them. This still executes the loading of the module too early for your directory to work.

Ideally, JavaScript::Duktape would move away from using Inline::C and instead distribute and use the XS file created by Inline::C, but that's something for a different time.

Replies are listed 'Best First'.
Re^2: Setting the build directory for a module using Inline::C
by cavac (Parson) on Apr 04, 2022 at 13:38 UTC

    Ah, yes. I thought i tried that. But that might have been after commenting out the mkdir statement. The solution seems to be:

    BEGIN { mkdir '/tmp/pagecamel_helpers_javascript_inline'; $ENV{PERL_INLINE_DIRECTORY} = '/tmp/pagecamel_helpers_javascript_i +nline'; }; use JavaScript::Duktape;

    Thanks Corion!

    As for JavaScript::DukTape: Yeah ideally this should compile at install-time. I'm currently trying out Inline::Module, to see it that would work with Duktape. If it does, i'll contact the original author and talk to them on how to proceed (send patches, take over module maintenance, whatever).

    perl -e 'use Crypt::Digest::SHA256 qw[sha256_hex]; print substr(sha256_hex("the Answer To Life, The Universe And Everything"), 6, 2), "\n";'
      I want to set the build directory "_Inline" to some other path

      I usually do this by setting the Inline config option "DIRECTORY" to the desired location.
      This requires that the specified directory already exists.
      It would also involve amending the code inside JavaScript:::DukTape ... I'm not sure if that's what you want.
      use warnings; use Inline C => Config => # C:/inline_build must already exist DIRECTORY => 'C:/inline_build', ; use Inline C =><<'EOC'; void foo() { printf("Hello World\n"); } EOC foo();
      Cheers,
      Rob

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11142665]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-19 22:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found