DOKK / manpages / debian 11 / libweb-mrest-cli-perl / Web::MREST::CLI::Parser.3pm.en
Web::MREST::CLI::Parser(3pm) User Contributed Perl Documentation Web::MREST::CLI::Parser(3pm)

Web::MREST::CLI::Parser - Parser for demo MREST command line client

    use Try::Tiny;
    
    my $status;
    my @tokens = split /\s+/, 'MY SAMPLE COMMAND';
    try { 
        Web::MREST::CLI::Parse::parse_tokens( [], \@tokens ); 
    } catch { 
        $status = $_; 
    };

The parsing of CLI commands takes place in the "parse_tokens" function, which calls itself recursively until it gets to a rather macabre-sounding

    die send_req . . .

This causes control to return to the while loop in "bin/mrest-cli" with the return value of the "send_req", which is a status object.

All tokens should be chosen to be distinguishable by their first three characters.

2021-01-09 perl v5.32.0