AutoXS::Accessor - Identify accessors and replace them with XS


AutoXS documentation  | view source Contained in the AutoXS distribution.

Index


NAME

Top

AutoXS::Accessor - Identify accessors and replace them with XS

SYNOPSIS

Top

  package MyClass;
  use AutoXS plugins => 'Accessor';

  # or load all installed optimizing plugins
  use AutoXS ':all';

  sub new {...}
  sub get_foo { $_[0]->{foo} }
  sub other_stuff {...}

  # get_foo will be auto-replaced with XS and faster

DESCRIPTION

Top

This is an example plugin module for the AutoXS module. It searches the user package (MyClass above) for read-only accessor methods of certain forms and replaces them with faster XS code.

RECOGNIZED ACCESSORS

Top

Note that whitespace, a trailing semicolon, and the method names don't matter. Also please realize that this is not a source filter.

  sub get_acc { $_[0]->{acc} }

  sub get_bcc {
    my $self = shift;
    $self->{bcc}
  }

  sub get_ccc {
    my $self = shift;
    return $self->{ccc};
  }

  sub get_dcc { return $_[0]->{dcc} }

  sub get_ecc { shift->{ecc} }

  sub get_fcc {
    my ($self) = @_;
    $self->{fcc}
  }

  sub get_gcc {
    my ($self) = @_;
    return $self->{gcc};
  }

  sub get_icc {
    my ($self) = shift;
    $self->{icc}
  }

  sub get_jcc {
    my ($self) = shift;
    return $self->{jcc};
  }

SEE ALSO

Top

AutoXS

Class::XSAccessor

AUTHOR

Top

Steffen Mueller, <smueller@cpan.org>

COPYRIGHT AND LICENSE

Top


AutoXS documentation  | view source Contained in the AutoXS distribution.