The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Z::App - load Zydeco::Lite::App, strict, warnings, Types::Standard, etc

SYNOPSIS

In consumer.pl:

  #! perl
  
  use Z::App;
  
  app 'MyApp' => sub {
    
    command 'Eat' => sub {
      
      constant documentation => 'Consume some food.';
      
      arg 'foods' => (
        type          => ArrayRef[Str],
        documentation => 'A list of foods.',
      );
      
      run {
        my ( $self, $foods ) = ( shift, @_ );
        $self->info( "Eating $_." ) for @$foods;
        return 0;
      };
    };
    
    command 'Drink' => sub {
      
      constant documentation => 'Consume some drinks.';
      
      arg 'drinks' => (
        type          => ArrayRef[Str],
        documentation => 'A list of drinks.',
      );
      
      run {
        my ( $self, $drinks ) = ( shift, @_ );
        $self->info( "Drinking $_." ) for @$drinks;
        return 0;
      };
    };
  };
  
  'MyApp'->execute( @ARGV );

At the command line:

  $ ./consumer.pl help eat
  usage: consumer.pl eat [<foods>...]
  
  Consume some food.
  
  Flags:
    --help  Show context-sensitive help.
  
  Args:
    [<foods>]  A list of foods.

  $ ./consumer.pl eat pizza chocolate
  Eating pizza.
  Eating chocolate.

DESCRIPTION

Z::App is like Z but loads Zydeco::Lite::App instead of Zydeco::Lite.

BUGS

Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Zydeco-Lite-App.

SEE ALSO

Z, Zydeco::Lite::App.

AUTHOR

Toby Inkster <tobyink@cpan.org>.

COPYRIGHT AND LICENCE

This software is copyright (c) 2020 by Toby Inkster.

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

DISCLAIMER OF WARRANTIES

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.