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__ =head1 NAME CGI::Application::Plugin::BrowserDetect - Browser detection plugin for CGI::Application =head1 SYNOPSIS use CGI::Application::Plugin::BrowserDetect; sub runmode { my $self = shift; my $browser = $self->browser; if ($browser->ie) { # ... } # ... } =head1 DESCRIPTION CGI::Application::Plugin::BrowserDetect adds browser detection support to your L modules by providing a L object. Lazy loading is used when creating the object so it will not be created until it is actually used. See L for more details on what you can do with the browser object. =head1 METHODS =head2 browser This method will return the current L object. The L 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; =head1 BUGS Please report any bugs or feature requests to C, or through the web interface at L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. =head1 SEE ALSO L, L =head1 AUTHOR Bradley C Bailey, C<< >> =head1 COPYRIGHT & LICENSE Copyright 2008 Bradley C Bailey, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut