Apache2-WurflSimple

 view release on metacpan or  search on metacpan

META.yml  view on Meta::CPAN

  Apache2::CmdParms: 0
  Apache2::Const: 0
  Apache2::Directive: 0
  Apache2::Module: 0
  Apache2::RequestRec: 0
  Apache2::ServerUtil: 0
  Apache::Test: 0
  Apache::TestUtil: 0
  Cache::File: 0
  Net::WURFL::ScientiaMobile: 0
  Net::WURFL::ScientiaMobile::Cache::Cookie: 0
  perl: 5.010
  strict: 0
  warnings: 0
version: 0.002

Makefile.PL  view on Meta::CPAN

    "Apache2::CmdParms" => 0,
    "Apache2::Const" => 0,
    "Apache2::Directive" => 0,
    "Apache2::Module" => 0,
    "Apache2::RequestRec" => 0,
    "Apache2::ServerUtil" => 0,
    "Apache::Test" => 0,
    "Apache::TestUtil" => 0,
    "Cache::File" => 0,
    "Net::WURFL::ScientiaMobile" => 0,
    "Net::WURFL::ScientiaMobile::Cache::Cookie" => 0,
    "strict" => 0,
    "warnings" => 0
  },
  "VERSION" => "0.002",
  "test" => {
    "TESTS" => "t/*.t"
  }
);


lib/Apache2/WurflSimple.pm  view on Meta::CPAN

use strict;
use warnings;


use Apache2::Const;
use Apache2::RequestRec;
use APR::Table;
use Apache2::Module ();
use Apache2::ServerUtil;
use Net::WURFL::ScientiaMobile;
use Net::WURFL::ScientiaMobile::Cache::Cookie;

# ABSTRACT:  module that the Wurfl Perl client to retrieve capabilities data from the Wurfl server

=pod

=head1 NAME

Apache2::WurflPro -A module that the Wurfl Perl client to retrieve capabilities data from the Wurfl server


lib/Apache2/WurflSimple.pm  view on Meta::CPAN

        #get user agent
         my $headers_in = $r->headers_in;
         my $user_agent =  $headers_in->get('User-Agent');	

	#get api key
	my $s = $r->server;
	my $dir_cfg = get_config($s, $r->per_dir_config);
	my $api_key = $dir_cfg->{WurflAPIKey};

	#load wurflcloud client library with cookie cache
	my $cache = Net::WURFL::ScientiaMobile::Cache::Cookie->new;
	my $scientiamobile = Net::WURFL::ScientiaMobile->new(
		api_key => $api_key,
		cache   => $cache,
	);

	#run device detection and retrieve data
	my $capabilities;
	my %env = %ENV;
	$env{'User-Agent'} = $user_agent unless $env{'User-Agent'};
	



( run in 0.651 second using v1.01-cache-2.11-cpan-e9199f4ba4c )