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

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!

Replies are listed 'Best First'.
Re^3: Undefined subroutine &main::func1
by kcott (Archbishop) on Jun 28, 2015 at 02:45 UTC
    "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!
        "So so tired, here the time is 4:50 am. ..."

        Then get some sleep!

        "I did read Exporter quickly not thoroughly ..."

        Well there's a problem! Go and read it, not just glance at it, after you awake and are refreshed.

        "... but the code that I am using is taken from Simple Module Tutorial, ..."

        No, it's not! Look again, after you awake and are refreshed.

        "... so I assume it should work straight out of the box."

        I don't think it would have got Reputation: 315 (no significant downvotes), if it didn't work.

        However, you're not using it "straight out of the box". You've made significant changes to it!

        After you've had some sleep and are refreshed, go through the tutorial code and your code, line by line, and note all the differences.

        Then, the next step will be to make your code look more like the tutorial code. When you've done that, you'll probably find that it works just fine.

        -- Ken