--- Shlomi Fish <[EMAIL PROTECTED]> wrote:
> >
> >   sub add_user : Tests(5) {
> >       my $test = shift;
> >       my $mech = $test->mech;
> >
> >       my $override = override_if_fixture(
> >           test => $test,
> >           mech => $mech,
> >           overrides => {
> >               get_ok       => sub {
> >                   my ( $mech, $page ) = @_;
> >                   $mech->get($page);
> >               },
> >               content_like => sub {},
> >           }
> >       );
> 
> Maybe I'm missing something, but in your second example, you declare
> $override as a lexical and don't use it anywhere. May I inquire what
> was your real intention?

It holds the overrides in scope so that when $override is DESTROYed, we
can roll back the changes to &get_ok and &content_like.

Cheers,
Ovid

--

Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/

Reply via email to