[ale] Converting C data structures to Perl
Chris Fowler
cfowler at outpostsentinel.com
Mon Apr 21 21:18:43 EDT 2003
Maybe I'm doing something wrong with it, Because even if I simplify
down to an array of hashes like this,
%device1 = {
ip => "192.168.2.231",
name => "bubba",
pass => "password",
};
%device2 = {
ip => "192.168.2.231",
name => "bubba",
pass => "password",
};
@unit = (%device1, %device2);
print $array[0]{name};
I do not get a name displayed.
On Mon, 2003-04-21 at 20:57, Fletch wrote:
> >>>>> "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
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale
More information about the Ale
mailing list