Etk_Bin * bin; Etk_Button * button; // assume the above initialized. etk_bin_child_set(bin, ETK_WIDGET(button); // and the get the button. button = ETK_BUTTON(etk_bin_child_get(bin)); #### $bin->ChildSet($button); $button = $bin->ChildGet(); #### package Etk::Bin; sub ChildSet { my $self = shift; my $widget = shift; # do some checks. child_set($self, $widget); # this is the XS call $self->{_CHILD} = $widget; } sub ChildGet { my $self = shift; return $self->{_CHILD} if $self->{_CHILD}; return child_get($self); }