File: hello.pm

package info (click to toggle)
libapp-cmd-perl 0.339-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 556 kB
  • sloc: perl: 1,919; makefile: 8; sh: 3
file content (23 lines) | stat: -rw-r--r-- 408 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package Test::MyCmd::Command::hello;

use strict;
use warnings;

use parent qw(App::Cmd::Command);

use IPC::Cmd qw/can_run/;

sub execute {
  my ($self, $opt, $arg) =@_;

  if ($^O eq 'MSWin32') {
    system('cmd', '/c', 'echo', "Hello World");
  } else {
    my $echo = can_run("echo");
    $self->usage_error("Program 'echo' not found") unless $echo;
    system($echo, "Hello World");
  }
  return;
}

1;