G'day Uli,

Welcome to the Monastery.

The bog standard response to this is to urge you to read "How do I post a question effectively?". However, you've obviously made some attempt to present a reasonably formatted question, and have said "My perl skills are very low", so let's work through it.

Firstly, do you want to fix the problem or just stick your head in the sand and pretend there's no problem at all? Stating "... the "no strict" is a no go ..." rather suggests the latter and, if that's the case, simply adding

no warnings;

is possibly all you need.

Read "perlintro: Safety net" (and follow the links therein) for more about this.

Now, assuming you haven't just yelled "Hurray! I got rid of the warning." and are still with me, delete the totally erroneous (and, no doubt, highly misleading) comment "# Return TRUE if $package contains $sub" (that's not what "my ($package, $sub) = @_;" is doing) as well as the "no strict;" (on the following line). Ensure you have these lines:

use strict; use warnings;

near the top of your script then rerun your script.

Next, you need to show us exactly what the error/warning messages are (as opposed to a prosaic description) within <code>...</code> tags. We also need to know how your calling &PkgContains which should include the context of that call.

With that information, we can provide you with a much better answer. I strongly suspect there's a much better way to do what you want but, without additional information, this is purely guesswork.

If you look through the documentation for defined, you'll no doubt see the reason for the deprecation warning.

You may also see a way to check whether a particular subroutine has been defined. Functions provided by UNIVERSAL may be better suited to this. Other options may exist depending on the specifics of what you're doing and the context in which you're doing them.

— Ken


In reply to Re: error defined on hash by kcott
in thread error defined on hash by audiomobster

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.