in reply to Error Correction
#!/usr/bin/perl use strict; use warnings; use File::Copy "cp"; my $confINPUT; my ($i) = 0; my ($date) = &getDate; my ($confOutName) = shift @ARGV; die "$!\n" unless open CONF_ID, '<', "@ARGV"; die "$!\n" unless open CONFLIST1, '>>', 'conf_list1.tmp'; die "$!\n" unless open CONFLIST2, '>>', 'conf_list2.tmp'; die "$!\n" unless open CONFLIST3, '>>', 'conf_list3.tmp'; die "$!\n" unless open CONFADD, '>>', "./additions/additions_$ARGV[0 +]_date"; while ( defined( $_ = <CONF_ID> ) ) { next unless /\S/; die "$!\n" unless open TEMPLATE1, '<', './templates/conf_template' +; die "$!\n" unless open TEMPLATE2, '<', './templates/conf_template2 +'; die "$!\n" unless open TEMPLATE3, '<', './templates/conf_template3 +'; $confINPUT = $_; my ( $confID, $confPIN ) = split( " ", $confINPUT, 3 ); while ( defined( $_ = <TEMPLATE1> ) ) { $_ =~ s/XXXXXX/$confID/g; print CONFLIST1 $_; } while ( defined( $_ = <TEMPLATE2> ) ) { $_ =~ s/XXXXXX/$confID/g; $_ =~ s/AAAA/$confPIN/g; print CONFLIST2 $_; } while ( defined( $_ = <TEMPLATE3> ) ) { $_ =~ s/XXXXXX/$confID/g; print CONFLIST3 $_; } die "$!\n" unless close TEMPLATE1; die "$!\n" unless close TEMPLATE2; die "$!\n" unless close TEMPLATE3; } die "$!\n" unless close CONFLIST1; die "$!\n" unless close CONFLIST2; die "$!\n" unless close CONFLIST3; die "$!\n" unless open CONFLIST1, '<', 'conf_list1.tmp'; die "$!\n" unless open CONFLIST2, '<', 'conf_list2.tmp'; die "$!\n" unless open CONFLIST3, '<', 'conf_list3.tmp'; print CONFADD "; start conference config 1\n"; while ( defined( $_ = <CONFLIST1> ) ) { print CONFADD $_; } print CONFADD "\n\n; start conference config 2\n"; while ( defined( $_ = <CONFLIST2> ) ) { print CONFADD $_; } print CONFADD "\n\n; meetme_additional_custom.conf\n"; while ( defined( $_ = <CONFLIST3> ) ) { print CONFADD $_; } close CONFADD; die "$!\n" unless close CONFLIST1; die "$!\n" unless close CONFLIST2; die "$!\n" unless close CONFLIST3; cp( "$ARGV[0]", "./finished_list/@ARGV.finished" ); unlink "$ARGV[0]"; die "$!\n" unless unlink 'conf_list1.tmp'; die "$!\n" unless unlink 'conf_list2.tmp'; die "$!\n" unless unlink 'conf_list3.tmp'; print "Number of Entries processed: $i\n"; exit 0; sub getDate() { my (@months) = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov De +c); my (@weekDays) = qw(Sun Mon Tue Wed Thu Fri Sat Sun); my ( $second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings ) = localtime(); my ($year) = 1900 + $yearOffset; my ($theTime) = "${dayOfMonth}_$months[$month]"; return $theTime; }
|
|---|