Junction-Quotelike
view release on metacpan or search on metacpan
lib/Junction/Quotelike.pm view on Meta::CPAN
package Junction::Quotelike;
=head1 NAME
Junction::Quotelike - quotelike junction operators
=cut
use strict;
use warnings;
use Carp qw/croak/;
use PerlX::QuoteOperator qw//;
use Perl6::Junction qw/all any none one/;
=head1 VERSION
This document describes version 0.01 of Junction::Quotelike,
released Sun Feb 14 16:20:27 CET 2010 @680 /Internet Time/
=cut
our $VERSION = 0.01;
=head1 SYNOPSIS
use Junction::Quotelike qw/qany/;
my $x = 'foo';
print "is foo!" if $x eq qany/foo bar baz/; #is foo
=head1 DESCRIPTION
Junction::Quotelike glues Perl6::Junction and PerlX::QuoteOperator together to
provide quotelike junction operators.
=head2 Operators
Junction::Quotelike defines the following Operators
=cut
=head3 qany//
Quotelike version of any(). Returns a junction that tests against one more of
its Elements. See L<<Perl6::Junction>> for details
=head3 qall//
Quotelike version of all(). Returns a junction that tests against all of its
Elements. See L<<Perl6::Junction>> for details
=head3 qone//
Quotelike version of one(). Returns a junction that tests against one (and only
one) of its Elements. See L<<Perl6::Junction>> for details
=head3 qnone//
Quotelike version of none(). Returns a junction that tests against none of its
Elements. See L<<Perl6::Junction>> for details
=cut
sub import
{
my $class = shift;
my $names;
my $caller;
my $valid;
my $ctx;
my %code;
$caller = caller;
$valid = any(qw/qany qall qone qnone/);
lib/Junction/Quotelike.pm view on Meta::CPAN
I don't think that's bug since using qualified names would make the use of this
module rather pointless.
=head1 SEE ALSO
Junction::Quotelike doesn't really do much on itself but rather relies on the
services of these Modules to perform its job.
=over
=item L<<Perl6::Junction>>
Perl6::Junction defines the semantics for junctions used by this module. If
you're intrested in junctions without quotelike behavior this your friend.
=item L<<PerlX::QuoteOperator>>
PerlX::QuoteOperator enables the definition of custom quotelike operators in a
straightforward manner.
=back
=head1 WHY?
Why not?
As of this writing i am working on some slightly complex piece of code that
makes heavy use of junctions (as provided by Perl6::Junction). While this makes
my code way less complex i'm still forced to write a lot lines like
...
$valid = any(qw/this that something else/);
...
Sure that's not that bad, but it doesn't look nice to me. Writing it like:
...
$valid = qany /this that something else/;
...
Looks a lot better to me.
=head1 AUTHOR
blackhat.blade (formerly Lionel Mehl) <blade@dropfknuck.net>
dropfknuck.net
=head1 COPYRIGHT
Copyright (c) 2010 blackhat.blade, dropfknuck.net
This module is free software. It may be used, redistributed
and/or modified under the terms of the Artistic license.
=cut
1;
__END__
0.01 Sun Feb 14 16:20:22 CET 2010 @680 /Internet Time/
initial release.
( run in 1.605 second using v1.01-cache-2.11-cpan-5a3173703d6 )