Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Programming > Libraries

    Test::Resub 1.02

    Download button

    No screenshots available
    Downloads: 291  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    AirWave Wireless | More programs
    Perl Artistic License / FREE
    July 14th, 2007, 00:05 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    Test::Resub description

    Test::Resub is a lexically scoped subroutine replacement for testing.

    Test::Resub is a lexically scoped subroutine replacement for testing.

    SYNOPSIS

    #!/usr/bin/perl

    use Test::More tests => 4;
    use Test::Resub qw(resub);

    {
    package Somewhere;
    sub show {
    my ($class, $message) = @_;
    return "$class, $message";
    }
    }

    # sanity
    is( Somewhere->show('beyond the sea'), 'Somewhere, beyond the sea' );

    # scoped replacement of subroutine with argument capturing
    {
    my $rs = resub 'Somewhere::show', sub { 'hi' }, capture => 1;
    is( Somewhere->show('over the rainbow'), 'hi' );
    is_deeply( $rs->method_args, [['over the rainbow']] );
    }

    # scope ends, resub goes away, original code returns
    is( Somewhere->show('waiting for me'), 'Somewhere, waiting for me' );

    This module allows you to temporarily replace a subroutine/method with arbitrary code. Later, you can tell how many times was it called and with what arguments each time. You can also specify that the subroutine/method must get called, must not get called, or may be optionally called.

    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    lexical subroutine | subroutine testing | Perl module | Test::Resub | lexical | subroutine

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM