Aion-Surf

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN


get "http://example/ex"             # => get
surf "http://example/ex"            # => get

head "http://example/ex"            # -> 1
head "http://example/not-found"     # -> ""

surf HEAD => "http://example/ex"    # -> 1
surf HEAD => "http://example/not-found"  # -> ""

[map { surf $_ => "http://example/ex" } qw/GET HEAD POST PUT PATCH DELETE/] # --> [qw/get 1 post put patch delete/]

patch "http://example/json" # --> {a => 10}

[map patch, qw! http://example/ex http://example/json !]  # --> ["patch", {a => 10}]

get ["http://example/ex", headers => {Accept => "*/*"}]  # => get
surf "http://example/ex", headers => [Accept => "*/*"]   # => get
```

# DESCRIPTION

Aion::Surf contains a minimal set of functions for surfing the Internet. The purpose of the module is to make surfing as easy as possible, without specifying many additional settings.

# SUBROUTINES

lib/Aion/Surf.md  view on Meta::CPAN


get "http://example/ex"             # => get
surf "http://example/ex"            # => get

head "http://example/ex"            # -> 1
head "http://example/not-found"     # -> ""

surf HEAD => "http://example/ex"    # -> 1
surf HEAD => "http://example/not-found"  # -> ""

[map { surf $_ => "http://example/ex" } qw/GET HEAD POST PUT PATCH DELETE/] # --> [qw/get 1 post put patch delete/]

patch "http://example/json" # --> {a => 10}

[map patch, qw! http://example/ex http://example/json !]  # --> ["patch", {a => 10}]

get ["http://example/ex", headers => {Accept => "*/*"}]  # => get
surf "http://example/ex", headers => [Accept => "*/*"]   # => get
```

# DESCRIPTION

Aion::Surf contains a minimal set of functions for surfing the Internet. The purpose of the module is to make surfing as easy as possible, without specifying many additional settings.

# SUBROUTINES

lib/Aion/Surf.pm  view on Meta::CPAN

package Aion::Surf;
use 5.22.0;
no strict; no warnings; no diagnostics;
use common::sense;

our $VERSION = "0.0.3";

use List::Util qw/pairmap/;
use LWP::UserAgent qw//;
use HTTP::Cookies qw//;
use Aion::Format::Json qw//;
use Aion::Format::Url qw//;

use Exporter qw/import/;
our @EXPORT = our @EXPORT_OK = grep {
	ref \$Aion::Surf::{$_} eq "GLOB"
		&& *{$Aion::Surf::{$_}}{CODE}
			&& !/^(_|(NaN|import)\z)/n

lib/Aion/Surf.pm  view on Meta::CPAN


		my $ok = post "https://api.telegram.org/bot${\ TELEGRAM_BOT_TOKEN}/getUpdates", json => {
			offset => $offset,
		};

		die $ok->{description} if !$ok->{ok};

		my $result = $ok->{result};
		return \@updates if !@$result;

		push @updates, map $_->{message}, grep $_->{message}, @$result;

		$offset = $result->[$#$result]{update_id} + 1;
	}
}

1;

__END__

=encoding utf-8

lib/Aion/Surf.pm  view on Meta::CPAN

	
	get "http://example/ex"             # => get
	surf "http://example/ex"            # => get
	
	head "http://example/ex"            # -> 1
	head "http://example/not-found"     # -> ""
	
	surf HEAD => "http://example/ex"    # -> 1
	surf HEAD => "http://example/not-found"  # -> ""
	
	[map { surf $_ => "http://example/ex" } qw/GET HEAD POST PUT PATCH DELETE/] # --> [qw/get 1 post put patch delete/]
	
	patch "http://example/json" # --> {a => 10}
	
	[map patch, qw! http://example/ex http://example/json !]  # --> ["patch", {a => 10}]
	
	get ["http://example/ex", headers => {Accept => "*/*"}]  # => get
	surf "http://example/ex", headers => [Accept => "*/*"]   # => get

=head1 DESCRIPTION

Aion::Surf contains a minimal set of functions for surfing the Internet. The purpose of the module is to make surfing as easy as possible, without specifying many additional settings.

=head1 SUBROUTINES

t/aion/surf.t  view on Meta::CPAN


::is scalar do {get "http://example/ex"}, "get", 'get "http://example/ex"             # => get';
::is scalar do {surf "http://example/ex"}, "get", 'surf "http://example/ex"            # => get';

::is scalar do {head "http://example/ex"}, scalar do{1}, 'head "http://example/ex"            # -> 1';
::is scalar do {head "http://example/not-found"}, scalar do{""}, 'head "http://example/not-found"     # -> ""';

::is scalar do {surf HEAD => "http://example/ex"}, scalar do{1}, 'surf HEAD => "http://example/ex"    # -> 1';
::is scalar do {surf HEAD => "http://example/not-found"}, scalar do{""}, 'surf HEAD => "http://example/not-found"  # -> ""';

::is_deeply scalar do {[map { surf $_ => "http://example/ex" } qw/GET HEAD POST PUT PATCH DELETE/]}, scalar do {[qw/get 1 post put patch delete/]}, '[map { surf $_ => "http://example/ex" } qw/GET HEAD POST PUT PATCH DELETE/] # --> [qw/get 1 post put ...

::is_deeply scalar do {patch "http://example/json"}, scalar do {{a => 10}}, 'patch "http://example/json" # --> {a => 10}';

::is_deeply scalar do {[map patch, qw! http://example/ex http://example/json !]}, scalar do {["patch", {a => 10}]}, '[map patch, qw! http://example/ex http://example/json !]  # --> ["patch", {a => 10}]';

::is scalar do {get ["http://example/ex", headers => {Accept => "*/*"}]}, "get", 'get ["http://example/ex", headers => {Accept => "*/*"}]  # => get';
::is scalar do {surf "http://example/ex", headers => [Accept => "*/*"]}, "get", 'surf "http://example/ex", headers => [Accept => "*/*"]   # => get';

# 
# # DESCRIPTION
# 
# Aion::Surf contains a minimal set of functions for surfing the Internet. The purpose of the module is to make surfing as easy as possible, without specifying many additional settings.
# 
# # SUBROUTINES



( run in 0.601 second using v1.01-cache-2.11-cpan-65fba6d93b7 )