The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

FFI::Platypus::Record::TieArray - Tied array interface for record array members

VERSION

version 0.31

SYNOPSIS

 package Foo;
 
 use FFI::Platypus::Record;
 use FFI::Platypus::Record::TieArray;
 
 record_layout(qw(
   int[20]  _bar
 ));
 
 sub bar
 {
   my($self, $arg) = @_;
   $self->_bar($arg) if ref($arg) eq ' ARRAY';
   tie my @list, 'FFI::Platypus::Record::TieArray', 
     $self, '_bar', 20;
 }
 
 package main;
 
 my $foo = Foo->new;
 
 my $bar5 = $foo->bar->[5];  # get the 5th element of the bar array
 $foo->bar->[5] = 10;        # set the 5th element of the bar array
 @{ $foo->bar } = ();        # set all elements in bar to 0
 @{ $foo->bar } = (1..5);    # set the first five elements of the bar array

DESCRIPTION

WARNING: This module is considered EXPERIMENTAL. It may go away or be changed in incompatible ways, possibly without notice, but not without a good reason.

This class provides a tie interface for record array members.

In the future a short cut for using this with FFI::Platypus::Record directly may be provided.

SEE ALSO

FFI::Platypus

The main Platypus documentation.

FFI::Platypus::Record

Documentation on Platypus records.

AUTHOR

Author: Graham Ollis <plicease@cpan.org>

Contributors:

Bakkiaraj Murugesan (bakkiaraj)

pipcet

Zaki Mughal (zmughal)

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by Graham Ollis.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.