Skip to content

Instantly share code, notes, and snippets.

Created August 25, 2009 01:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/174394 to your computer and use it in GitHub Desktop.
Save anonymous/174394 to your computer and use it in GitHub Desktop.
package WGDev::Command::Id;
use strict;
use warnings;
use 5.008008;
our $VERSION = '0.1.0';
use WGDev::Command::Base;
BEGIN { our @ISA = qw(WGDev::Command::Base) }
sub option_config {
return qw(
toHex
isValid
);
}
sub process {
my $self = shift;
my $wgd = $self->wgd;
my $session = $wgd->session();
foreach my $id ( $self->arguments ) {
if ($self->option('toHex')) {
print $session->id->toHex($id);
}
elsif ($self->option('isValid')) {
print $id if $session->id->valid($id);
}
print "\n";
}
return 1;
}
1;
__END__
=head1 NAME
WGDev::Command::Guid - Generates GUIDs via WebGUI's C<$session->id->generate> API
=head1 SYNOPSIS
wgd guid [-n <number of GUIDs to generate>] [--no-dashes]
=head1 DESCRIPTION
Generates GUIDs via WebGUI's C<$session->id->generate> API. Optionally
excludes GUIDs with dashes (for easy double-click copy/pasting).
=head1 OPTIONS
=over 8
=item C<--number> C<-n>
Number of GUIDs to generate. Defaults to 1.
=item C<--dashes>
Whether or not to filter GUIDs containing dashes (for easy double-click copy/pasting)
=back
=head1 AUTHOR
Patrick Donelan <pat@patspam.com>
=head1 LICENSE
Copyright (c) Patrick Donelan. All rights reserved.
This library is free software; you can redistribute it and/or modify it under
the same terms as Perl itself.
=cut
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment