The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Build Status

NAME

Module::Spy - Spy for Perl5

SYNOPSIS

Spy for class method.

use Module::Spy;

my $spy = spy_on('LWP::UserAgent', 'request');
$spy->and_returns(HTTP::Response->new(200));

my $res = LWP::UserAgent->new()->get('http://mixi.jp/');

Spy for object method

use Module::Spy;

my $ua = LWP::UserAgent->new();
my $spy = spy_on($ua, 'request')->and_returns(HTTP::Response->new(200));

my $res = $ua->get('http://mixi.jp/');

ok $spy->called;

DESCRIPTION

Module::Spy is spy library for Perl5.

FUNCTIONS

Module::Spy::(Class|Object) methods

SEE ALSO

The interface was inspired from Jasmine library http://jasmine.github.io/.

LICENSE

Copyright (C) Tokuhiro Matsuno.

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

AUTHOR

Tokuhiro Matsuno tokuhirom@gmail.com