Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2009
    Posts
    1

    Unanswered: 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

  2. #2
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •