JoT
JoT

Reputation: 301

error of importing DBI in Perl

I am writing the code in Perl and try to save it in the extension .pm not .pl

and I use use DBI; to import the DBI in order that I can execute the query.

and the error is compilation failed in require.

However, I did use in script.pl , it s okay.. it works..

Please help and thank you very much

Upvotes: 0

Views: 258

Answers (2)

ikegami
ikegami

Reputation: 385789

"Compilation failed in require" indicates compilation cannot continue beyond that point due to an earlier error. Solve the earlier error and this one will go away.

Upvotes: 1

Sven Eppler
Sven Eppler

Reputation: 1706

You probably simply miss the "1;" at the end of the .pm file.

Perl modules always have to return a "true" value. This is accomplished by simply putting "1;" at the end of the file.

More information can be found in the example code of Perl Modules in the perlmod documentation.

Upvotes: 4

Related Questions