Main > Programming > Libraries >

Perl6::Parameters 0.03

Perl6::Parameters 0.03

Sponsored Links

Perl6::Parameters 0.03 Ranking & Summary

RankingClick at the star to rank
Ranking Level
User Review: 0 (0 times)
File size: 0.004 MB
Platform: Any Platform
License: Perl Artistic License
Price:
Downloads: 858
Date added: 2007-06-22
Publisher: Brent Dax

Perl6::Parameters 0.03 description

Perl6::Parameters is a module with Perl 6-style prototypes with named parameters.

SYNOPSIS

use Perl6::Parameters;

sub mysub($foo, ARRAY $bar, *%rest) {
...
}

DETAILS

Perl6::Parameters is a Perl module which simulates Perl 6s named parameters. (When I talk about "named parameters" I mean something like the parameters youre used to from C, Java and many other languages--not pass-a-hash-with-the-parameters-in-it things.)

Like most other programming languages, Perl 6 will support subroutines with pre-declared variables the parameters are put into. (Using this will be optional, however.) This goes far beyond the "line-noise prototypes" available in Perl 5, which only allow you to control context and automatically take references to some parameters--lines like my($first, $second)=(@_) will no longer be necessary.

Although Perl 6 will have this, Perl 5 doesnt; this module makes it so that Perl 5 does. It uses some other Perl 6-isms too, notably the names for builtin types and the unary-asterisk notation for flattening a list.

Crafting Parameter Lists

Crafting parameter lists is simple; just declare your subroutine and put the parameters separated by commas or semicolons, in parenthesis. (Using a semicolon signifies that all remaining parameters are optional; this may not be available this way in Perl 6, but Im assuming it is until I hear otherwise.)

Most parameters are just variable names like $foo; however, more sophisticated behavior is possible. There are three ways to achieve this.

The first way is by specifying a type for the variable. Certain types make the actual parameters turn into references to themselves:

ARRAY $foo

This turns an array into a reference to itself and stores the reference into $foo.

HASH $foo

This turns a hash into a reference to itself and stores the reference into $foo.

CODE $foo

This turns a subroutine into a reference to itself and stores the reference into $foo.

SCALAR $foo

This turns a scalar into a reference to itself and stores the reference into $foo.

GLOB $foo

This turns a typeglob into a reference to itself and stores the reference into $foo. Typeglobs will be going away in Perl 6; this type exists in this module so that its useful for general use in Perl 5.

REF $foo

This turns any parameter into a reference to itself and stores it into $foo.

This only works in Perl 5.8. Otherwise, its treated the same as any other unrecognized type name.

AnythingElse $foo

This has no effect in this module; its treated as though youd typed $foo without the AnythingElse.

For example, if a subroutine had the parameters ($foo, HASH $bar, CODE $baz) and was called with ($scalar, %hash, &mysub) the subroutine would get the contents of $scalar, a reference to %hash and a reference to &mysub.
The second way is by supplying an actual array or hash as a parameter name. This requires an array or hash to be passed in for that parameter; it preserves the length of the array or hash.

The final way is only available for the last parameter: if an array or hash is prefixed with an asterisk, that array or hash will be filled with any additional parameters.

Perl6::Parameters 0.03 Screenshot

Advertisements

Perl6::Parameters 0.03 Keywords

Bookmark Perl6::Parameters 0.03

Hyperlink code:
Link for forum:

Perl6::Parameters 0.03 Copyright

WareSeeker periodically updates pricing and software information of Perl6::Parameters 0.03 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Perl6::Parameters 0.03 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed

Allok Video Splitter 2.2.0 Review:

Name (Required)
Email(Required)
Captcha
Featured Software

Want to place your software product here?
Please contact us for consideration.

Contact WareSeeker.com
Related Software
Perl6::Placeholders is a Perl 6 implicitly declared parameters for Perl 5. Free Download
Perl6::Gather is a Perl module that implements the Perl 6 gather/take control structure in Perl 5. Free Download
Perl6::Export::Attrs - the Perl 6 is export(...) trait as a Perl 5 attribute. Free Download
Perl6::Take is a Perl module to gather/take in Perl 5. Free Download
Perl::Metric::Basic is a Perl module that can provide basic software metrics. Free Download
Perl6::Builtins is a Perl module that provides erl 5 versions of the new Perl 6 builtins. Free Download
Perl6::Contexts - array and hash variables turn into references to themselves when used in non-numeric scalar context. Free Download
Perl6::Classes project contains first class classes in Perl 5. Free Download