If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Perl and the DBI > How to include file in perl

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-24-09, 03:02
dipak.abhani dipak.abhani is offline
Registered User
 
Join Date: Oct 2009
Posts: 1
How to include file in perl

Hello,

I have one question I have two file a.pl and b.pl in a.pl I have all subroutine and b.pl calls all the subroutine so I want to use require a.pl in in b.pl But I am getting below error message.

A.pl did not return a true value at

Can any one help me to resolve this?

Is there any module required for that?

Regards,
DIpak
Reply With Quote
  #2 (permalink)  
Old 11-01-09, 14:42
sco08y sco08y is offline
Registered User
 
Join Date: Oct 2002
Location: Baghdad, Iraq
Posts: 697
Sure. A perl module is actually run when it is used or required, and these functions will check the return value. So a sophisticated module can check for problems, and indicate them by return a false value.

If you're not checking for errors, all you need to do is make sure to return a true value, which is typically done by adding this to the end:

Code:
1;
Another note: generally, .pl indicates a script that actually does something, whereas .pm (for Perl Module) indicates a collection of related subs.

Recommended reading about perl modules. Especially, see the notes on the distinction between use and require. That whole site is very nice, of course, it is really just a copy of all the excellent documentation by typing:

Code:
perldoc perl
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On