-1

As I am Novice to Perl, I would be happy if you are able to solve my problem.

I created a Module named "Messages.pm" and it resides in the path "E:\Venkadachalam\Perl_samples\Modules\Messages.pm"

Also I included this module in another Perl file named "Main.pl" as show below

use Modules::Messages;

and invoked the subroutine defined in the Messaged.pm in the Main.pl

In the Command Window, I tried executing the above perl program as

perl -I E:\Venkadachalam\Perl_samples\Modules\Messages.pm Main.pl

Here it gives an error message as shown below:

"Can't locate Modules/Messages.pm in @INC (@INC contains: E:/Venkadachalam/Perl_s
ample/Modules C:/Perl/site/lib C:/Perl/lib .) at Main.pl line 1
BEGIN failed--compilation aborted at Main.pl line 1"

Any help is highly appreciated.

Benjamin Leinweber
  • 2,774
  • 1
  • 24
  • 41
Venki
  • 31
  • 1
  • 4

1 Answers1

2

You are saying use Modules::Messages; and pointing the lib to E:/Venkadachalam/Perl_sample/Modules. So it is expecting lib to be E:/Venkadachalam/Perl_sample/Modules/Modules/Messages.pm.

Change it to E:/Venkadachalam/Perl_sample

Doc

bhb
  • 2,476
  • 3
  • 17
  • 32
  • E:\Venkadachalam\Perl_sample\Modules> perl -I E:\Venkadachalam\Perl_sample Main.p l Modules/Messages.pm did not return a true value at Main.pl line 1. BEGIN failed--compilation aborted at Main.pl line 1. – Venki Oct 07 '13 at 11:41
  • Above is the Error Coming to me. – Venki Oct 07 '13 at 11:43
  • 1
    That's a different question then. Briefly, a valid module needs to have `1;` at the end. Actually, all of this is documented, and eminently googlable. – tripleee Oct 07 '13 at 14:52