.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Mojolicious::Routes::Pattern 3pm" .TH Mojolicious::Routes::Pattern 3pm "2019-02-05" "perl v5.28.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Mojolicious::Routes::Pattern \- Route pattern .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Mojolicious::Routes::Pattern; \& \& # Create pattern \& my $pattern = Mojolicious::Routes::Pattern\->new(\*(Aq/test/:name\*(Aq); \& \& # Match routes \& my $captures = $pattern\->match(\*(Aq/test/sebastian\*(Aq); \& say $captures\->{name}; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Mojolicious::Routes::Pattern is the core of Mojolicious::Routes. .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" Mojolicious::Routes::Pattern implements the following attributes. .SS "constraints" .IX Subsection "constraints" .Vb 2 \& my $constraints = $pattern\->constraints; \& $pattern = $pattern\->constraints({foo => qr/\ew+/}); .Ve .PP Regular expression constraints. .SS "defaults" .IX Subsection "defaults" .Vb 2 \& my $defaults = $pattern\->defaults; \& $pattern = $pattern\->defaults({foo => \*(Aqbar\*(Aq}); .Ve .PP Default parameters. .SS "placeholder_start" .IX Subsection "placeholder_start" .Vb 2 \& my $start = $pattern\->placeholder_start; \& $pattern = $pattern\->placeholder_start(\*(Aq:\*(Aq); .Ve .PP Character indicating a placeholder, defaults to \f(CW\*(C`:\*(C'\fR. .SS "placeholders" .IX Subsection "placeholders" .Vb 2 \& my $placeholders = $pattern\->placeholders; \& $pattern = $pattern\->placeholders([\*(Aqfoo\*(Aq, \*(Aqbar\*(Aq]); .Ve .PP Placeholder names. .SS "quote_end" .IX Subsection "quote_end" .Vb 2 \& my $end = $pattern\->quote_end; \& $pattern = $pattern\->quote_end(\*(Aq}\*(Aq); .Ve .PP Character indicating the end of a quoted placeholder, defaults to \f(CW\*(C`>\*(C'\fR. .SS "quote_start" .IX Subsection "quote_start" .Vb 2 \& my $start = $pattern\->quote_start; \& $pattern = $pattern\->quote_start(\*(Aq{\*(Aq); .Ve .PP Character indicating the start of a quoted placeholder, defaults to \f(CW\*(C`<\*(C'\fR. .SS "regex" .IX Subsection "regex" .Vb 2 \& my $regex = $pattern\->regex; \& $pattern = $pattern\->regex($regex); .Ve .PP Pattern in compiled regular expression form. .SS "relaxed_start" .IX Subsection "relaxed_start" .Vb 2 \& my $start = $pattern\->relaxed_start; \& $pattern = $pattern\->relaxed_start(\*(Aq*\*(Aq); .Ve .PP Character indicating a relaxed placeholder, defaults to \f(CW\*(C`#\*(C'\fR. .SS "tree" .IX Subsection "tree" .Vb 2 \& my $tree = $pattern\->tree; \& $pattern = $pattern\->tree([[\*(Aqtext\*(Aq, \*(Aq/foo\*(Aq]]); .Ve .PP Pattern in parsed form. Note that this structure should only be used very carefully since it is very dynamic. .SS "type_start" .IX Subsection "type_start" .Vb 2 \& my $start = $pattern\->type_start; \& $pattern = $pattern\->type_start(\*(Aq|\*(Aq); .Ve .PP Character indicating the start of a placeholder type, defaults to \f(CW\*(C`:\*(C'\fR. .SS "types" .IX Subsection "types" .Vb 2 \& my $types = $pattern\->types; \& $pattern = $pattern\->types({int => qr/[0\-9]+/}); .Ve .PP Placeholder types. .SS "unparsed" .IX Subsection "unparsed" .Vb 2 \& my $unparsed = $pattern\->unparsed; \& $pattern = $pattern\->unparsed(\*(Aq/:foo/:bar\*(Aq); .Ve .PP Raw unparsed pattern. .SS "wildcard_start" .IX Subsection "wildcard_start" .Vb 2 \& my $start = $pattern\->wildcard_start; \& $pattern = $pattern\->wildcard_start(\*(Aq*\*(Aq); .Ve .PP Character indicating the start of a wildcard placeholder, defaults to \f(CW\*(C`*\*(C'\fR. .SH "METHODS" .IX Header "METHODS" Mojolicious::Routes::Pattern inherits all methods from Mojo::Base and implements the following new ones. .SS "match" .IX Subsection "match" .Vb 2 \& my $captures = $pattern\->match(\*(Aq/foo/bar\*(Aq); \& my $captures = $pattern\->match(\*(Aq/foo/bar\*(Aq, 1); .Ve .PP Match pattern against entire path, format detection is disabled by default. .SS "match_partial" .IX Subsection "match_partial" .Vb 2 \& my $captures = $pattern\->match_partial(\e$path); \& my $captures = $pattern\->match_partial(\e$path, 1); .Ve .PP Match pattern against path and remove matching parts, format detection is disabled by default. .SS "new" .IX Subsection "new" .Vb 5 \& my $pattern = Mojolicious::Routes::Pattern\->new; \& my $pattern = Mojolicious::Routes::Pattern\->new(\*(Aq/:action\*(Aq); \& my $pattern \& = Mojolicious::Routes::Pattern\->new(\*(Aq/:action\*(Aq, action => qr/\ew+/); \& my $pattern = Mojolicious::Routes::Pattern\->new(format => 0); .Ve .PP Construct a new Mojolicious::Routes::Pattern object and \*(L"parse\*(R" pattern if necessary. .SS "parse" .IX Subsection "parse" .Vb 3 \& $pattern = $pattern\->parse(\*(Aq/:action\*(Aq); \& $pattern = $pattern\->parse(\*(Aq/:action\*(Aq, action => qr/\ew+/); \& $pattern = $pattern\->parse(format => 0); .Ve .PP Parse pattern. .SS "render" .IX Subsection "render" .Vb 2 \& my $path = $pattern\->render({action => \*(Aqfoo\*(Aq}); \& my $path = $pattern\->render({action => \*(Aqfoo\*(Aq}, 1); .Ve .PP Render pattern into a path with parameters, format rendering is disabled by default. .SH "SEE ALSO" .IX Header "SEE ALSO" Mojolicious, Mojolicious::Guides, .