blib/lib/Venus/Search.pm

filter: Statementstmt 100% 110 / 110 Branchbran 91.6% 11 / 12 Conditioncond 47.9% 23 / 48 MC/DCmcdc 0.0% 0 / 29 Subroutinesub 100% 23 / 23 Podpod 86.6% 13 / 15 totaltotal 75.9% 180 / 237 CC 26 SCAR 11.5
CC
26
Cov
85%
captures
6.4
matched
4.3
prematched
4.3
CRAP 3.1
« blib/lib/Venus/Date.pm ↑ Summary blib/lib/Venus/What.pm »
1 package Venus::Search;
2  
3 4 ▶use 5.018;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 # IMPORTS
9  
10 4 ▶use Venus::Class 'attr', 'base', 'with';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 # INHERITS
13  
14 4 base 'Venus::Kind::Utility';
15  
16 # INTEGRATES
17  
18 4 with 'Venus::Role::Encaseable';
19 4 with 'Venus::Role::Explainable';
20  
21 # OVERLOADS
22  
23 4 ▶use overload (
Subroutine BEGIN: called CC=1 SCAR=0.0
24 '""' => 'explain',
25 1 ▶ 'eq' => sub{"$_[0]" eq "$_[1]"},
Subroutine __ANON__: called CC=1 SCAR=0.0
26 1 ▶ 'ne' => sub{"$_[0]" ne "$_[1]"},
Subroutine __ANON__: called CC=1 SCAR=0.0
27 1 ▶ 'qr' => sub{qr{@{[quotemeta("$_[0]")]}}},
Subroutine __ANON__: called CC=1 SCAR=0.0
28 4 '~~' => 'explain',
29 fallback => 1,
30 4 );
31  
32 # ATTRIBUTES
33  
34 4 attr 'flags';
35 4 attr 'regexp';
36 4 attr 'string';
37  
38 # BUILDERS
39  
40 29 ▶sub build_self {
Subroutine build_self: called CC=4 SCAR=13.9
Pod undocumented
41 29 my ($self, $data) = @_;
42  
43 29 ▶ $self->flags('') if !$self->flags;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->flags 28 1 29
44 29 ▶ $self->regexp(qr//) if !$self->regexp;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->regexp 1 28 29
45 29 ▶ $self->string('') if !$self->string;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->string 1 28 29
46  
47 29 return $self;
48 }
49  
50 # METHODS
51  
52 1 ▶sub captures {
Subroutine captures: called CC=6 SCAR=18.6
Pod documented
53 1 my ($self) = @_;
54  
55 1 ▶ my $evaluation = $self->encased('evaluation') || $self->evaluate;
Condition33%1/3
$self->encased('evaluation') || $self->evaluate
l!l&&r!l&&!r
010
MC/DC0%0/2
$self->encased('evaluation') || $self->evaluate
$self->encased('evaluation') $self->evaluate
Truth table33%1/3
A || B
A= $self->encased('evaluation')B= $self->evaluate
ABresult
1X1
011
000
56  
57 1 my $string = $self->initial;
58 1 my $last_match_start = $self->last_match_start;
59 1 my $last_match_end = $self->last_match_end;
60  
61 1 my $captures = [];
62  
63 1 ▶ for (my $i = 1; $i < @$last_match_end; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @$last_match_end) 1 1 2
64 1 ▶ my $start = $last_match_start->[$i] || 0;
Condition50%1/2
$last_match_start->[$i] || 0
l!l
01
MC/DC0%0/1
$last_match_start->[$i] || 0
$last_match_start->[$i]
Truth table50%1/2
A
A= $last_match_start->[$i]
Aresult
11
00
65 1 ▶ my $end = $last_match_end->[$i] || 0;
Condition50%1/2
$last_match_end->[$i] || 0
l!l
10
MC/DC0%0/1
$last_match_end->[$i] || 0
$last_match_end->[$i]
Truth table50%1/2
A
A= $last_match_end->[$i]
Aresult
11
00
66  
67 1 push @$captures, substr $string, $start, $end - $start;
68 }
69  
70 1 ▶ return wantarray ? (@$captures) : $captures;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 1 1
71 }
72  
73 30 ▶sub evaluate {
Subroutine evaluate: called CC=3 SCAR=11.0
Pod documented
74 30 my ($self) = @_;
75  
76 30 my $captures = 0;
77 30 my $flags = $self->flags;
78 30 my @matches = ();
79 30 my $regexp = $self->regexp;
80 30 my $string = $self->string;
81 30 my $initial = "$string";
82  
83 30 local $@;
84 30 ▶ eval join ';', (
Condition50%1/2
$flags // ""
l!l
300
MC/DC0%0/1
$flags // ""
$flags
Truth table50%1/2
A
A= $flags
Aresult
11
00
85 '$captures = (' . '$string =~ m/$regexp/' . ($flags // '') . ')',
86 '@matches = ([@-], [@+], {%-})',
87 );
88  
89 30 my $error = $@;
90  
91 30 ▶ if ($error) {
Branch: 1 branch
BranchTrueFalseTotal
if ($error) 2 28 30
92 2 $self->error_on_evaluate({error => $error})->throw;
93 }
94  
95 28 return $self->recase(evaluation => [
96 $regexp,
97 $string,
98 $captures,
99 @matches,
100 $initial,
101 ]);
102 }
103  
104 17 ▶sub explain {
Subroutine explain: called CC=1 SCAR=0.0
Pod documented
105 17 my ($self) = @_;
106  
107 17 return $self->get;
108 }
109  
110 18 ▶sub get {
Subroutine get: called CC=2 SCAR=7.0
Pod documented
111 18 my ($self) = @_;
112  
113 18 ▶ my $evaluation = $self->encased('evaluation') || $self->evaluate;
Condition66%2/3
$self->encased('evaluation') || $self->evaluate
l!l&&r!l&&!r
6120
MC/DC0%0/2
$self->encased('evaluation') || $self->evaluate
$self->encased('evaluation') $self->evaluate
Truth table66%2/3
A || B
A= $self->encased('evaluation')B= $self->evaluate
ABresult
1X1
011
000
114  
115 18 return $evaluation->[1];
116 }
117  
118 2 ▶sub count {
Subroutine count: called CC=2 SCAR=7.6
Pod documented
119 2 my ($self) = @_;
120  
121 2 ▶ my $evaluation = $self->encased('evaluation') || $self->evaluate;
Condition33%1/3
$self->encased('evaluation') || $self->evaluate
l!l&&r!l&&!r
020
MC/DC0%0/2
$self->encased('evaluation') || $self->evaluate
$self->encased('evaluation') $self->evaluate
Truth table33%1/3
A || B
A= $self->encased('evaluation')B= $self->evaluate
ABresult
1X1
011
000
122  
123 2 return $evaluation->[2];
124 }
125  
126 5 ▶sub initial {
Subroutine initial: called CC=2 SCAR=7.0
Pod documented
127 5 my ($self) = @_;
128  
129 5 ▶ my $evaluation = $self->encased('evaluation') || $self->evaluate;
Condition66%2/3
$self->encased('evaluation') || $self->evaluate
l!l&&r!l&&!r
410
MC/DC0%0/2
$self->encased('evaluation') || $self->evaluate
$self->encased('evaluation') $self->evaluate
Truth table66%2/3
A || B
A= $self->encased('evaluation')B= $self->evaluate
ABresult
1X1
011
000
130  
131 5 return $evaluation->[6];
132 }
133  
134 5 ▶sub last_match_end {
Subroutine last_match_end: called CC=2 SCAR=7.0
Pod documented
135 5 my ($self) = @_;
136  
137 5 ▶ my $evaluation = $self->encased('evaluation') || $self->evaluate;
Condition66%2/3
$self->encased('evaluation') || $self->evaluate
l!l&&r!l&&!r
410
MC/DC0%0/2
$self->encased('evaluation') || $self->evaluate
$self->encased('evaluation') $self->evaluate
Truth table66%2/3
A || B
A= $self->encased('evaluation')B= $self->evaluate
ABresult
1X1
011
000
138  
139 5 return $evaluation->[4];
140 }
141  
142 5 ▶sub last_match_start {
Subroutine last_match_start: called CC=2 SCAR=7.0
Pod documented
143 5 my ($self) = @_;
144  
145 5 ▶ my $evaluation = $self->encased('evaluation') || $self->evaluate;
Condition66%2/3
$self->encased('evaluation') || $self->evaluate
l!l&&r!l&&!r
410
MC/DC0%0/2
$self->encased('evaluation') || $self->evaluate
$self->encased('evaluation') $self->evaluate
Truth table66%2/3
A || B
A= $self->encased('evaluation')B= $self->evaluate
ABresult
1X1
011
000
146  
147 5 return $evaluation->[3];
148 }
149  
150 1 ▶sub matched {
Subroutine matched: called CC=4 SCAR=14.6
Pod documented
151 1 my ($self) = @_;
152  
153 1 ▶ my $evaluation = $self->encased('evaluation') || $self->evaluate;
Condition33%1/3
$self->encased('evaluation') || $self->evaluate
l!l&&r!l&&!r
010
MC/DC0%0/2
$self->encased('evaluation') || $self->evaluate
$self->encased('evaluation') $self->evaluate
Truth table33%1/3
A || B
A= $self->encased('evaluation')B= $self->evaluate
ABresult
1X1
011
000
154  
155 1 my $string = $self->initial;
156 1 my $last_match_start = $self->last_match_start;
157 1 my $last_match_end = $self->last_match_end;
158  
159 1 ▶ my $start = $last_match_start->[0] || 0;
Condition50%1/2
$last_match_start->[0] || 0
l!l
01
MC/DC0%0/1
$last_match_start->[0] || 0
$last_match_start->[0]
Truth table50%1/2
A
A= $last_match_start->[0]
Aresult
11
00
160 1 ▶ my $end = $last_match_end->[0] || 0;
Condition50%1/2
$last_match_end->[0] || 0
l!l
10
MC/DC0%0/1
$last_match_end->[0] || 0
$last_match_end->[0]
Truth table50%1/2
A
A= $last_match_end->[0]
Aresult
11
00
161  
162 1 return substr $string, $start, $end - $start;
163 }
164  
165 2 ▶sub named_captures {
Subroutine named_captures: called CC=2 SCAR=7.6
Pod documented
166 2 my ($self) = @_;
167  
168 2 ▶ my $evaluation = $self->encased('evaluation') || $self->evaluate;
Condition33%1/3
$self->encased('evaluation') || $self->evaluate
l!l&&r!l&&!r
020
MC/DC0%0/2
$self->encased('evaluation') || $self->evaluate
$self->encased('evaluation') $self->evaluate
Truth table33%1/3
A || B
A= $self->encased('evaluation')B= $self->evaluate
ABresult
1X1
011
000
169  
170 2 return $evaluation->[5];
171 }
172  
173 1 ▶sub prematched {
Subroutine prematched: called CC=4 SCAR=14.6
Pod documented
174 1 my ($self) = @_;
175  
176 1 ▶ my $evaluation = $self->encased('evaluation') || $self->evaluate;
Condition33%1/3
$self->encased('evaluation') || $self->evaluate
l!l&&r!l&&!r
010
MC/DC0%0/2
$self->encased('evaluation') || $self->evaluate
$self->encased('evaluation') $self->evaluate
Truth table33%1/3
A || B
A= $self->encased('evaluation')B= $self->evaluate
ABresult
1X1
011
000
177  
178 1 my $string = $self->initial;
179 1 my $last_match_start = $self->last_match_start;
180 1 my $last_match_end = $self->last_match_end;
181  
182 1 ▶ my $start = $last_match_start->[0] || 0;
Condition50%1/2
$last_match_start->[0] || 0
l!l
01
MC/DC0%0/1
$last_match_start->[0] || 0
$last_match_start->[0]
Truth table50%1/2
A
A= $last_match_start->[0]
Aresult
11
00
183 1 ▶ my $end = $last_match_end->[0] || 0;
Condition50%1/2
$last_match_end->[0] || 0
l!l
10
MC/DC0%0/1
$last_match_end->[0] || 0
$last_match_end->[0]
Truth table50%1/2
A
A= $last_match_end->[0]
Aresult
11
00
184  
185 1 return substr $string, 0, $start;
186 }
187  
188 1 ▶sub postmatched {
Subroutine postmatched: called CC=4 SCAR=14.6
Pod documented
189 1 my ($self) = @_;
190  
191 1 ▶ my $evaluation = $self->encased('evaluation') || $self->evaluate;
Condition33%1/3
$self->encased('evaluation') || $self->evaluate
l!l&&r!l&&!r
010
MC/DC0%0/2
$self->encased('evaluation') || $self->evaluate
$self->encased('evaluation') $self->evaluate
Truth table33%1/3
A || B
A= $self->encased('evaluation')B= $self->evaluate
ABresult
1X1
011
000
192  
193 1 my $string = $self->initial;
194 1 my $last_match_start = $self->last_match_start;
195 1 my $last_match_end = $self->last_match_end;
196  
197 1 ▶ my $start = $last_match_start->[0] || 0;
Condition50%1/2
$last_match_start->[0] || 0
l!l
01
MC/DC0%0/1
$last_match_start->[0] || 0
$last_match_start->[0]
Truth table50%1/2
A
A= $last_match_start->[0]
Aresult
11
00
198 1 ▶ my $end = $last_match_end->[0] || 0;
Condition50%1/2
$last_match_end->[0] || 0
l!l
10
MC/DC0%0/1
$last_match_end->[0] || 0
$last_match_end->[0]
Truth table50%1/2
A
A= $last_match_end->[0]
Aresult
11
00
199  
200 1 return substr $string, $end;
201 }
202  
203 1 ▶sub set {
Subroutine set: called CC=1 SCAR=0.0
Pod documented
204 1 my ($self, $string) = @_;
205  
206 1 $self->string($string);
207  
208 1 my $evaluation = $self->evaluate;
209  
210 1 return $evaluation->[1];
211 }
212  
213 # ERRORS
214  
215 2 ▶sub error_on_evaluate {
Subroutine error_on_evaluate: called CC=1 SCAR=0.0
Pod undocumented
216 2 my ($self, $data) = @_;
217  
218 2 my $error = $self->error->sysinfo;
219  
220 2 $error->name('on.evaluate');
221 2 $error->message($data->{error});
222 2 $error->offset(1);
223 2 $error->stash($data);
224 2 $error->reset;
225  
226 2 return $error;
227 }
228  
229 4 1;
230  
231  
232  
233 =head1 NAME
234  
235 Venus::Search - Search Class
236  
237 =cut
238  
239 =head1 ABSTRACT
240  
241 Search Class for Perl 5
242  
243 =cut
244  
245 =head1 SYNOPSIS
246  
247 package main;
248  
249 use Venus::Search;
250  
251 my $search = Venus::Search->new(
252 string => 'hello world',
253 regexp => '(hello)',
254 );
255  
256 # $search->captures;
257  
258 =cut
259  
260 =head1 DESCRIPTION
261  
262 This package provides methods for manipulating regexp search data.
263  
264 =cut
265  
266 =head1 ATTRIBUTES
267  
268 This package has the following attributes:
269  
270 =cut
271  
272 =head2 flags
273  
274 flags(Str)
275  
276 This attribute is read-write, accepts C<(Str)> values, is optional, and defaults to C<''>.
277  
278 =cut
279  
280 =head2 regexp
281  
282 regexp(Regexp)
283  
284 This attribute is read-write, accepts C<(Regexp)> values, is optional, and defaults to C<qr//>.
285  
286 =cut
287  
288 =head2 string
289  
290 string(Str)
291  
292 This attribute is read-write, accepts C<(Str)> values, is optional, and defaults to C<''>.
293  
294 =cut
295  
296 =head1 INHERITS
297  
298 This package inherits behaviors from:
299  
300 L<Venus::Kind::Utility>
301  
302 =cut
303  
304 =head1 INTEGRATES
305  
306 This package integrates behaviors from:
307  
308 L<Venus::Role::Encaseable>
309  
310 L<Venus::Role::Explainable>
311  
312 =cut
313  
314 =head1 METHODS
315  
316 This package provides the following methods:
317  
318 =cut
319  
320 =head2 captures
321  
322 captures() (arrayref)
323  
324 The captures method returns the capture groups from the result object which
325 contains information about the results of the regular expression operation.
326 This method can return a list of values in list-context.
327  
328 I<Since C<0.01>>
329  
330 =over 4
331  
332 =item captures example 1
333  
334 # given: synopsis;
335  
336 my $captures = $search->captures;
337  
338 # ["hello"]
339  
340 =back
341  
342 =cut
343  
344 =head2 count
345  
346 count() (number)
347  
348 The count method returns the number of matches found in the result object which
349 contains information about the results of the regular expression operation.
350  
351 I<Since C<0.01>>
352  
353 =over 4
354  
355 =item count example 1
356  
357 # given: synopsis;
358  
359 my $count = $search->count;
360  
361 # 1
362  
363 =back
364  
365 =cut
366  
367 =head2 evaluate
368  
369 evaluate() (arrayref)
370  
371 The evaluate method performs the regular expression operation and returns an
372 arrayref representation of the results.
373  
374 I<Since C<0.01>>
375  
376 =over 4
377  
378 =item evaluate example 1
379  
380 # given: synopsis;
381  
382 my $evaluate = $search->evaluate;
383  
384 # ["(hello)", "hello world", 1, [0, 0], [5, 5], {}, "hello world"]
385  
386 =back
387  
388 =over 4
389  
390 =item evaluate example 2
391  
392 package main;
393  
394 use Venus::Search;
395  
396 my $search = Venus::Search->new(
397 string => 'hello world',
398 regexp => 'hello:)',
399 );
400  
401 my $evaluate = $search->evaluate;
402  
403 # Exception! (isa Venus::Search::Error) (see error_on_evaluate)
404  
405 =back
406  
407 =over 4
408  
409 =item B<may raise> L<Venus::Search::Error> C<on.evaluate>
410  
411 package main;
412  
413 use Venus::Search;
414  
415 my $search = Venus::Search->new(
416 string => 'hello world',
417 regexp => 'world',
418 flags => 'i',
419 );
420  
421 $search->evaluate;
422  
423 $search->flags('q');
424  
425 $search->evaluate;
426  
427 # Error! (on.evaluate)
428  
429 =back
430  
431 =cut
432  
433 =head2 explain
434  
435 explain() (string)
436  
437 The explain method returns the subject of the regular expression operation and
438 is used in stringification operations.
439  
440 I<Since C<0.01>>
441  
442 =over 4
443  
444 =item explain example 1
445  
446 # given: synopsis;
447  
448 my $explain = $search->explain;
449  
450 # "hello world"
451  
452 =back
453  
454 =cut
455  
456 =head2 get
457  
458 get() (string)
459  
460 The get method returns the subject of the regular expression operation.
461  
462 I<Since C<0.01>>
463  
464 =over 4
465  
466 =item get example 1
467  
468 # given: synopsis;
469  
470 my $get = $search->get;
471  
472 # "hello world"
473  
474 =back
475  
476 =cut
477  
478 =head2 initial
479  
480 initial() (string)
481  
482 The initial method returns the unaltered string from the result object which
483 contains information about the results of the regular expression operation.
484  
485 I<Since C<0.01>>
486  
487 =over 4
488  
489 =item initial example 1
490  
491 # given: synopsis;
492  
493 my $initial = $search->initial;
494  
495 # "hello world"
496  
497 =back
498  
499 =cut
500  
501 =head2 last_match_end
502  
503 last_match_end() (maybe[within[arrayref, number]])
504  
505 The last_match_end method returns an array of offset positions into the string
506 where the capture(s) stopped matching from the result object which contains
507 information about the results of the regular expression operation.
508  
509 I<Since C<0.01>>
510  
511 =over 4
512  
513 =item last_match_end example 1
514  
515 # given: synopsis;
516  
517 my $last_match_end = $search->last_match_end;
518  
519 # [5, 5]
520  
521 =back
522  
523 =cut
524  
525 =head2 last_match_start
526  
527 last_match_start() (maybe[within[arrayref, number]])
528  
529 The last_match_start method returns an array of offset positions into the
530 string where the capture(s) matched from the result object which contains
531 information about the results of the regular expression operation.
532  
533 I<Since C<0.01>>
534  
535 =over 4
536  
537 =item last_match_start example 1
538  
539 # given: synopsis;
540  
541 my $last_match_start = $search->last_match_start;
542  
543 # [0, 0]
544  
545 =back
546  
547 =cut
548  
549 =head2 matched
550  
551 matched() (maybe[string])
552  
553 The matched method returns the portion of the string that matched from the
554 result object which contains information about the results of the regular
555 expression operation.
556  
557 I<Since C<0.01>>
558  
559 =over 4
560  
561 =item matched example 1
562  
563 # given: synopsis;
564  
565 my $matched = $search->matched;
566  
567 # "hello"
568  
569 =back
570  
571 =cut
572  
573 =head2 named_captures
574  
575 named_captures() (hashref)
576  
577 The named_captures method returns a hash containing the requested named regular
578 expressions and captured string pairs from the result object which contains
579 information about the results of the regular expression operation.
580  
581 I<Since C<0.01>>
582  
583 =over 4
584  
585 =item named_captures example 1
586  
587 # given: synopsis;
588  
589 my $named_captures = $search->named_captures;
590  
591 # {}
592  
593 =back
594  
595 =over 4
596  
597 =item named_captures example 2
598  
599 package main;
600  
601 use Venus::Search;
602  
603 my $search = Venus::Search->new(
604 string => 'hello world',
605 regexp => '(?<locale>world)',
606 );
607  
608 my $named_captures = $search->named_captures;
609  
610 # { locale => ["world"] }
611  
612 =back
613  
614 =cut
615  
616 =head2 new
617  
618 new(any @args) (Venus::Search)
619  
620 The new method constructs an instance of the package.
621  
622 I<Since C<4.15>>
623  
624 =over 4
625  
626 =item new example 1
627  
628 package main;
629  
630 use Venus::Search;
631  
632 my $new = Venus::Search->new;
633  
634 # bless(..., "Venus::Search")
635  
636 =back
637  
638 =over 4
639  
640 =item new example 2
641  
642 package main;
643  
644 use Venus::Search;
645  
646 my $new = Venus::Search->new(
647 string => 'hello world',
648 regexp => '(hello)',
649 );
650  
651 # bless(..., "Venus::Search")
652  
653 =back
654  
655 =cut
656  
657 =head2 postmatched
658  
659 postmatched() (maybe[string])
660  
661 The postmatched method returns the portion of the string after the regular
662 expression matched from the result object which contains information about the
663 results of the regular expression operation.
664  
665 I<Since C<0.01>>
666  
667 =over 4
668  
669 =item postmatched example 1
670  
671 # given: synopsis;
672  
673 my $postmatched = $search->postmatched;
674  
675 # " world"
676  
677 =back
678  
679 =cut
680  
681 =head2 prematched
682  
683 prematched() (maybe[string])
684  
685 The prematched method returns the portion of the string before the regular
686 expression matched from the result object which contains information about the
687 results of the regular expression operation.
688  
689 I<Since C<0.01>>
690  
691 =over 4
692  
693 =item prematched example 1
694  
695 # given: synopsis;
696  
697 my $prematched = $search->prematched;
698  
699 # ""
700  
701 =back
702  
703 =cut
704  
705 =head2 set
706  
707 set(string $string) (string)
708  
709 The set method sets the subject of the regular expression operation.
710  
711 I<Since C<0.01>>
712  
713 =over 4
714  
715 =item set example 1
716  
717 # given: synopsis;
718  
719 my $set = $search->set('hello universe');
720  
721 # "hello universe"
722  
723 =back
724  
725 =cut
726  
727 =head1 OPERATORS
728  
729 This package overloads the following operators:
730  
731 =cut
732  
733 =over 4
734  
735 =item operation: C<("")>
736  
737 This package overloads the C<""> operator.
738  
739 B<example 1>
740  
741 # given: synopsis;
742  
743 my $result = "$search";
744  
745 # "hello world"
746  
747 B<example 2>
748  
749 # given: synopsis;
750  
751 my $result = "$search, $search";
752  
753 # "hello world, hello world"
754  
755 =back
756  
757 =over 4
758  
759 =item operation: C<(.)>
760  
761 This package overloads the C<.> operator.
762  
763 B<example 1>
764  
765 # given: synopsis;
766  
767 my $result = $search . ', welcome';
768  
769 # "hello world, welcome"
770  
771 =back
772  
773 =over 4
774  
775 =item operation: C<(eq)>
776  
777 This package overloads the C<eq> operator.
778  
779 B<example 1>
780  
781 # given: synopsis;
782  
783 my $result = $search eq 'hello world';
784  
785 # 1
786  
787 =back
788  
789 =over 4
790  
791 =item operation: C<(ne)>
792  
793 This package overloads the C<ne> operator.
794  
795 B<example 1>
796  
797 # given: synopsis;
798  
799 my $result = $search ne 'Hello world';
800  
801 # 1
802  
803 =back
804  
805 =over 4
806  
807 =item operation: C<(qr)>
808  
809 This package overloads the C<qr> operator.
810  
811 B<example 1>
812  
813 # given: synopsis;
814  
815 my $result = 'hello world, welcome' =~ qr/$search/;
816  
817 # 1
818  
819 =back
820  
821 =over 4
822  
823 =item operation: C<(~~)>
824  
825 This package overloads the C<~~> operator.
826  
827 B<example 1>
828  
829 # given: synopsis;
830  
831 my $result = $search ~~ 'hello world';
832  
833 # 1
834  
835 =back
836  
837 =head1 AUTHORS
838  
839 Awncorp, C<awncorp@cpan.org>
840  
841 =cut
842  
843 =head1 LICENSE
844  
845 Copyright (C) 2022, Awncorp, C<awncorp@cpan.org>.
846  
847 This program is free software, you can redistribute it and/or modify it under
848 the terms of the Apache license version 2.0.
849  
850 =cut
« blib/lib/Venus/Date.pm ↑ Summary blib/lib/Venus/What.pm »