Net::Swirl::CurlURL
Perl interface to curl's URL object
SYNOPSIS
use Net::Swirl::CurlURL;
my $url = Net::Swirl::CurlURL->new;
$url->scheme('https');
$url->host('localhost');
say $url->url; # http://localhost
say "$url"; # http://localhost
say $url->host; # localhost
DESCRIPTION
This is an interface to libcurl
's URL API. It may be useful in
combination with Net::Swirl::CurlEasy, which has options that will
take objects of this class.
CONSTRUCTOR
new
my $url = Net::Swirl::CurlURL->new;
Creates a new instance of the class.
METHODS
clone
my $url2 = $url->clone;
Creates a new instance of the class, with the same values.
url
my $string = $url->url;
my $string = "$url";
Returns the stringified version of the URL.
scheme
my $scheme = $url->scheme;
Returns the scheme.
user
my $user = $url->user;
Returns the user.
password
my $pass = $url->password;
Returns the password.
options
my $options = $url->options;
Returns the options.
host
my $host = $url->host;
Returns the host.
port
my $port = $url->port;
Returns the port.
path
my $path = $url->path;
Returns the path.
query
my $query = $url->query;
Returns the query.
fragment
my $fragment = $url->fragment;
Returns the fragment.
zoneid
my $zoneid = $url->zoneid;
Returns the zoneid.
flags
my $old = $url->flags;
$url->flags($new);
Get or set the flags. The flags are bit mask that can be or'd together. Symbolic
constants for the flags can be exported from this module using the :flags
import
tag.
EXCEPTIONS
If an error is detected, it will be thrown as a Net::Swirl::CurlURL::Exception
.
This is a subclass of Exception::FFI::ErrorCode. The error codes can be imported
from this module with the :errorcode
tag. Example:
use Net::Swirl::CurlURL qw( :errorcode );
try {
my $url = Net::Swirl::CurlURL->new;
$url->scheme('bogus');
} catch ($e) {
if($e isa Net::Swirl::CurlURL::Exception) {
if($e->code == CURLUE_UNSUPPORTED_SCHEME) {
}
}
}
SEE ALSO
AUTHOR
Graham Ollis plicease@cpan.org
COPYRIGHT AND LICENSE
This software is copyright (c) 2022 by Graham Ollis.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.