ePages 6.11.0 - DE_EPAGES/Core/API/Net.pm

Package DE_EPAGES::Core::API::Net

Functions for TCP/IP networking.

@EXPORT_OK
Ip2Int
Int2Ip
GetHttpResponse
GetHttpContent
localhostName
SupportedIpVersions
GetFile

Functions

GetFile
GetHttpContent
GetHttpResponse
Int2Ip
Ip2Int
SupportedIpVersions
localhostName

GetFile

Loads a file from internet via HTTP "GET" request and saves it to filename.

Syntax
my $ResponseCode = GetFile($Url, $FileName);
my $ResponseCode = GetFile($Url, $FileName, $Timeout);
Input
$Url (string)
location of file
$Filename (string)
name of file
$timeout (integer)
(optional) timeout in seconds
Return
$ResponseCode (string)
if all is right 0, else http response code

GetHttpContent

Load document from internet.

Syntax
$Content = GetHttpContent($Url);
Input
$Url (string)
location of document
Return
$Content (String)
http response content (undef if http-return-code is not 200)

GetHttpResponse

Loads a document from internet via HTTP "GET" request.

Syntax
$Response = GetHttpResponse($Url);
$Response = GetHttpResponse($Url, $Timeout);
$Response = GetHttpResponse($Url, $Timeout, $UserAgentString);
Input
$Url (string)
location of document
$Timeout (integer)
(optional) timeout in seconds
$UserAgentString (string)
(optional) UserAgent header used in request
Return
$Response (HTTP::Response)
http response object

Int2Ip

Converts an integer to an IP.

Syntax
$IP = Int2Ip($IP);
Input
$Int (integer)
integer representation of the ip
Return
$IP (string)
ip string

Ip2Int

Converts an ip to an integer.

Syntax
$Int = Ip2Int($IP);
Input
$IP (string)
ip string
Return
$Int (integer)
integer representation of the ip

SupportedIpVersions

Returns an array of address families containing one/more of: 6 (for IPv6), 4 (for IPv4)

Syntax
@IpVersions = SupportedIpVersions();
Return
@IpVersions (array)
supported address families

localhostName

Returns the name of localhost: - ipv6-localhost: if UNIX and IPv6 works - localhost: otherwise

Syntax
$localhost = localhostName();
Return
$localhost (string)
localhost name