File: Junction.pm

package info (click to toggle)
libsyntax-keyword-junction-perl 0.003008-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 196 kB
  • ctags: 81
  • sloc: perl: 718; makefile: 7
file content (101 lines) | stat: -rw-r--r-- 1,534 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package Syntax::Feature::Junction;

use strict;
use warnings;

our $VERSION = '0.003008'; # VERSION

# ABSTRACT: Provide keywords for any, all, none, or one

require Syntax::Keyword::Junction;

sub install {
  my ($class, %args) = @_;

  my $target  = $args{into};
  my $options = $args{options} || {};

  Syntax::Keyword::Junction->import({ into => $target }, %$options );

  return 1;
}

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Syntax::Feature::Junction - Provide keywords for any, all, none, or one

=head1 VERSION

version 0.003008

=head1 SYNOPSIS

  use syntax 'junction';

  if (any(@grant) eq 'su') {
    ...
  }

  if (all($foo, $bar) >= 10) {
    ...
  }

  if (qr/^\d+$/ == all(@answers)) {
    ...
  }

  if (all(@input) <= @limits) {
    ...
  }

  if (none(@pass) eq 'password') {
    ...
  }

  if (one(@answer) == 42) {
    ...
  }

or if you want to rename an export, use L<Sub::Exporter> options:

  use syntax 'junction' => {
    any => { -as => 'robot_any' }
  };

  if (robot_any(@grant) eq 'su') {
    ...
  }

The full documentation for this module is in L<Syntax::Keyword::Junction>.  This
is just a way to use the sugar that L<syntax> gives us.

=head1 AUTHORS

=over 4

=item *

Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>

=item *

Carl Franks

=back

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Arthur Axel "fREW" Schmidt.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut