App-Dochazka-CLI

 view release on metacpan or  search on metacpan

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


    SCHEDULES FETCH ALL DISABLED

=head3 View an individual schedule (by SID or SCODE)

If the SID or SCODE of a schedule is known, it can be looked up like so:

    SID=12 SHOW
    SCODE=SAMPLE SHOW

The first example looks up the schedule with SID 12, and the second looks
up the schedule with SCODE "SAMPLE".

=head3 Define a new schedule

The following commands can be used to "create" a schedule, i.e. define it and
save it in the database. The idea is to first build up the schedule in memory
and then, when this "working" schedule is complete, submit it to the REST
server.

=head4 View working schedule

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

    $prompt_month 
    $prompt_day 
);
use App::Dochazka::Common::Model::Employee;
use Data::Dumper;
use Date::Calc qw( check_date Add_Delta_Days );
use Exporter 'import';
use File::ShareDir;
use Log::Any::Adapter;
use Params::Validate qw( :all );
use Scalar::Util qw( looks_like_number );
use Try::Tiny;
use Web::MREST::CLI qw( normalize_filespec send_req );



=head1 NAME

App::Dochazka::CLI::Util - Various reusable components


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

    my ( $key_spec, $key ) = $ARGS{key} =~ m/^(.*)\=(.*)$/;
    my $minimal = $ARGS{minimal} ? '/minimal' : '';

    my $status;
    if ( $key_spec =~ m/^emp/i ) {
        $status = send_req( 'GET', "employee/nick/$key$minimal" );
        BREAK_OUT: {
            last BREAK_OUT if $status->not_ok and $status->payload and $status->payload->{'http_code'} == 403;
            if ( $status->not_ok and $status->payload and $status->payload->{'http_code'} == 404 ) {
                $status = send_req( 'GET', "employee/sec_id/$key$minimal" );
                if ( $status->not_ok and $status->payload and $status->payload->{'http_code'} != 500 and looks_like_number( $key ) ) {
                    $status = send_req( 'GET', "employee/eid/$key$minimal" );
                }
            }
        }
    } elsif ( $key_spec =~ m/^nic/i ) {
        $status = send_req( 'GET', "employee/nick/$key$minimal" );
    } elsif ( $key_spec =~ m/^sec/i ) {
        $status = send_req( 'GET', "employee/sec_id/$key$minimal" );
    } elsif ( $key_spec =~ m/^eid/i ) {
        $status = send_req( 'GET', "employee/eid/$key$minimal" );



( run in 0.355 second using v1.01-cache-2.11-cpan-64827b87656 )