[ale] Converting C data structures to Perl

Fletch fletch at phydeaux.org
Mon Apr 21 20:57:37 EDT 2003


>>>>> "Christopher" == Christopher Fowler <cfowler at outpostsentinel.com> writes:

    Christopher> Hello,

    Christopher> I've got my data parsed and having a issue try to
    Christopher> make it accessible throughout the program.

Erm, if it's parsed in perl then why are you talking about C
structures . . . /me is confuzlled . . .

    Christopher> Here is a refernce in C

    Christopher> struct device { char *name; char *user; char *pass; }

    Christopher> struct unit { char ip; struct device **d; };

    Christopher> struct unit **unit; // Array of units

If you really do have it as C pointery-fun data you could use unpack
and some deep wizardry, but for something as involved as this it'd
probably be much easier to write your own API using either XS or
Inline::C.  Start with perldoc perlxstut and perldoc perlxs for the
former, or look for the Inline documentation on search.cpan.org for
the later (which might be easier to pick up).


-- 
Fletch                | "If you find my answers frightening,       __`'/|
fletch at phydeaux.org   |  Vincent, you should cease askin'          \ o.O'
770 294-0820 (m)      |  scary questions." -- Jules                =(___)=
                      |                                               U
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale





More information about the Ale mailing list