Help language development. Donate to The Perl Foundation

LWP::Simple zef:dwarring last updated on 2022-09-15
LWP::Simple for Raku

![Test Windows and MacOS](

This is a quick & dirty implementation of a LWP::Simple clone for Raku; it does both `GET` and `POST` requests.


LWP::Simple depends on the modules MIME::Base64 and URI,
which you can find at The tests depends
on [JSON::Tiny](


    zef install --deps-only .

You'll have to
install [IO::Socket::SSL]( via

    zef install IO::Socket::SSL

if you want to work with `https` too.


use LWP::Simple;

my $content = LWP::Simple.get("");

my $response ="", { so => True }


## get ( $url, [ %headers = {},  Bool :$exception ] )

Sends a GET request to the value of `$url`. Returns the content of the return
request. Errors are ignored and will result in a `Nil` value unless
`$exception` is set to `True`, in which case an `LWP::Simple::Response` object
containing the status code and brief description of the error will be returned.

Requests are make with a default user agent of `LWP::Simple/$VERSION
Raku/$*` which may get blocked by some web servers. Try
overriding the default user agent header by passing a user agent string to the
`%headers` argument with something like `{ 'User-Agent' => 'Your User-Agent
String' }` if you have trouble getting content back.

Current status

You can
use [HTTP::UserAgent](
instead, with more options. However, this module will do just fine in
most cases. 

The documentation of this module is incomplete. Contributions are appreciated.


Use the installed commands:




If `ÌO::Socket::SSL` has been installed.


will instead print to standard output.

Known bugs

[issues raised](,
[in this repo](,
there could be some issues with older versions of MacOSx. This issue
does not affect the functionality of the module, but just the test
script itself, so you can safely install with `--force`. Right now,
it's working correctly (as far as tests go) with Windows, MacOSx and


This distribution is licensed under the terms of
[Artistic 2.0 license]( You
can find a [copy](LICENSE) in the repository itself.