Hello Monks,

Apologies for the second sequential question, but I keep getting stack one question after the other.

I am trying to follow the tutorial Simple Module Tutorial in order to configure the code to my needs so I can use it on my module.

The error that I am getting is very common, but I can not find a solution or at least an indication on what I am doing wrong.

I have installed my molule Net::SNTP::Client by applying the following commands:

perl Makefile.PL make make test sudo make install

After I installed the Module::Starter from CPAN.

I assume that this is the reason that I am getting this error, so I tried to reinstall the module after the modification on the module file but the error remains the same.

Undefined subroutine &main::func1 called at client.pl line 9.

Can someone help understand what I am doing wrong?

Update 1: Adding client.pl script.

#!/usr/bin/perl use strict; use warnings; my @list = qw (J u s t ~ A n o t h e r ~ P e r l ~ H a c k e r !); use Net::SNTP::Client qw(&func1); print func1(@list),"\n";

Update 2: Adding Net::SNTP::Client.pm module.

#!/usr/bin/perl use strict; use warnings; use Exporter qw(import); package Net::SNTP::Client; our $VERSION = v5.18.2; # Or higher... our @ISA = qw(Exporter); our @EXPORT = (); our @EXPORT_OK = qw(func1 func2); our %EXPORT_TAGS = ( # Mappings for :shortcuts. DEFAULT => [ qw(&func1) ], BOTH => [ qw(&func1 &func2) ] ); sub func1 { return reverse @_ } sub func2 { return map{ uc }@_ } 1;

Final Update: Apologies for confusing so many people that tried to help me, by not been able to understand my problem.

I just figure it out. Not knowing something can lead to so many mistakes and disappointment!

Everyone is absolutely right, The way that I define my folders on my module was completely wrong!!!!!!!

I named my module literally Net::SNTP::Client.pm although that I read that when the module will be installed this will mean that will be in the directory Net/SNTP/Client I completely forgot about it and proceed with naming the module like this. So when I defined package Net::SNTP::Client.pm I ignored the fact that I need to create a directory Net/SNTP/ and include my module Client.pm

Of course when I was trying to load the module it was not able to see the directory since they do not match. So I simply used the use lib '/home/username/Desktop/Test/'; before loading my module and modified also the directories accordingly. I had to rename my module to Client.pm instead of Net::SNTP::Client.pm and voilą!

Expected output:

!rekcaH~lreP~rehtonA~tsuJ

Apologies for not been able to understand and explain my problem properly. I have confused to many people that tried to help me.

Thank you again in advance for your time and effort.

Seeking for Perl wisdom...on the process of learning...not there...yet!

In reply to Undefined subroutine &main::func1 [SOLVED] by thanos1983

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.