J
JustMe
Hi All,
Given:
package x;
sub new { return bless {}, $_[0]; }
#-- callback() is call by the C++ class (reader_as_cpp_object)
#-- whenever an event is detected.
sub callback {
my ($self, $ref_to_an_event_object) = @_;
print $ref_to_an_event_object->data();
}
package main;
use reader_as_cpp_object;
my $x = x->new();
my $reader = reader_as_cpp_object->new($x)
$reader->read( 'afile.txt' ) # Reader is a reference to a C++ class
I've got the callback working just fine. The problem I can't seem to
solve, is how to pass the sub callback() a reference to a C++ object
that was created by the C++ object reader_as_cpp_object.
All of the examples I've seen assume that object is create via an
action from the perl program. E.g.
my $object = cow->new();
I've read perlgut, perlapi, perlxs, perlxstut, cookbookA and
cookbookB, and googled all day and I'm still no closer to a solution.
Anyone have an example and or suggestion?
Thanks
Eric
Given:
package x;
sub new { return bless {}, $_[0]; }
#-- callback() is call by the C++ class (reader_as_cpp_object)
#-- whenever an event is detected.
sub callback {
my ($self, $ref_to_an_event_object) = @_;
print $ref_to_an_event_object->data();
}
package main;
use reader_as_cpp_object;
my $x = x->new();
my $reader = reader_as_cpp_object->new($x)
$reader->read( 'afile.txt' ) # Reader is a reference to a C++ class
I've got the callback working just fine. The problem I can't seem to
solve, is how to pass the sub callback() a reference to a C++ object
that was created by the C++ object reader_as_cpp_object.
All of the examples I've seen assume that object is create via an
action from the perl program. E.g.
my $object = cow->new();
I've read perlgut, perlapi, perlxs, perlxstut, cookbookA and
cookbookB, and googled all day and I'm still no closer to a solution.
Anyone have an example and or suggestion?
Thanks
Eric