maard has asked for the wisdom of the Perl Monks concerning the following question:

Dear monks!

After reading perldoc -f pack and perldoc perlpacktut I still can't solve one task.

I need to modify fields of some structure, whose address is returned to my perl app by some dll/so. I know how to get the struct to perls side and unpack its fields. But what I cannot understand, is how to write the modified (and packed) structure back. Because I need to tell pack(or unpack?) to write data of given length to given address.

Maybe i'm stuck into something obvious, but just can't understand it?

Replies are listed 'Best First'.
Re: modify external data
by Joost (Canon) on Mar 05, 2005 at 14:31 UTC
Re: modify external data
by Thelonious (Scribe) on Mar 05, 2005 at 16:16 UTC
    PeekPoke might work.

    use PeekPoke qw(peek poke); my $val = peek($address); poke($address, $val|1);

      Thank you. However it didn't work :)

      Joost pointed me to right direction, I have read XS tutorial some time ago, waiting for task to arise, where I could use it and study it more, on practice. The time has come.