in reply to How do I test a script that doesn't have a .pl extension

require_ok does two things - it requires modules by filename ("Foo/Bar.pm"), and requires modules by module name ("Foo::Bar").

It uses heuristics to figure out what you're trying to do. If it sees a dot or a slash in the string you give it, it assumes a filename. If it sees a double-colon, then it assumes a module name. (Actually, I'm simplifying; it uses a couple of interesting regexps, but for practical purposes, let's assume that what I've said is the case.) Your string has neither, so it's taking a wild stab in the dark and assuming a module name, not a filename.

Untested, but require_ok("./foo") might do the trick.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Replies are listed 'Best First'.
Re^2: How do I test a script that doesn't have a .pl extension
by Anonymous Monk on Nov 02, 2012 at 07:03 UTC
    Nope, ./ breaks the searching of @INC, "foo\0" doesn't