in reply to Re: Relative paths in included files
in thread Relative paths in included files

Yes! That's exactly what I was looking for. Thank you very much.

Andy

Replies are listed 'Best First'.
Re^3: Relative paths in included files
by a,s5 (Initiate) on Jun 05, 2004 at 03:22 UTC
    Krang! No, sorry to reply to my own post here. It doesn't quite work.

    The FindBin::Real module does an admirable job of finding the directory for the calling script. But if there are any files included that use it, it fails in them. I want to find something that works an arbitrary number of levels deep. Here's the situation:

    /test.pl
    (in this context, Bin() should return '/')
    ('require's Bin()/config.pl and Bin()/scrape_courses/scrape_courses.pl)

    /scrape_courses/scrape_courses.pl
    (in this context, I want Bin() to return '/scrape_courses')
    ('require's Bin()/../config.pl and Bin()/scrape_courses.template)

    When I run test.pl, it gives me this error Cannot find current script './test.pl' at /scrape_courses/scrape_courses.pl line 30

    So it's still not doing just what I need: every file, 'require'd some arbitrary number of levels deep, needs to know the full path to itself without being hard coded.

    Thanks,
    Andy