Loading ...
Sorry, an error occurred while loading the content.

Re: Creating and using a module

Expand Messages
  • jonathan.mark2@dyncorp.com
    use lib LIST adds the directories specified in LIST to Perl s search path. Since in your case uniden is a module and not a directory you get an error. If
    Message 1 of 4 , Dec 2, 2001
    • 0 Attachment
      'use lib LIST' adds the directories specified in LIST to Perl's
      search path. Since in your case uniden is a module and not a
      directory you get an error.

      If you remove the keyword lib and simply say 'use uniden' then Perl
      looks for uniden.pm in the same directory as uniden.pl. I fixed your
      script and it works. In fact, you can see your script's output at
      http://www.jonathanmark.com/tempo3.pl







      --- In perl-beginner@y..., John Mayson <kc4vjo@q...> wrote:
      > I am trying to create and use a Perl module. I'm starting out very
      simple just as an example. Anyone know why it doesn't work? The .pm
      file are in the @INC.
      >
      > _____________________uniden.pm____________________
      > package uniden;
      >
      > use strict;
      >
      > $VERSION = "0.00";
      >
      > sub allclear {
      >
      > print "AC\n";
      >
      > }
      >
      > __END__
      >
      >
      >
      > _________________uniden.pl______________________
      > #!/usr/bin/perl
      >
      > use lib uniden;
      >
      > uniden::allclear();
      > __END__
      >
      > --
      > John Mayson KC4VJO Linux/Perl/HP-UX/ICT
      > Austin, Texas 78729 30.4560N 97.7851W
      > jmayson.ee92@g... http://www.nyx.net/~jmayson
    Your message has been successfully submitted and would be delivered to recipients shortly.