App-Dochazka-CLI

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

        'Web::MREST::CLI'    => 0.280,
    },
    requires           => {
        'perl'               => 5.012,
        'App::CELL'          => 0.209,
        'App::Dochazka::Common'      => 0.199,
        'Date::Calc'         => 0,
        'File::HomeDir'      => 0,
        'File::Slurp'        => 0,
        'File::Temp'         => 0,
        'HTTP::Cookies'      => 0,
        'HTTP::Request'      => 0,
        'Getopt::Long'       => 2.32,
        'JSON'               => 0,
        'LWP::UserAgent'     => 0,
        'Params::Validate'   => 1.06,
        'Term::ReadKey'      => 0,
        'Term::ReadLine::Gnu' => 0,
        'Text::Table'        => 0,
        'Web::MREST::CLI'    => 0.281,
    },

Changes  view on Meta::CPAN

  - GET EMPLOYEE still returns current employee
  - GET EMPLOYEE $INTEGER returns employee with EID $INTEGER
  - GET EMPLOYEE $STRING returns employee with nick $STRING
  - GET EMPLOYEE $STRING-CONTAINING-% runs a 'LIKE' search for multiple employees
- add ReadLine/History support using Term::ReadLine::Perl5
- split off 'send_req' routine into new App::Dochazka::CLI::HTTP module
- fix bug "'get employee NON-EXISTENT-NICK' should produce an error message;
  instead, it says 'undef'"

0.006  2014-08-10 18:37 CEST
- Build.PL: add dependency HTTP::Cookies
- bin/dochazka-cli: use App::Dochazka::Model::Employee instead of inheriting from it
- HTTP.pm: construct LWP::UserAgent object with cookie_jar
- config/CLI_Config.pm: make a proper _Config.pm file for the application

0.007  2014-08-10 20:12 CEST
- bin/dochazka-cli: prompt for nick/password if not given in site configuration
- HTTP.pm: add 'init_ua' and 'cookie_jar' functions, use nick/password
  prompted from user if not given in site config
- Parser.pm: add GET COO[KIES]
- Build.PL: update dependencies

