Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^5: Use of uninitialized value $pic

by haukex (Bishop)
on Apr 25, 2017 at 06:28 UTC ( #1188820=note: print w/replies, xml ) Need Help??


in reply to Re^4: Use of uninitialized value $pic
in thread Use of uninitialized value $pic

Moving onto my next problem.

As this question is unrelated to the rest of the thread, it'd have been better to post it in a new thread.

You don't need to construct a new Image::Magick over the argument passed to the subroutine. The normal way to handle arguments is (see perlsub):

sub ImageNotDark { my ($iutImage,$arg2,$arg3,...) = @_; # --OR-- my $iutImage = shift; my $arg2 = shift; ...

Or, if your intention were to work with a copy of the image in the subroutine, you could simply do my $imgCopy = $_[0]->Clone(); inside the subroutine.

Replies are listed 'Best First'.
Re^6: Use of uninitialized value $pic
by dazz (Sexton) on Apr 25, 2017 at 10:57 UTC
    Hello
    That is diamond advice.
    My Google search results had not found the perlsub doc and I found conflicting or/and confusing advice around handling objects passed to subs.
    I am sure this will be helpful to others. I will raise this as a separate question and include your answer for the benefit of others who hit the same problem.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2020-10-21 08:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (212 votes). Check out past polls.

    Notices?