X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FApp%2FIdiotBox%2FImporter.pm;h=f0d0967a2b3b115fc4c2f089719607336ba24236;hb=f29e9b6f6ae3cd365017102ed4ec49160fe8f46a;hp=460077714dee15db558f13621cb795d4d1c739b1;hpb=26b4958ec93a29fb6918934f2b4fab0541bad2fd;p=catagits%2FApp-IdiotBox.git diff --git a/lib/App/IdiotBox/Importer.pm b/lib/App/IdiotBox/Importer.pm index 4600777..f0d0967 100644 --- a/lib/App/IdiotBox/Importer.pm +++ b/lib/App/IdiotBox/Importer.pm @@ -41,15 +41,20 @@ sub run { my $sn = prompt("What's the new short name (url path) for the slug ?"); my $ln = prompt("What's the new long name (description) for the slug ?"); - $sn =~ s/ /-/g; - - my $nb = $ib->buckets->add(bless({ + my ($nb, $err) = App::IdiotBox::Bucket->create( slug => $sn, name => $ln, - }, 'App::IdiotBox::Bucket')); + ); + + if ($err) { + log_info { "Error creating new bucket: $err" }; + redo CHOOSE; + } + + my $rnb = $ib->buckets->add($nb); log_info { "Created new bucket" }; - push @buckets, $nb; + push @buckets, $rnb; redo BUCKETS; }