LINUX CATEGORIES:



NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>

7-DAY TOP DOWNLOAD

#
Program
Chromium OS 0.4.22.8
4,365
BackTrack 3.0 / 4.0
Pre-Final

3,633
Wine 1.0.1 / 1.1.33
2,857
VLC 1.0.3
2,826
Yahoo Messenger
1.0.4

2,420
Chrome OS 0.4.237
Beta

2,095
Ubuntu 9.10
2,095
Thunderbird PST
Import plugin 1.2

1,811
Adobe Flash Player
for Linux 10.0.32.18
/ 10.1 Beta

1,685
Fedora 12
1,643

WEEK'S BEST

  • Ubuntu 9.10
  • Ubuntu Netbook Rem...
  • Pidgin 2.6.3
  • Wine 1.0.1 / 1.1.33
  • Linux Kernel 2.6.3...
  • Mozilla Firefox 3....
  • Fedora 12
  • OpenOffice.org 3.1.1
  • Firestarter 1.0.3
  • The Gimp 2.6.7 / 2...
  • FileZilla 3.3.0.1
  • Transmission 1.76
  • Super Grub Disk 0....
  • Gufw 9.04.2
  • Skype 2.0.072 / 2....
  • openSUSE Linux 11.2
  • Opera 10.10 Final
  • 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: 140  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