Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

HELP! - trouble returning values

by Anonymous Monk
on Sep 22, 2000 at 20:49 UTC ( #33654=perlquestion: print w/replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

My function call looks like this... my $mailbox = $conn->getMailboxAvailablity ( DOMAIN => $UserDomainName MAILBOX_LIST => $UserLoginName) Regardless of what the function looks like, it's returning HASH(0x222b4c) instead of a "T" or an "F" like I expect. Does anybody know why? Is that the right way to return a string value to my $mailbox variable?

Replies are listed 'Best First'.
Re: HELP! - trouble returning values
by Adam (Vicar) on Sep 22, 2000 at 20:58 UTC
    Please wrap code in <code> code tags </code>

    my $mailbox = $conn->getMailboxAvailablity ( DOMAIN => $UserDomainName MAILBOX_LIST => $UserLoginName)
    if $mailbox is HASH(0x222b4c) then getMailboxAvailability() is returning a hash reference. You need to dereference it. The clearest way (but definately not the only way or even the best way... TIMTOWTDI) is like this:
    my %dereferenced_hash = %{$hash_reference}; # of course, you can also access elements via the ref directly: print "yeah\n" if exists $$hashref{'key2'}; # or even print "insufficient\n" unless $hashref->{'balance'} > $request;
    But your question is a bit vague so I'm not sure what you are asking. You didn't post a complete subroutine, so I don't know what's really going on. But at least I can tell you how to deal with HASH(0x222b4c)
Re: HELP! - trouble returning values
by ncw (Friar) on Sep 22, 2000 at 21:02 UTC
    Which module are you trying to use?

    If that is real code you pasted then there is a comma missing after $UserDomainName. I suspect it isn't real code though, so could you make a short example and update your question with it so we can help further?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://33654]
[1nickt]: choroba Updated the PR, using Config instead of exposing the hackery. Using cpanfile-dump does not work to test, as shown in the earlier PR comment, even when using a binary built for a particular Perlbrew perl, the output seems to be
[1nickt]: ... from the system perl binary. Using cpanm --installdeps . does use the expected perl and tus the check acts correctly.
[choroba]: Nice, thanks. I'll look into it later, about to leave ATM.
[1nickt]: Aye-aye cap'n 🖖

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (10)
As of 2017-10-18 16:07 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (249 votes). Check out past polls.