diff options
author | Petter Reinholdtsen <pere@hungry.com> | 2009-10-26 13:17:03 +0000 |
---|---|---|
committer | Petter Reinholdtsen <pere@hungry.com> | 2009-10-26 13:17:03 +0000 |
commit | 4fc58c5f102bd76fc022c3343b30c6567df5c263 (patch) | |
tree | c5c1b7c382dcea2af73cdc7dbd4154959de25669 | |
parent | f88effa3c8503801a184dc693ae89caf146aced3 (diff) |
Inn med argumentparsing.
-rwxr-xr-x | makefront/makefront | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/makefront/makefront b/makefront/makefront index 1603d2f..4074870 100755 --- a/makefront/makefront +++ b/makefront/makefront @@ -13,13 +13,18 @@ use Text::Wrap qw($columns); print "Startet Makefront, laget for NUUG 2009.\n"; -my $filename = "test.png"; -my $count = 0; -do { - $filename="NUUG-vid_front${count}.png"; - $count++; -} until ! -e $filename; +use vars qw($presenter $title $time $place %opts); +getopts("o:p:t:w:l:", \%opts); + +my $filename = $opts{'o'}; +unless ($filename) { + my $count = 0; + do { + $filename="NUUG-vid_front${count}.png"; + $count++; + } until ! -e $filename; +} print "Output til filen ${filename}...\n"; #Starte med å putte NUUG-logoen på video-bakgrunnen. @@ -34,23 +39,23 @@ print "Laget trinn 2 av 3...\n"; #Spør om input til variabler -my $presenter = - prompt(undef, +$presenter = + prompt($opts{'p'}, "Skriv inn navnet på foredragsholder (maks 25 tegn):\n"); -my $title = - prompt(undef, +$title = + prompt($opts{'t'}, "Skriv inn tittelen til foredraget (maks 25 tegn):\n"); -my $time = - prompt(undef, +$time = + prompt($opts{'w'}, "Skriv inn tid for foredraget: (`date +%d.\ %B\ %Y`):\n"); +$place = + prompt($opts{'l'}, + "Skriv inn sted for foredraget:\n"); unless ($time) { $time=`date +%d.\ %B\ %Y`; } -my $place = - prompt(undef, "Skriv inn sted for foredraget:\n"); - my $timeplace; unless ($place) { $timeplace=$time; |