Perl6::Interpolators

Perl6::Interpolators can use Perl 6 function-interpolation syntax.
Download

Perl6::Interpolators Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Brent Dax
  • Publisher web site:
  • http://search.cpan.org/~brentdax/Perl6-Interpolators-0.03/Interpolators.pm

Perl6::Interpolators Tags


Perl6::Interpolators Description

Perl6::Interpolators can use Perl 6 function-interpolation syntax. Perl6::Interpolators can use Perl 6 function-interpolation syntax.SYNOPSIS use Perl6::Interpolators; sub Foo { 1 } sub Bar { 1..5 } sub Baz { @_ } sub Context { wantarray ? 'list' : 'scalar' } print "Foo: $(Foo)n"; #prints Foo: 1 print "Bar: @(Bar)n"; #prints Bar: 1 2 3 4 5 print "Baz: $(Baz('a', 'b'))"; #prints Baz: b print "Baz: @(Baz('a', 'b'))"; #prints Baz: a b print "$(Context)"; #prints scalar print "@(Context)"; #prints listPerl6::Interpolate allows you to interpolate function calls into strings. Because of Perl's contexts, Perl6::Interpolate requires a sigil (a funny character--$ or @ in this case) to tell the function being called which context to use; thus, the syntax is $(call) for scalar context or @(call) for list context. (This syntax is expected to be used for the same thing in Perl 6, too.)Perl6::Interpolate will work on both fuction and method calls. It will work on parenthesized calls. It even works outside quotes, where it can be used to control context. (This may be the only way to get a list context in some cases, for example.)Requirements:· Perl


Perl6::Interpolators Related Software