GX::Route::Static

Module Version: 0.2000_01

NAME

GX::Route::Static - Static route class

SYNOPSIS

# Load the class
use GX::Route::Static;

# Create a route object
$route = GX::Route::Static->new(
action => $application->action( 'Blog', 'search' ),
method => 'POST',
scheme => 'http',
host => 'myblog.com',
path => '/blog/search'
);

DESCRIPTION

This module provides the GX::Route::Static class which extends the GX::Route class.

METHODS

Constructor

new

Returns a new GX::Route::Static object.

$route = GX::Route::Static->new( %attributes );
Attributes:
  • action ( GX::Action object ) [ required ]

    The associated action.

  • host ( string )

    The hostname to bind the route to. If omitted, the route will match any hostname.

  • is_reversible ( bool )

    A boolean flag indicating whether the route is reversible or not. Defaults to true.

  • method ( string )

    The name of the HTTP method to bind the route to. If omitted, the route will match any method.

  • path ( string ) [ required ]

    The path to bind the route to. Trailing slashes are significant.

  • scheme ( string )

    The URI scheme to bind the route to. If omitted, the route will match any scheme.

Returns:
Exceptions:

Public Methods

action

Returns the associated action.

$action = $route->action;
Returns:

construct_path

Returns the path.

$path = $route->construct_path;
Returns:
  • $path ( string )
Exceptions:

construct_uri

Constructs an URI that would match the route.

$uri = $route->construct_uri( %arguments );
Arguments:
  • fragment ( string )

    The fragment identifier of the URI.

  • host ( string )

    The hostname to use as the authority component of the URI. Ignored if the host attribute is defined, required otherwise.

  • port ( integer )

    The port number to append to the hostname.

  • query ( string )

    The query component of the URI.

  • scheme ( string )

    The scheme part of the URI. Ignored if the scheme attribute is defined. Defaults to "http".

Returns:
  • $uri ( string )
Exceptions:

is_reversible

Returns true if the route is reversible, otherwise false.

$result = $route->is_reversible;
Returns:
  • $result ( bool )

match

Returns a GX::Route::Match object if the route matches, otherwise undef.

$result = $route->match( $context );
Arguments:
Returns:

Internal Methods

host

Internal method.

$host = $route->host;
Returns:
  • $host ( string )

method

Internal method.

$method = $route->method;
Returns:
  • $method ( string )

path

Internal method.

$path = $route->path;
Returns:
  • $path ( string )

scheme

Internal method.

$scheme = $route->scheme;
Returns:
  • $scheme ( string )

AUTHOR

Jörg A. Uzarek <uzarek@runlevelnull.de>

COPYRIGHT AND LICENSE

Copyright © 2009-2011 Jörg A. Uzarek.

This module is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License Version 3 as published by the Free Software Foundation.