Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Ruby's tap() in Perl

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 t
Octocat-spinner-32 xt
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .shipit
Octocat-spinner-32 Changes
Octocat-spinner-32 MANIFEST.SKIP
Octocat-spinner-32 Makefile.PL
Octocat-spinner-32 README
Octocat-spinner-32 README.mkdn
README.mkdn

NAME

UNIVERSAL::tap - Ruby's tap()

SYNOPSIS

use UNIVERSAL::tap;

package MyClass;
use base 'Class::Accessor::Fast';
__PACKAGE__->mk_accessors('foo', 'bar');

package main;

my $obj = MyClass->new->tap(sub {
    my $self = shift;
    $self->foo('baz');
    $self->bar('quux');
});

print $obj->foo; # => 'baz'
print $obj->bar; # => 'quux'

DESCRIPTION

This module exports tap() into every modules.

METHODS

tap

This method evaluates code block with instance as an argument, and returns instance.

$module->tap(sub { ... })->method_defined_in_module;

AUTHOR

NAKAGAWA Masaki masaki@cpan.org

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Something went wrong with that request. Please try again.