| 1 | # Copyright Infomation | ||
| 2 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 3 | # Author : Dr. Ahmed Amin Elsheshtawy, Ph.D. | ||
| 4 | # Website: https://github.com/mewsoft/Nile, http://www.mewsoft.com | ||
| 5 | # Email : mewsoft@cpan.org, support@mewsoft.com | ||
| 6 | # Copyrights (c) 2014-2015 Mewsoft Corp. All rights reserved. | ||
| 7 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 8 | package Nile::Plugin::Browser; | ||
| 9 | |||
| 10 | our $VERSION = '0.55'; | ||
| 11 | our $AUTHORITY = 'cpan:MEWSOFT'; | ||
| 12 | |||
| 13 | =pod | ||
| 14 | |||
| 15 | =encoding utf8 | ||
| 16 | |||
| 17 | =head1 NAME | ||
| 18 | |||
| 19 | Nile::Plugin::Browser - Browser detection plugin for the Nile framework. | ||
| 20 | |||
| 21 | =head1 SYNOPSIS | ||
| 22 | |||
| 23 | my $browser = $app->plugin->browser; | ||
| 24 | say $browser->version; | ||
| 25 | say $browser->browser_string; | ||
| 26 | say $browser->os_string; | ||
| 27 | if ($browser->mobile) { say "Mobile device"; } | ||
| 28 | |||
| 29 | =head1 DESCRIPTION | ||
| 30 | |||
| 31 | Nile::Plugin::Browser - Browser detection plugin for the Nile framework. | ||
| 32 | |||
| 33 | Determine Web browser, version, and platform. Returns L<HTTP::BrowserDetect> object. | ||
| 34 | |||
| 35 | Plugin settings in th config file under C<plugin> section. | ||
| 36 | |||
| 37 | <plugin> | ||
| 38 | |||
| 39 | <browser> | ||
| 40 | <autoload>1</autoload> | ||
| 41 | </browser> | ||
| 42 | |||
| 43 | </browser> | ||
| 44 | |||
| 45 | =cut | ||
| 46 | |||
| 47 | use Nile::Plugin; | ||
| 48 | use HTTP::BrowserDetect; | ||
| 49 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 50 | sub main { | ||
| 51 | my ($self, $arg) = @_; | ||
| 52 | my $app = $self->app; | ||
| 53 | my $setting = $self->setting(); | ||
| 54 | rebless => HTTP::BrowserDetect->new($app->env->{HTTP_USER_AGENT}); | ||
| 55 | } | ||
| 56 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 57 | |||
| 58 | =pod | ||
| 59 | |||
| 60 | =head1 Bugs | ||
| 61 | |||
| 62 | This project is available on github at L<https://github.com/mewsoft/Nile>. | ||
| 63 | |||
| 64 | =head1 HOMEPAGE | ||
| 65 | |||
| 66 | Please visit the project's homepage at L<https://metacpan.org/release/Nile>. | ||
| 67 | |||
| 68 | =head1 SOURCE | ||
| 69 | |||
| 70 | Source repository is at L<https://github.com/mewsoft/Nile>. | ||
| 71 | |||
| 72 | =head1 SEE ALSO | ||
| 73 | |||
| 74 | See L<Nile> for details about the complete framework. | ||
| 75 | |||
| 76 | =head1 AUTHOR | ||
| 77 | |||
| 78 | Ahmed Amin Elsheshtawy, احمد امين الششتاوى <mewsoft@cpan.org> | ||
| 79 | Website: http://www.mewsoft.com | ||
| 80 | |||
| 81 | =head1 COPYRIGHT AND LICENSE | ||
| 82 | |||
| 83 | Copyright (C) 2014-2015 by Dr. Ahmed Amin Elsheshtawy احمد امين الششتاوى mewsoft@cpan.org, support@mewsoft.com, | ||
| 84 | L<https://github.com/mewsoft/Nile>, L<http://www.mewsoft.com> | ||
| 85 | |||
| 86 | This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. | ||
| 87 | |||
| 88 | =cut | ||
| 89 | |||
| 90 | 1; |