META.json  view on Meta::CPAN

      "runtime" : {
         "requires" : {
            "App::CELL" : "0.209",
            "App::Dochazka::Common" : "0.199",
            "Date::Calc" : "0",
            "File::HomeDir" : "0",
            "File::ShareDir" : "1.00",
            "File::Slurp" : "0",
            "File::Temp" : "0",
            "Getopt::Long" : "2.32",
            "HTTP::Cookies" : "0",
            "HTTP::Request" : "0",
            "JSON" : "0",
            "LWP::UserAgent" : "0",
            "Params::Validate" : "1.06",
            "Term::ReadKey" : "0",
            "Term::ReadLine::Gnu" : "0",
            "Text::Table" : "0",
            "Web::MREST::CLI" : "0.281",
            "perl" : "5.012"
         }

META.yml  view on Meta::CPAN

    version: 0
requires:
  App::CELL: 0.209
  App::Dochazka::Common: 0.199
  Date::Calc: 0
  File::HomeDir: 0
  File::ShareDir: 1.00
  File::Slurp: 0
  File::Temp: 0
  Getopt::Long: 2.32
  HTTP::Cookies: 0
  HTTP::Request: 0
  JSON: 0
  LWP::UserAgent: 0
  Params::Validate: 1.06
  Term::ReadKey: 0
  Term::ReadLine::Gnu: 0
  Text::Table: 0
  Web::MREST::CLI: 0.281
  perl: 5.012
resources:

Makefile.PL  view on Meta::CPAN

WriteMakefile
(
  'NAME' => 'App::Dochazka::CLI',
  'VERSION_FROM' => 'lib/App/Dochazka/CLI.pm',
  'PREREQ_PM' => {
                   'App::CELL' => '0.209',
                   'App::Dochazka' => '0.189',
                   'Date::Calc' => 0,
                   'File::ShareDir' => '1.00',
                   'Getopt::Long' => '2.32',
                   'HTTP::Cookies' => 0,
                   'HTTP::Request' => 0,
                   'JSON' => 0,
                   'LWP::UserAgent' => 0,
                   'Params::Validate' => '1.06',
                   'Term::ReadLine::Gnu' => 0,
                   'Test::Fatal' => 0,
                   'Text::Table' => 0,
                   'Web::MREST::CLI::UserAgent' => 0
                 },
  'INSTALLDIRS' => 'site',

config/CLI_Config.pm  view on Meta::CPAN

set( 'MREST_CLI_COOKIE_JAR', "$ENV{HOME}/.cookies.txt" );

# DOCHAZKA_CLI_LOG_FILE
#     default location of the log file
set( 'DOCHAZKA_CLI_LOG_FILE', "$ENV{HOME}/.dochazka-cli.log" );

# MREST_CLI_SUPPRESSED_HEADERS
#     list of headers to be suppressed in the output
set ('MREST_CLI_SUPPRESSED_HEADERS', [ qw( 
    accept content-type content-length cache-control pragma expires
    server Client-Response-Num Client-Peer Client-Date Set-Cookie Date
    Vary Client-SSL-Cert-Subject Client-SSL-Cipher
    Client-SSL-Socket-Class Client-SSL-Cert-Issuer Connection
    Strict-Transport-Security
) ] );


# -----------------------------------
# DO NOT EDIT ANYTHING BELOW THIS LINE
# -----------------------------------
use strict;

ext/CLI_SiteConfig.pm.example  view on Meta::CPAN

#set( 'MREST_CLI_COOKIE_JAR', "$ENV{HOME}/.cookies.txt" );

# DOCHAZKA_CLI_LOG_FILE
#     default location of the log file
#set( 'DOCHAZKA_CLI_LOG_FILE', "$ENV{HOME}/.dochazka-cli.log" );

# MREST_CLI_SUPPRESSED_HEADERS
#     list of headers to be suppressed in the output
#set ('MREST_CLI_SUPPRESSED_HEADERS', [ qw( 
#    accept content-type content-length cache-control pragma expires
#    server Client-Response-Num Client-Peer Client-Date Set-Cookie Date
#    Vary Client-SSL-Cert-Subject Client-SSL-Cipher
#    Client-SSL-Socket-Class Client-SSL-Cert-Issuer Connection
#    Strict-Transport-Security
#) ] );


# -----------------------------------
# DO NOT EDIT ANYTHING BELOW THIS LINE
# -----------------------------------
use strict;

lib/App/Dochazka/CLI/Testers.pm  view on Meta::CPAN

Now that the server part is working, install the CLI:

    zypper install perl-App-Dochazka-CLI

You should now be able to start the CLI and login as "demo" with password
"demo":

    $ dochazka-cli -u demo -p demo
    Loading configuration files from
    /usr/lib/perl5/vendor_perl/5.18.2/auto/share/dist/App-Dochazka-CLI
    Cookie jar: /root/.cookies.txt
    URI base http://localhost:5000 set from site configuration
    Authenticating to server at http://localhost:5000 as user root
    Server is alive
    Dochazka(2016-01-12) demo PASSERBY>

Exit the CLI by issuing the C<exit> command:

    Dochazka(2016-01-12) demo PASSERBY> exit
    $

lib/App/Dochazka/CLI/Testers.pm  view on Meta::CPAN

For the rest of this session, we will be logged in as the C<root> employee, 
which has a special status in that it is created when the database is
initialized and it is difficult or impossible to delete. In a freshly
initialized database, the C<root> employee's password is "immutable".

The username and password need not be specified on the command line.
Try it this way:

    $ dochazka-cli
    Loading configuration files from /usr/lib/perl5/vendor_perl/5.18.2/auto/share/dist/App-Dochazka-CLI
    Cookie jar: /root/.cookies.txt
    URI base http://localhost:5000 set from site configuration
    Username: root
    Authenticating to server at http://localhost:5000 as user root
    Password: 
    Server is alive
    Dochazka(2016-01-12) root ADMIN>

=head2 List employees

A list of all employees in the database can be obtained using the C<employee



( run in 0.369 second using v1.01-cache-2.11-cpan-e9199f4ba4c )