I am trying to get my head around creating my own module. I have got the following out of the Perl Cookbook and am having some difficulties. I have gone through SuperSearch but have not been able to find my answers

Given the following module which I called Test.pm and located in the c:/perl/site/lib dir ...
##Test Module package Test; use strict; use warnings; require Exporter; use vars qw(@ISA @EXPORT); my @ISA = qw(Exporter); my @EXPORT = qw( Prt Time ); sub Prt { my $string = shift; print &Time() . "- $string\n"; } sub Time { my @localdate = localtime(time); my $tme = sprintf("%02d:%02d:%02d", $localdate[2], $localdate[1], +$localdate[0]); return($tme); } 1;
I am using the following code to try and call a subroutine and pass it a string(only for this VERY BASIC test)..
#! /usr/bin/perl use strict; use warnings; use Test; print "About to use Module\n"; &Prt("This is a test in the Mod"); print "Finished\n";
This is what I get...

About to use Module Undefined subroutine &main::Prt called at C:\dev\Source_Perl\MiscTests +\mod.pl line 8.
I tried changing line 8. to
&Test::Prt("This is a test in the Mod");
as well as

Test::Prt("This is a test in the Mod");

as was suggested in a previous post but still get the same output.

Any help would be greatly appreciated.
J9

In reply to Undefined subroutine by J9

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.