I don't think this is the right way to do what you want. According to Verilog::Netlist::Net, dump_drivers is for debugging purposes. Since it doesn't give many more details about what it does, you should not rely on it to provide output in a consistent manner. It could change any any time in the future.

Looking at the source code, dump_drivers prints to STDOUT. So, to capture its output into a variable, you'd probably have to use select. But, I don't think that's worth it.

The reason you see 0 but true is because that is the return value of the last statement executed by sub dump_drivers:

flush STDOUT;

You should gather all the info you need for each pin as you descend through the Verilog module hierarchy.

UPDATE: Again, I don't recommend it, but to capture the STDOUT, you could do something like:

my $fh; my $out; my $old_stdout; open $fh, '>', \$out; $old_stdout = select $fh; my $x = $pin->net->dump_drivers(); select $old_stdout; close $fh; print $out; # This has the output you want

In reply to Re: Problem with storing values (Verilog::Netlist::Net) by toolic
in thread Problem with storing values by mavericknik

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.