App::Wax - webify your CLI
my $wax = App::Wax->new(); exit $wax->run(\@ARGV);
App::Wax is the helper library for wax, a simple command-line program that runs other command-line programs and converts their URL arguments to file paths.
See the wax documentation for more details.
Attributes are fields that can optionally be set in the
App::Wax constructor, and get/set by invoking the corresponding getter/setter methods (which have the same names as the constructor fields) after the
App::Wax object has been initialized. Attributes can be initialized with a hash or hash ref e.g.
my $wax = App::Wax->new(debug => 1); $wax->timeout(180); exit $wax->run(\@ARGV);
Getter/setter for the name used in the usage message and used to launch perldoc for the
--help &c. options. Default:
Gets or sets the debug flag, used to determine whether to display diagnostic messages.
Gets or sets the separator token used to mark the end of waxable options. Default:
Setting the separator to
undef disables detection of the wax separator token i.e. no separator is used to mark the end of waxable options.
Getter/setter for the timeout (in seconds) for HTTP requests. Default: 60.
Getter/setter for the LWP::UserAgent instance used to perform HTTP requests.
Getter/setter for the HTTP user-agent string.
Returns the content type for the supplied URL.
Saves the contents of the URL to the specified path.
Returns the file extension for the given URL (e.g.
.html) if one can be determined from the path component of the URL, or the resource's
Content-type header. Otherwise, returns undef.
Returns a true value (a reference to an array of URL components returned by URI::Split's
uri_split method) if the supplied string is a valid absolute URL, false otherwise.
Logs the string or list of strings to STDERR if debugging is enabled.
Getter for the MIME::Types instance used to map the
content_type to an extension.
Takes a reference to a list of
@ARGV arguments and runs the specified command with temporary filenames substituted for URLs. Returns the command's exit code.
Returns undef if the supplied argument isn't a URL, or a File::Temp object representing the temporary file to which the URL should be mirrored otherwise.
Prints a brief usage message and exits.
None by default.
Copyright (C) 2010-2011 by chocolateboy
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.