doesn't *have* to, but does for ease of use -- it defaults some paths 
relative to the caller's (the module require()ing) module location... 
obviously there are other approaches such as forcing the require()er to 
pass in those paths rather than defaulting them.

i'm not all that seasoned in the node space, but i haven't gotten a whiff 
of hell yet... anything in particular that drums up the smell of hell for 
you that I should be aware of?

On Monday, November 12, 2012 3:46:29 AM UTC-5, greelgorke wrote:
>
> guess there is no other way. but the whole task smells like hell to me. 
> why does your module need to know who required it?
>
> Am Samstag, 10. November 2012 15:02:50 UTC+1 schrieb boden:
>>
>> hi all,
>> trying to find the proper way to determine the path of the module 
>> requiring my module given the following requirements:
>>
>> * must be strict mode complaint
>> * cannot depend on node arguments (i.e. process.argv)
>> * must work when being required from different modules in the same 
>> execution (i.e. my module is already cached)
>>
>> i ended up patching Module._load() to capture the request and then 
>> wrapping it in a closure like shown here: 
>> https://github.com/bodenr/expose/blob/master/index.js
>>
>> however this doesn't feel right -- i must be missing something.
>>
>> thx in advanced
>>
>

-- 
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