Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Micro Mocking: using local to help test subs

by adrianh (Chancellor)
on Jan 13, 2003 at 01:19 UTC ( #226368=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    package DeepThought;
    
    ...
        my ($self, $n) = @_;
        print "$self says the answer is $n\n";
    };
    
  2. or download this
    use Test::More tests => 2;
    
    ...
        $o->foo();
        ok($ok, 'foo called bar');
    };
    
  3. or download this
    package Foo;
    use CGI;
    ...
        my $class = shift;
        bless {cgi => CGI->new}, $class;
    };
    
  4. or download this
    use Test::More tests => 1;
    
    ...
        my $o = Foo->new;
        ok($called, 'Foo->new called CGI->new');
    };
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://226368]
Approved by rob_au
Front-paged by sauoq
help
Chatterbox?
[thezip]: My project manager is asking "Why do we need this?" Ahem...
[Corion]: thezip: Wheee ;)
[stevieb]: LOL

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2017-02-23 18:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (350 votes). Check out past polls.