Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: error defined on hash

by kcott (Archbishop)
on Dec 22, 2015 at 15:54 UTC ( [id://1150965]=note: print w/replies, xml ) Need Help??


in reply to error defined on hash

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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-20 00:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found