Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

The sub my_excer does actually return @retval which contains the values from $itm. Your debugging print statements do not demonstrate this. Nor do you show the subs() method which you pass @retval to - this is probably where your problem lies as you seem to have enough print statements in your code to demonstrate that you are getting what you expect just before the return @retval. BTW you do not need to use prototypes for your subs the way you do. With $item you are passing a reference to a reference which is unnecessary and you then have to dereference it which make your code less clear.

else { my $id = $$item->id; print "printing the item id\n"; print "$id\n"; $SQL = qq[SELECT u.puid, up.prod_id FROM users u, user_product +s up WHERE ((u.puid = up.puid) AND (u.parent_puid = $id) AND (up.from_date < SYSDATE) AND (up.to_date IS NULL OR up.to_date > SYSDATE))]; } my @RETVAL = my_execer($SQL); print "Hey I got something back!" if $#RETVAL > 0; print 'I got this back\n", Dumper(\@RETVAL); ${$item}->subs(@RETVAL); # <-- here is problem I think print Dumper $$item; foreach my $subitem ($$item->subs) { find_subs(\$subitem); } return $item;




In reply to Re: bugs... by tachyon
in thread subroutine not returning expected value by Anonymous Monk

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others rifling through the Monastery: (7)
    As of 2021-01-28 12:03 GMT
    Find Nodes?
      Voting Booth?