require "."; - did not return true value

its pretty legal, to make such require call as

require ".";

it gives such response:

. did not return a true value at line 2

is there any way, to not at this place.. Something like ->

requre "." || print "We didn't die!!!"; #this example doesnot work.

Thanks, quite a lot in advance.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave CrossModule AuthorCommented:
I think you need to take a closer look at the documentation for "require". It's online at

"require" does one of two things.

When "require" is followed by a number, it checks that the version of Perl running the code is at least that version. If not, exectuion stops with an error message.

When "require" is followed by a filename, that file must be a file containing Perl code. That code is loaded and made available to the current program. In order for Perl to ensure that the file has been loaded correctly, the last line of code in the loaded file must return a true value. This is usually achieved by putting "1;" as the last executable statement in the file. If the file doesn't return a true value then you get the error message that you are seeing.

Your 'require ".";' attempts to load the current working directory as Perl code. The current directory will never be valid Perl code so this statement will always generate the error that you are seeing.

I'm guessing here, but are you actually looking for the "use lib" statement, which adds directories to the list of directories that Perl searches for libraries? Perhaps you should try

use lib '.';


SiGiNAuthor Commented:
Well.. Actually, I found the way. It is:

require "."=~"z"."";

It was all about code injection.
Dave CrossModule AuthorCommented:
Umm... I'm not sure what you're trying to do, but that code is complete nonsense. It might compile (by some fluke) but it's really not going to do anything useful.
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

SiGiNAuthor Commented:
If there is any interest.. It's about passing code injection into Ikonboard

here is little bit of details:
Dave CrossModule AuthorCommented:
Ok, I've read that. Nick has found an insecurity in Ikonboard and posted a fix. I don't how that leads to you trying to "require" a directory.

I've taken a closer a look at your "solution". Here's what it does.

$ perl -MO=Deparse -e '"."=~"z"."";'
'.' =~ /z/ . '';

So Perl interprets it as

'.' =~ /z/

and then

. ''

The first expression returns an empty string as 'z' doesn't appear in '.' So all in all your code has the same effect as

require "";

And that (obviously) works, but I don't think it's what you wanted. Well, I suppose it might be as I really still have no idea what you're trying to do here.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SiGiNAuthor Commented:
That's exactly what I wanted - so the remote Ikonboard don't choke with error, but rather eval, vode which is suplied after my solution =)

Well.. Since, I've got my answer anyway, and since I don't see any option to close question, I will just award you with point

(Btw - is there any way, to close question?)
In future, if you really do not wish to accept one of the answers, you can request in Community Support to have your points refunded and the question closed by a moderator.
In this case, I think Davorg gave you the best answer possible and your points were well spent.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.