CGI::Application::Plugin::BrowserDetect - Browser detection plugin for CGI::Application


CGI-Application-Plugin-BrowserDetect documentation Contained in the CGI-Application-Plugin-BrowserDetect distribution.

Index


Code Index:

NAME

Top

CGI::Application::Plugin::BrowserDetect - Browser detection plugin for CGI::Application

SYNOPSIS

Top

    use CGI::Application::Plugin::BrowserDetect;

    sub runmode
    {
        my $self    = shift;
        my $browser = $self->browser;

        if ($browser->ie)
        {
            # ...
        }

        # ...
    }

DESCRIPTION

Top

CGI::Application::Plugin::BrowserDetect adds browser detection support to your CGI::Application modules by providing a HTTP::BrowserDetect object. Lazy loading is used when creating the object so it will not be created until it is actually used.

See HTTP::BrowserDetect for more details on what you can do with the browser object.

METHODS

Top

browser

This method will return the current HTTP::BrowserDetect object. The HTTP::BrowserDetect object is created on the first call to this method, and any subsequent calls will return the same object.

    # Retrieve the browser object
    my $browser = $self->browser;

BUGS

Top

Please report any bugs or feature requests to bug-cgi-application-plugin-browserdetect at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CGI-Application-Plugin-BrowserDetect. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SEE ALSO

Top

CGI::Application, HTTP::BrowserDetect

AUTHOR

Top

Bradley C Bailey, <cap-browserdetect at brad.memoryleak.org>

COPYRIGHT & LICENSE

Top


CGI-Application-Plugin-BrowserDetect documentation Contained in the CGI-Application-Plugin-BrowserDetect distribution.

package CGI::Application::Plugin::BrowserDetect;

use Exporter 'import';
use HTTP::BrowserDetect ();

use vars qw($VERSION @EXPORT);
use strict;

@EXPORT = qw(browser);
$VERSION = '1.00';


sub browser
{
    my $self = shift;

    $self->{__CAP_BROWSERDETECT_OBJ} ||= HTTP::BrowserDetect->new(); 

    return $self->{__CAP_BROWSERDETECT_OBJ};
}

1;
__END__