#!perl

#PODNAME: pastebin-create2
use strict;
use warnings;
use WWW::Pastebin::PastebinCom::Create;
use Getopt::Long qw(GetOptions);
use v5.10;

my ( $text_input, $format_input, $expiry_input, $privacy_input, $desc_input );

GetOptions(
    'text=s'    => \$text_input,
    'format=s'  => \$format_input,
    'expiry=s'  => \$expiry_input,
    'private=i' => \$privacy_input,
    'desc=s'    => \$desc_input
  )
  or die
"Usage: $0 --text 'TEXT' --format 'none' --expiry 10m --private 0 --desc 'DESCRIPTION'";

my $bin = WWW::Pastebin::PastebinCom::Create->new;

my $uri = $bin->paste(
    text    => $text_input,
    format  => $format_input,
    expiry  => $expiry_input,
    private => $privacy_input,
    desc    => $desc_input
  )
  or die "You need at least to declare --text flag. Debug-message-> "
  . $bin->error;

say "Your paste URL: $bin";

__END__

=pod

=encoding UTF-8

=head1 NAME

pastebin-create2

=head1 VERSION

version 0.07

=head1 AUTHOR

faraco <skelic3@gmail.com>, mfzz <mfzz@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by faraco <skelic3@gmail.com>, mfzz <mfzz@cpan.org>.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut