<commit_before># Copyright (C) 2008-2010, <NAME>.

package ojo;

use strict;
use warnings;

use Mojo::Client;

# I'm sorry, guys. I never meant to hurt you.
# Just to destroy everything you ever believed in.
sub import {

    # Prepare exports
    my $caller = caller;
    no strict 'refs';
    no warnings 'redefine';

    # Functions
    *{"${caller}::del"}  = sub { _request('delete',    @_) };
    *{"${caller}::form"} = sub { _request('post_form', @_) };
    *{"${caller}::get"}  = sub { _request('get',       @_) };
    *{"${caller}::post"} = sub { _request('post',      @_) };
    *{"${caller}::put"}  = sub { _request('put',       @_) };
}

# I heard beer makes you stupid.
# No I'm... doesn't.
sub _request {
    my $method = shift;
    pop @_ if ref $_[-1] && ref $_[-1] eq 'CODE';
    return Mojo::Client->new->proxy_env->$method(@_)->res;
}

1;
__END__

=head1 NAME

ojo - Fun Oneliners With Mojo!

=head1 SYNOPSIS

    perl -Mojo -e 'print get("http://mojolicio.us")->dom->at("title")->text'

=head1 DESCRIPTION

A collection of automatically exported functions for fun Perl oneliners.
Note that this module is EXPERIMENTAL and might change without warning!

=head1 FUNCTIONS

L<ojo> implements the following functions.

=head2 C<del>

    my $res = del('http://mojolicio.us');
    my $res = del('http://mojolicio.us', {'X-Bender' => 'X_x'});
    my $res =
      del('http://mojolicio.us', {'Content-Type' => 'text/plain', 'Hello!'});

Wrapper around C<delete> in L<Mojo::Client> that directly returns a
L<Mojo::Message::Response> object.<commit_msg>added b function to ojo<commit_after># Copyright (C) 2008-2010, <NAME>.

package ojo;

use strict;
use warnings;

use Mojo::ByteStream;
use Mojo::Client;

# I'm sorry, guys. I never meant to hurt you.
# Just to destroy everything you ever believed in.
sub import {

    # Prepare exports
    my $caller = caller;
    no strict 'refs';
    no warnings 'redefine';

    # Functions
    *{"${caller}::b"}    = sub { Mojo::ByteStream->new(@_) };
    *{"${caller}::del"}  = sub { _request('delete', @_) };
    *{"${caller}::form"} = sub { _request('post_form', @_) };
    *{"${caller}::get"}  = sub { _request('get', @_) };
    *{"${caller}::post"} = sub { _request('post', @_) };
    *{"${caller}::put"}  = sub { _request('put', @_) };
}

# I heard beer makes you stupid.
# No I'm... doesn't.
sub _request {
    my $method = shift;
    pop @_ if ref $_[-1] && ref $_[-1] eq 'CODE';
    return Mojo::Client->new->proxy_env->$method(@_)->res;
}

1;
__END__

=head1 NAME

ojo - Fun Oneliners With Mojo!

=head1 SYNOPSIS

    perl -Mojo -e 'print get("http://mojolicio.us")->dom->at("title")->text'

=head1 DESCRIPTION

A collection of automatically exported functions for fun Perl oneliners.
Note that this module is EXPERIMENTAL and might change without warning!

=head1 FUNCTIONS

L<ojo> implements the following functions.

=head2 C<b>

    my $stream = b('lalala');

Wrapper around C<new> in L<Mojo::ByteStream>.

=head2 C<del>

    my $res = del('http://mojolicio.us');
    my $res = del('http://mojolicio.us', {'X-Bender' => 'X_x'});
    my $res =
      del('http://mojolicio.us', {'Content-Type' => 'text/plain', 'Hello!'});

Wrapper around C<delete> in L<Mojo::Client> that directly returns a
L<Mojo::Message::Response> object.
{'fraction_non_alphanumeric': 0.18748100881191126, 'fraction_numerical': 0.010027347310847767, 'mean_word_length': 3.559556786703601, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '282339', 'n_tokens_mistral': 1223, 'n_tokens_neox': 1181, 'n_words': 330}