I'm wrapping a module into an addon. I want to run a standard nodejs script 
when the module gets initialized, so that I only have to do "node mymodule" 
from the command line. As far as I can see none of the usual module apis 
are exposed. How can I do it then? Here's what I've tried:
 

> #include <node.h> 
>
#include <v8.h>
>

> using namespace v8;

 

void init(Handle<Object> target) {
>
      Script::New(String::New( " console.log(typeof(require)); "))->Run(); * // 
> typeof(required)==='undefined'*

      Script::Compile(String::New( " console.log(typeof(require)); 
> "))->Run(); *  // typeof(required) is also 'undefined'*
>
}
>

> NODE_MODULE(mymodule, init)


Thank you.

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to