App::Nopaste::Service::PastebinCom - http://pastebin.com/


App-Nopaste documentation Contained in the App-Nopaste distribution.

Index


Code Index:

NAME

Top

App::Nopaste::Service::PastebinCom - http://pastebin.com/

SEE ALSO

Top

WWW::Pastebin::PastebinCom::Create


App-Nopaste documentation Contained in the App-Nopaste distribution.

package App::Nopaste::Service::PastebinCom;
use strict;
use warnings;
use base 'App::Nopaste::Service';

sub available {
    eval "require WWW::Pastebin::PastebinCom::Create; 1"
}

sub run {
    my $self = shift;
    my %args = @_;

    require WWW::Pastebin::PastebinCom::Create;

    $args{poster} = delete $args{nick} if defined $args{nick};
    $args{format} = delete $args{lang} if defined $args{lang};

    my $paster = WWW::Pastebin::PastebinCom::Create->new;
    my $ok = $paster->paste(
        expiry => 'm',
        %args,
    );

    return (0, $paster->error) unless $ok;
    return (1, $paster->paste_uri);
}

1;

__END__