7 maybe_mkdir("sections");
20 $dir = "sections/" . substr("0$section", -2);
22 write_file("$dir/name", $_);
23 print "created section $section ($dir) - $_\n";
27 die "query before first section header"
31 my $filename = $dir . "/" . substr("0$query", -2) . ".cql";
32 write_file($filename, $_);
33 $filename =~ s@sections/(.*)\.cql@$1@;
34 print " added $filename - $_\n";
38 my($name, $contents) = @_;
40 my $fh = new IO::File(">$name")
41 or die "can't create '$name': $!";
42 $fh->print($contents);
51 if ($! =~ /exists/i) {
54 die "can't create directory '$dir': $!";