LINUX CATEGORIES:



NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>

7-DAY TOP DOWNLOAD

#
Program
BackTrack 3.0 / 4.0
Pre-Final

5,487
Ubuntu 9.10
4,487
VLC 1.0.3
3,388
Wine 1.0.1 / 1.1.32
2,824
Yahoo Messenger
1.0.4

2,483
Adobe Flash Player
for Linux 10.0.32.18

2,320
Thunderbird PST
Import plugin 1.2

2,290
Mandriva Linux
2010.0

1,992
Super Grub Disk
0.9799

1,577
Yellow Dog Linux 6.2
1,441

WEEK'S BEST

  • Ubuntu 9.10
  • Ubuntu Netbook Rem...
  • Pidgin 2.6.3
  • Wine 1.0.1 / 1.1.32
  • Linux Kernel 2.6.3...
  • Mozilla Firefox 3....
  • Fedora 11
  • OpenOffice.org 3.1.1
  • Firestarter 1.0.3
  • The Gimp 2.6.7 / 2...
  • FileZilla 3.2.8.1 ...
  • Transmission 1.76
  • Super Grub Disk 0....
  • Gufw 9.04.2
  • Skype 2.0.072 / 2....
  • openSUSE Linux 11....
  • Opera 10.01 / 10.1...
  • Adobe Flash Player...
  • wine-doors 0.1.3
  • Google Gadgets 0.1...
  • Home / Linux / Programming / Libraries

    Want 0.18

    Download button

    No screenshots available
    Downloads: 136  Add to download basket  Tell us about an update
    User Rating:
    Rated by:
    Good (3.8/5)
    5 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Robin Houston | More programs
    Perl Artistic License / FREE
    February 4th, 2008, 17:49 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Add a review  Refer to a friend  Subscribe

     

    Want description

     

    Want is a Perl module created to implement the `want' command.

    Want is a Perl module created to implement the `want' command.

    SYNOPSIS

    use Want;
    sub foo :lvalue {
    if (want(qw'LVALUE ASSIGN')) {
    print "We have been assigned ", want('ASSIGN');
    lnoreturn;
    }
    elsif (want('LIST')) {
    rreturn (1, 2, 3);
    }
    elsif (want('BOOL')) {
    rreturn 0;
    }
    elsif (want(qw'SCALAR !REF')) {
    rreturn 23;
    }
    elsif (want('HASH')) {
    rreturn { foo => 17, bar => 23 };
    }
    return
    }

    This module generalises the mechanism of the wantarray function, allowing a function to determine in some detail how its return value is going to be immediately used.

    ...

    EXAMPLES

    use Carp 'croak';
    use Want 'howmany';
    sub numbers {
    my $count = howmany();
    croak("Can't make an infinite list") if !defined($count);
    return (1..$count);
    }
    my ($one, $two, $three) = numbers();


    use Want 'want';
    sub pi () {
    if (want('ARRAY')) {
    return [3, 1, 4, 1, 5, 9];
    }
    elsif (want('LIST')) {
    return (3, 1, 4, 1, 5, 9);
    }
    else {
    return 3;
    }
    }
    print pi->[2]; # prints 4
    print ((pi)[3]); # prints 1


    sub backstr :lvalue {
    if (want(qw'LVALUE ASSIGN')) {
    my ($a) = want('ASSIGN');
    $_[0] = reverse $a;
    return undef;
    }
    elsif (want('RVALUE')) {
    my $t = scalar reverse $_[0];
    }
    else {
    carp("Not in ASSIGN context");
    }
    return
    }

    print "foo -> ", backstr("foo"), "n"; # foo -> oof
    backstr(my $robin) = "nibor";
    print "$robin is now $robinn"; # $robin is now robin

    Requirements:

    · Perl

      


    TAGS:

    implement want | want command | Perl module | Want | implement | want



    HTML code for linking to this page:


    Go to top

    Windows tabGames tabDrivers tabMac tabLinux tabScripts tabMobile tabHandheld tabGadgets tabNews tab

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   ENTER NEWS SITE   |   ENGLISH BOARD   |   ROMANIAN FORUM