I am trying to get a perl script to run my own installed module. I am getting the below message.

 Undefined subroutine &testdir::testsub called at call_module line 11.

I installed the module using the following code

 module-starter --module=testdir::moduletest --author="Sherman Willden" --email=PedalSteel.E9B6@gmail.com --license=perl --verbose

The install directory is /home/sherman/module_test/share/perl/5.14.2/testdir/moduletest.pm. I am including the .pm code and the .pl code. The perl file calling the .pm file works when I use require.

#! /usr/bin/perl # # moduletest.pm package testdir::moduletest; use Exporter(); # Why is Exporter white while other use # statements are colored $VERSION = '0.00.01'; @ISA = qw(Exporter); @EXPORT = qw(testsub); @EXPORT_OK = qw($string); sub testsub { =head1 SUBROUTINE The testsub subroutine is just a test function that determines that four variables are seen with the testsub function and returns a string created within the testsub function. =cut print "In my testsub function\n"; print "\$_[0]: \"$_[0]\"\n"; print "\$_[1]: \"$_[1]\"\n"; print "\$_[2]: \"$_[2]\"\n"; print "\$_[3]: \"$_[3]\"\n"; my $string = "My string\n"; return("$string"); } 1; __END__ =head1 NAME testdir::moduletest =head1 SYNOPSIS Provides one called function, testsub =head1 DESCRIPTION This is a test module with provides valued passed in, print statements that show the variables passed in, a string created and returned from with testsub =head1 AUTHOR Sherman L. Willden =head1 COPYRIGHT Copyright 2013, Sherman L. Willden. All Rights Reserved This program is free software. You may copy or redistribute it under the same terms as Perl itself. =cut

Here is the callin perl file's code:

#! /usr/bin/perl -w # module_test.pl use V5.14.2; use lib '/home/sherman/module_test/share/perl/5.14.2'; # Since this didn't work I am checking for my path within # the perl path print qq(@INC); # require '/home/sherman/build_dir/testdir/moduletest.pm'; my $moduletest = testdir::testsub(0,2,0,2); chomp($moduletest); print "moduletest: \"$moduletest\"\n"; 1;

In reply to Cannot call my installed module by ShermW0829

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.