File: _Browser.pm

package info (click to toggle)
lemonldap-ng 1.3.3-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 13,084 kB
  • ctags: 2,440
  • sloc: perl: 25,708; makefile: 622; sh: 176; php: 6; sql: 5
file content (30 lines) | stat: -rw-r--r-- 596 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
##@file
# Add LWP::UserAgent object

##@class
# Add LWP::UserAgent object
package Lemonldap::NG::Portal::_Browser;

use strict;

our $VERSION = '1.3.0';
our $_ua;

## @method LWP::UserAgent ua()
# @return LWP::UserAgent object
sub ua {
    my $self = shift;

    return $_ua if ($_ua);
    eval { require LWP::UserAgent; };
    $self->abort( 'LWP::UserAgent isn\'t installed', $@ ) if ($@);

    # TODO : LWP options to use a proxy for example
    $_ua = LWP::UserAgent->new() or $self->abort($@);
    push @{ $_ua->requests_redirectable }, 'POST';
    $_ua->env_proxy();
    return $_ua;
}

1;