App-Nopaste-Service-Dancebin

 view release on metacpan or  search on metacpan

CHANGES  view on Meta::CPAN

==================================================

------------------------------------------
version 0.004 at 2012-08-27 21:07:57 +0000
------------------------------------------

  Change: 73bf7349565252651fcbe2825b76c09dc0eed0b6
  Author: William Wolf <throughnothing@gmail.com>
  Date : 2012-08-27 14:06:47 +0000

    Merge pull request #1 from throughnothing/credentials

    Allow use of BasicAuth credentials. 

  Change: 5a4f035cfe788d024014edfe98104e42b06d8fa9
  Author: William Wolf <throughnothing@gmail.com>
  Date : 2012-08-27 14:04:49 +0000

    Allow use of BasicAuth credentials. 

------------------------------------------
version 0.003 at 2012-05-17 23:08:07 +0000
------------------------------------------

  Change: 93f5a7248c5acdffb40d803c59fd6f461ead7b45
  Author: William Wolf <throughnothing@gmail.com>
  Date : 2012-05-17 16:08:07 +0000

    v0.003 

README.md  view on Meta::CPAN


[Dancebin](https://github.com/throughnothing/Dancebin) Service for [nopaste](http://search.cpan.org/perldoc?nopaste).

To use, simple use:

    $ echo "text" | nopaste -s Dancebin

By default it pastes to [http://danceb.in/](http://danceb.in/), but you can
override this be setting the `DANCEBIN_URL` environment variable.

You can set HTTP Basic Auth credentials to use for the nopaste service
if necessary by using:

    DANCEBIN_USER=username
    DANCEBIN_PASS=password

The expiration of the post can be modified by setting the `DANCEBIN_EXP`
environment variable.  Acceptable values are things like:

    DANCEBIN_EXP=weeks:1
    DANCEBIN_EXP=years:1:months:2

README.pod  view on Meta::CPAN


L<Dancebin|https://github.com/throughnothing/Dancebin> Service for L<nopaste>.

To use, simple use:

    $ echo "text" | nopaste -s Dancebin

By default it pastes to L<http://danceb.in/|http://danceb.in/>, but you can
override this be setting the C<DANCEBIN_URL> environment variable.

You can set HTTP Basic Auth credentials to use for the nopaste service
if necessary by using:

    DANCEBIN_USER=username
    DANCEBIN_PASS=password

The expiration of the post can be modified by setting the C<DANCEBIN_EXP>
environment variable.  Acceptable values are things like:

    DANCEBIN_EXP=weeks:1
    DANCEBIN_EXP=years:1:months:2

lib/App/Nopaste/Service/Dancebin.pm  view on Meta::CPAN


use base q[App::Nopaste::Service];

# ABSTRACT: nopaste service for L<Dancebin>

sub uri { $ENV{DANCEBIN_URL} || 'http://danceb.in/' }

sub get {
    my ($self, $mech) = @_;

    # Set BasicAuth credentials if needed
    $mech->credentials( $self->_credentials ) if $self->_credentials;

    return $mech->get($self->uri);
}

sub fill_form {
    my ($self, $mech) = (shift, shift);
    my %args = @_;

    my $content = {
        code    => decode_utf8($args{text}),
        title   => decode_utf8($args{desc}),
        lang    => decode_utf8($args{lang}),
    };
    my $exp = $ENV{DANCEBIN_EXP};
    $content->{expiration} = $exp if $exp;

    # Set BasicAuth credentials if needed
    $mech->credentials( $self->_credentials ) if $self->_credentials;

    my $form = $mech->form_number(1) || return;

    # do not follow redirect please
    @{$mech->requests_redirectable} = ();

    my $paste = HTML::Form::Input->new(
        type  => 'text',
        value => 'Send',
        name  => 'paste'

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.516 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )