in reply to Re^3: Finding module directory from within module
in thread Finding module directory from within module

Example:

$ mkdir foo $ cat > foo/Module.pm package Module; use Cwd qw( realpath ); use Path::Class qw( file ); print( "absolute: ", file(__FILE__)->absolute->dir, "\n"); print( "realpath: ", file(realpath(__FILE__))->dir, "\n"); 1; $ perl -Mlib=foo -e'use Module' absolute: /tmp/ikegami/foo realpath: /tmp/ikegami/foo $ ln -s foo bar $ perl -Mlib=bar -e'use Module' absolute: /tmp/ikegami/bar realpath: /tmp/ikegami/foo $ mkdir baz $ ln -s ../foo/Module.pm baz/Module.pm $ perl -Mlib=baz -e'use Module' absolute: /tmp/ikegami/baz realpath: /tmp/ikegami/foo

Replies are listed 'Best First'.
Re^5: Finding module directory from within module
by Anonymous Monk on Jul 30, 2009 at 07:50 UTC
    So how does it make a difference? They both take you to the same directory
      No they don't. foo and baz are different directories.