NAME

WWW::Noss::Curl - Interface to curl command

USAGE

use WWW::Noss::Curl qw(curl);

curl('https://url', 'output');

DESCRIPTION

WWW::Noss::Curl is a module that provides an interface to the curl(1) command for fetching network resources. This is a private module, please consult the noss manual for user documentation.

SUBROUTINES

Subroutines are not automatically exported.

$rt = curl($link, $output, [ %param ])

curl(1) $link and download it to $output. %param is an optional hash argument of additional parameters to pass.

Returns the exit code of curl(1). A return value of 0 means success, non-zero means failure. curl_error() can be used to describe the return value.

The following are valid fields for the %param hash:

verbose

Boolean determining whether to enable verbose output or not. Corresponds to curl(1)'s --silent option. Defaults to false.

agent

String to use as user agent. Corresponds to curl(1)'s --user-agent option. Defaults to none.

time_cond

Only download a file if it has been modified past the given time. Can either be a timestamp or file. Corresponds to curl(1)'s --time-cond option. Defaults to none.

remote_time

Copy the remote file's modification time when downloading a file. Corresponds to curl(1)'s --remote-time option. Defaults to false.

etag_save

Path to file to write remote file's etag to, if it has one. Corresponds to curl(1)'s --etag-save option. Defaults to none.

etag_compare

Path to file to compare remote file's etag to, only downloading the remote file if the etags differ. Corresponds to curl(1)'s --etag-compare option. Defaults to none.

limit_rate

Download rate to limit curl(1) to. Corresponds to curl(1)'s --limit-rate option. Defaults to none.

user_agent

User agent string to send to server. Corresponds to curl(1)'s --user-agent option. Defaults to none.

timeout

Maximum time in seconds a transfer is allowed to take. Corresponds to curl(1)'s --max-time option. Defaults to no timeout.

fail

Boolean determining if curl(1) should fail with no output on server errors. Corresponds to curl(1)'s --fail option. Defaults to false.

proxy

Host to use as proxy. Corresponds to curl(1)'s --proxy option. Defaults to none.

proxy_user

Username and password to use for proxy, seperated by a colon (user:pwd). Corresponds to curl(1)'s --proxy-user option. Defaults to none.

$desc = curl_error($rt)

Returns the string description of the curl() exit code $rt.

GLOBAL VARIABLES

%WWW::Noss::Curl::CODES

Hash of curl() exit codes and their corresponding string descriptions. Use of the curl_error() function is preferable.

AUTHOR

Written by Samuel Young, <samyoung12788@gmail.com>.

This project's source can be found on its Codeberg page. Comments and pull requests are welcome!

COPYRIGHT

Copyright (C) 2025 Samuel Young

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

SEE ALSO

curl(1), noss