On Mon, Nov 12, 2012 at 3:22 AM, boden <[email protected]> wrote:
> 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? If you're making assumptions about your caller, you're likely asking for trouble, now or in the future. For an example, see: https://github.com/joyent/node/issues/4233#issuecomment-10046241 -- Martin Cooper 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<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 > -- 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
