Skip to content

Commit

Permalink
add a 'ref' callback
Browse files Browse the repository at this point in the history
  • Loading branch information
nothingmuch committed Dec 19, 2008
1 parent b6c61e0 commit e6da8da
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/Data/Visitor/Callback.pm
Expand Up @@ -103,6 +103,18 @@ sub visit {
return ( @_ == 1 ? $ret[0] : @ret );
}

sub visit_ref {
my ( $self, $data ) = @_;

my $mapped = $self->callback( ref => $data );

if ( ref $mapped ) {
return $self->SUPER::visit_ref($mapped);
} else {
return $self->visit($mapped);
}
}

sub visit_seen {
my ( $self, $data, $result ) = @_;

Expand Down

0 comments on commit e6da8da

Please sign in to comment.