Class::HPLOO::InlineC

Class::HPLOO::InlineC is a Perl module that adds a pseudo syntax over C to work easier with SV*, AV*, HV* and RV*.
Download

Class::HPLOO::InlineC Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Graciliano M. P.
  • Publisher web site:
  • http://search.cpan.org/~gmpassos/

Class::HPLOO::InlineC Tags


Class::HPLOO::InlineC Description

Class::HPLOO::InlineC is a Perl module that adds a pseudo syntax over C to work easier with SV*, AV*, HV* and RV*. Class::HPLOO::InlineC is a Perl module that adds a pseudo syntax over C to work easier with SV*, AV*, HV* and RV*.Who have worked with XS and perlapi knows that to access values from AV* and HV*, and work with references is not very friendly. To work arounf that I have added a pseudo syntax over the C syntax, that helps to work easily with SV*, AV*, HV* and RV*.USAGE use Class::HPLOO ; class Point { sub Point ($x , $y) { $this->{x} = $x ; $this->{y} = $y ; } sub move_x( $mv_x ) { $this->{x} += $mv_x ; } sub void move_y( SV* self , int mv_y ) { int y = self->{y}->int + mv_y ; self->{y} = int2sv(y) ; } sub SV* get_xy_ref( SV* self ) { AV* ret = newAV() ; ret-> = self->{x} ; ret-> = self->{y} ; return {ret} ; } } my $p = Point->new(10,20) ; $p->move_x(100) ; $p->move_y(100) ; my $xy = $p->get_xy_ref() ; ## returns an ARRAY reference. print "XY> @$xyn" ; ## XY> 110 120As you can see, is very easy to access and set an integer value from $Point->{y} (at self). Also is simple to create an ARRAY and return a reference to it.Requirements:· Perl Requirements: · Perl


Class::HPLOO::InlineC Related Software