Skip to content

Commit

Permalink
clean up planet names before comparing, allow leaving punctuation out
Browse files Browse the repository at this point in the history
  • Loading branch information
cxreg committed Dec 12, 2010
1 parent e526e2d commit 568b520
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions examples/stash_it.pl
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@
use List::Util qw(first);

my $cfg_file = 'lacuna.yml';
my ($help, $arg_planet_name);
my ($help, $arg_planet_name, $clean_arg_planet_name);
GetOptions(
'cfg=s' => \$cfg_file,
'planet=s' => \$arg_planet_name,
'h|help' => \$help,
) or usage();
if ($arg_planet_name) {
($clean_arg_planet_name = lc($arg_planet_name)) =~ s/\W//g;
}

usage() if $help;

Expand All @@ -39,7 +42,8 @@
# Scan each planet
my ($planet_name, $emb);
for my $name ( sort keys %planets ) {
next if defined $arg_planet_name and lc($name) ne lc($arg_planet_name);
(my $clean_name = lc($name)) =~ s/\W//g;
next if defined $clean_arg_planet_name and $clean_name ne $clean_arg_planet_name;

# Load planet data
my $planet = $client->body( id => $planets{$name} );
Expand Down

0 comments on commit 568b520

Please sign in to comment.