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.