NAME

Gears::Router::Pattern::Match - Most basic pattern implementation

SYNOPSIS

use Gears::Router::Pattern::Match;

my $pattern = Gears::Router::Pattern::Match->new(
	location => $location,
);

# Exact match for non-bridge, prefix match for bridge
my $match_data = $pattern->compare('/exact/path');

# Building always returns the pattern itself
my $url = $pattern->build();

DESCRIPTION

Gears::Router::Pattern::Match provides exact string pattern matching. If the associated location is a bridge, it matches when the request path starts with the pattern. If it's not a bridge, it only matches when the path equals the pattern exactly.

This is the simplest location type that doesn't support any placeholders or wildcards. While it may not be useful for any real work, it can be used to reduce the number of moving parts when testing other parts of the router. It always returns an empty array reference for matched data and the pattern itself when building.

INTERFACE

Inherits interface from Gears::Router::Pattern.

Methods

compare

$match_data = $pattern->compare($request_path)

Compares the request path against the pattern. For bridges, returns an empty array reference if the path starts with the pattern. For non-bridges, returns an empty array reference only if the path exactly equals the pattern. Returns undef if there's no match.

build

$url = $pattern->build(%params)

Returns the pattern string. Parameters are ignored since this pattern type has no placeholders.