Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Undefined subroutine &main::func1

by kcott (Archbishop)
on Jun 28, 2015 at 02:13 UTC ( [id://1132309]=note: print w/replies, xml ) Need Help??


in reply to Undefined subroutine &main::func1 [SOLVED]

G'day thanos1983,

"Can someone help understand what I am doing wrong?"

Well, for that to happen, you need to show us what you are doing! And, frankly, after all the time you've been here, you really should know this. Please read "How do I post a question effectively?" (again, if necessary).

My best guess, is that you've written code like:

use Net::SNTP::Client; ... func1();

When you should've written code like:

use Net::SNTP::Client; ... Net::SNTP::Client::func1();

or

use Net::SNTP::Client qw{func1}; ... func1();

-- Ken

Replies are listed 'Best First'.
Re^2: Undefined subroutine &main::func1
by thanos1983 (Parson) on Jun 28, 2015 at 02:20 UTC

    Hello kcott,

    Thank you for your time and effort reading and replying to my question.

    That is so true, I should have added the code it has a been long night here so my brain is extremely slow.

    Any way unfortunately I tried both of your solutions, very similar to my solution but again same error.

    This is the first time that I am using the Exporter module and not using Classes and Objects and I can not figure out why my code is not working.

    Seeking for Perl wisdom...on the process of learning...not there...yet!
      "Any way unfortunately I tried both of your solutions, very similar to my solution but again same error."

      The code you posted in your update has:

      use Net::SNTP::Client qw(&func1);

      But that update only shows client.pl. We have no idea what's in Net/SNTP/Client.pm!

      The suggestion I posted that's nearest to that is:

      use Net::SNTP::Client qw{func1};

      qw(&func1) (in client.pl) looks wrong to me, but I'm still just guessing!

      "This is the first time that I am using the Exporter module ..."

      Have you read, and fully understood, the documentation of Exporter.

      -- Ken

        Hello again kcott,

        So so tired, here the time is 4:50 am. I am still struggling to understand why is not working. Any way I have updated my code.

        I did read Exporter quickly not thoroughly but the code that I am using is taken from Simple Module Tutorial, so I assume it should work straight out of the box.

        Again thank you for your time and effort.

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1132309]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-26 08:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found