in reply to Re: Logging module sometimes writes its file in the wrong directory
in thread Logging module sometimes writes its file in the wrong directory

Do you think that I should just get rid of the
BEGIN { if ($::dir) { $dir = $::dir; } else { $0 =~ '(.*[\\\/])\w+\.\w+$'; $dir = $1; } }

And just use
use File::Basename; my $dir = dirname($0);

in the module?

Replies are listed 'Best First'.
Re^3: Logging module sometimes writes its file in the wrong directory
by CountOrlok (Friar) on May 03, 2006 at 17:33 UTC
    If you want to use the directory where your script is, then yes. You can also use:
    use FindBin qw($Bin); my $dir = $Bin;
    -imran
    Update: if you want to open the file in the current directory that you are in, don't use $dir, just do open with the filename. This is unless a chdir was done.