#!/ms/dist/perl5/bin/perl5.8

use warnings;
use strict;

use MSDW::Version
  'Class-Accessor'     => '0.31', 
  'Parse-RecDescent'   => '1.963',
  'aquilon/Google-ProtocolBuffers' => '0.08',
;
use Google::ProtocolBuffers;
use Getopt::Long;
use File::Basename;

sub usage {
    my ($exit_code, $message) = @_;
    if (! defined($exit_code)) {
	$exit_code = 0;
    }
    if ($message) {
	print "$message\n";
    }
    print "Usage: " . basename($0) . " --spec <protocol buffer spec> --directory <target directory> || --help\n";
    exit($exit_code);
}

my %opt;
GetOptions(\%opt, qw(spec=s directory=s help)) || usage(1, "Can't process options");
if (! -f $opt{spec}) {
    die "Can't find protocol buffer spec file '$opt{spec} (--spec)'\n";
}
my $pbname = basename($opt{spec});
$pbname =~ s/\b([a-z])/\u$1/g;
$pbname =~ s/proto/pm/i;
my $target_module = $opt{directory} . "/" . $pbname;
Google::ProtocolBuffers->parsefile($opt{spec}, { generate_code => $target_module } );

#!/ms/dist/perl5/bin/perl5.8

use warnings;
use strict;

use MSDW::Version
  'Class-Accessor'     => '0.31', 
  'Parse-RecDescent'   => '1.963',
  'Google-ProtocolBuffers' => '0.08',
;
use Google::ProtocolBuffers;
use Getopt::Long;
use File::Basename;

sub usage {
    my ($exit_code, $message) = @_;
    if (! defined($exit_code)) {
	$exit_code = 0;
    }
    if ($message) {
	print "$message\n";
    }
    print "Usage: " . basename($0) . " --spec <protocol buffer spec> --directory <target directory> || --help\n";
    exit($exit_code);
}

my %opt;
GetOptions(\%opt, qw(spec=s directory=s help)) || usage(1, "Can't process options");
if (! -f $opt{spec}) {
    die "Can't find protocol buffer spec file '$opt{spec} (--spec)'\n";
}
my $pbname = basename($opt{spec});
$pbname =~ s/\b([a-z])/\u$1/g;
$pbname =~ s/proto/pm/i;
my $target_module = $opt{directory} . "/" . $pbname;
Google::ProtocolBuffers->parsefile($opt{spec}, { generate_code => $target_module } );

Use the default Perl protobuf library
Use the default Perl protobuf library

Addresses-Issue: Jira/AQUILON-1025

Change-Id: I98628a4087f331bfbe04add2dc0efafa8677a6ec
Reviewed-By: Zoltan Sebestyen <be2314d0afde2d2352aeb623a228e572c9b6cb8b@morganstanley.com>
