Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Thank you, that's definitely interesting, but not exactly suit my taste ;) I tried to make a quick example with it and failed. First, my timeincl contains two files:
$ perl -V:timeincl timeincl='/usr/include/x86_64-linux-gnu/sys/time.h /usr/include/time.h + ';
Second, it seems not that easy to make it parse time.h, you may have to add some include directories and define some macros, depending on the system, so it is not that portable. I stopped with this:
use 5.010; use strict; use warnings; use Convert::Binary::C; use Config; my $c = Convert::Binary::C->new; $c->Include( '/usr/include', '/usr/include/x86_64-linux-gnu/sys/', '/usr/include/x86_64-linux-gnu/' )->Define('__WORDSIZE=64'); $c->parse_file('/usr/include/x86_64-linux-gnu/sys/time.h'); my $timeval = $c->pack( 'struct timeval', { tv_sec => 1, tv_usec => 0 +} );
And it gave me
bits/wordsize.h, line 7: macro '__WORDSIZE' redefined unidentically included from /usr/include/x86_64-linux-gnu//sys/cdefs.h:378 included from /usr/include/features.h:357 included from /usr/include/x86_64-linux-gnu/sys/time.h:23 at pack_ line 10.
I probably would be able to make it work on my particular system, but not in general case. And it requires that includes were installed on a target system, which may not be the case.

In reply to Re^2: Packing struct timeval by zwon
in thread Packing struct timeval by zwon

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!
  • 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
  • Outside of code tags, you may need to use entities for some characters:
            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 pondering the Monastery: (6)
    As of 2015-02-01 01:06 GMT
    Find Nodes?
      Voting Booth?

      My top resolution in 2015 is:

      Results (262 votes), past polls