NAME
C::Blocks::Filter::BlockArrowMethods - invoke methods succinctly
SYNOPSIS
use strict;
use warnings;
use C::Blocks;
use C::Blocks::Filter::BlockArrowMethods;
cblock {
/* These are equivalent */
a=>some_thing(arg1, arg2);
a->methods->some_thing(a, arg1, arg2);
}
DESCRIPTION
When invoking methods on vtable-based classes, you need to extract the method by dereferencing the vtable, and then you have to pass the object as the first argument of the method. If the vtable pointer is registered under the name methods
, you might invoke the method some_action
as
obj->methods->some_action(obj, other, args);
The C::Blocks::Filter::BlockArrowMethods
filter would let you use the following more succinct statement:
obj=>some_action(other, args);
This would be converted to the previous more verbose example.