flex.pl #2

  • //
  • guest/
  • perforce_software/
  • p4flexclone/
  • demo/
  • flex.pl
  • View
  • Commits
  • Open Download .zip Download (1 KB)
#!/usr/local/bin/perl -w

use strict;
use warnings;
use feature qw/switch/;
use Data::Dumper;

# Open a file for READ
open (FILE, ">", "out.log") or die $!;

# Add some magic here...

print( "action: RESPOND\n" );

my $map;
foreach my $line (<STDIN>) {
  chomp $line;
  my @parts = split(/: /, $line);
  $map->{$parts[0]} = $parts[1];
}
print FILE Dumper($map);


my $cmd = $map->{'Arg0'};
my $name = $map->{'Arg1'};

given($cmd) {
  when(/create/) {
    create($name); 
  }
  when(/help/) {
    print( "message: todo\n" ); 
  }
  when(/client/) {
    print( "message: todo\n" );
  }
  when(/clients/) {
    print( "message: todo\n" ); 
  }
  default {
    print( "message: Unknown command.  Try 'p4 flex help' for info\n" );
  }
}

print( "message: EXIT\n" );
exit(0);



# ----------------------------------------------------------------------------
# Create a volume
# ----------------------------------------------------------------------------
sub create {
  my $name = shift;
  print( "message: running a flex clone create on '$name'\n" );
}
# Change User Description Committed
#2 13607 Paul Allen Added logging to out.log file and test commands...

$ p4 flex create foo
running a flex clone create on 'foo'

$ p4 flex client foo.ws1
todo
#1 13267 Paul Allen #review-13268 simple 'p4 flex' broker demo.