in reply to Re: IPC::SharedMem::stat using Class::Struct (UPDATED)
in thread IPC::SharedMem::stat using Class::Struct

the module does not have a separate pack and unpack method ... the module is using the core pack and unpack of Perl

Sorry, that's not correct. As the AM post pointed out, those methods are coming from XS, specifically SysV.xs. It appears the job of IPC::SharedMem::stat::unpack is to take the fields of struct shmid_ds and store them in a Perl object of type IPC::SharedMem::stat (defined in IPC::SharedMem).

Replies are listed 'Best First'.
Re^3: IPC::SharedMem::stat using Class::Struct (UPDATED)
by thanos1983 (Parson) on Sep 29, 2017 at 13:03 UTC

    Hello haukex,

    Thanks for correcting my assumption(s). The AM showed some code that possibly is an older version. I was under the impression that an older version was using internal implemented methods (pack and unpack). From the latest documentation on perldoc/IPC::SharedMem/SYNOPSIS is shown as an example:

    $shm->write(pack("S", 4711), 2, 2);

    I assumed that pack from the example above is the core pack. I also checked the source code from CPAN Source and I was unable to find the pack and unpack methods until I saw:

    sub stat { my $self = shift; my $data = ''; shmctl $self->id, IPC_STAT, $data or return undef; IPC::SharedMem::stat->new->unpack($data); }

    Thanks again for clearing things out. BR / Thanos.

    Seeking for Perl wisdom...on the process of learning...not there...yet!