Jano Svitok
1/11/2007 8:30:00 PM
On 1/11/07, Matthew Hailstone <matthew.hailstone@gmail.com> wrote:
> Looks like __FILE__ and $0 are the same.
Not necessarily... when running a script under rcov or similar, they
may differ (for example one starts with ./ while the other does not).
That's why I write the if __FILE__ == $0 idiom as
if File.expand_path(__FILE__) == File.expand_path($0)
Another possibility might be is when you start the script using $PATH,
i.e. not from current directory, but without specifying its path.