Webservice-Sendy-API

 view release on metacpan or  search on metacpan

bin/sendy  view on Meta::CPAN

use Webservice::Sendy::API qw//;
use Util::H2O::More        qw/ddd Getopt2h2o ini2h2o o2d/;

my $VERSION = '0.8';

use constant {
  EXIT_SUCCESS => 0,
  EXIT_ERROR   => 1,
};

my $HOME = (getpwuid($<))[7];
my $CONFIG = "$HOME/.sendy.ini";

my $subcommand = shift @ARGV;

sub do_help() {
  print STDERR <<EOF;
sendy Utility version $local::bin::sendy::VERSION - for Sendy 6.1.2+, bundled with Webservice::Sendy::API (https://metacpan.org)

This utility is distributed with the Perl library, Webservice::Sendy::API. It uses
the library to implement the following subcommands. It is a good example of how

lib/Webservice/Sendy/API.pm  view on Meta::CPAN

use JSON            qw/decode_json/;
use Util::H2O::More qw/baptise ddd HTTPTiny2h2o h2o ini2h2o o2d/;

our $VERSION = '0.8';

sub new {
    my $pkg = shift;
    my $params = { @_, ua => HTTP::Tiny->new };
    my $self = baptise $params, $pkg, qw/config/;
    if (not $self->config) {
      my $HOME = (getpwuid($<))[7];
      $self->config("$HOME/.sendy.ini");
    }
    if (not -e $self->config) {
      die sprintf "Webservice::Sendy::API requires a configuration file! (looking for, '%s')\n", $self->config;
    }
    # update config field with contents of the config file
    $self->config(ini2h2o $self->config);
    return $self;
}



( run in 0.261 second using v1.01-cache-2.11-cpan-454fe037f31 )