# Da subs sub parse_form { my $sr; foreach my $str (qw(name words plain topic pass textcolor textface textsize topicsize edit)) { $sr->{$str} =$q->param($str); } $name =~ s/\s/_/g; $plain_words=$words; $words =~ s/\r\n//g; while ($words=~ //gi ) {$line_break_count++} #used in fork below if ($q->param( "upload_file" )) { file_up(); } if ($edit eq "done") { send_edit_form(); } elsif ($edit eq "yes") { #if params are undef make_edit_form(); } if ($line_break_count > $max_break_count) { seperate_page() } } sub get_time { my ($hour,$suffix); $hour= strftime ("%H", localtime ()); if ($hour >= 12) { $suffix="PM"; } else { $suffix = "AM"; } if ($hour > 12) { $hour -= 12; } $time_words= strftime (" at $hour:%M $suffix on %m\/%d\/%Y \n", localtime ()); $time_words; } sub post_new_news { open (FH, "+< $path_to_text") or die "where's the damn file? : $!"; flock (FH,LOCK_EX) or die "Couldn't flock: $!"; my @old_file = ; seek FH, 0, 0; truncate (FH,0) or die "Can't truncate: $!"; print FH qq|\n ::: $topic :::\n \n posted by $name\n $time_words.\n $words \n\n\n|; print FH @old_file; flock(FH,LOCK_UN); #unlock the file close FH or die "close damn you : $!"; print "Location: $newspage_url\n\n"; }
\n $words
\n\n\n|; print FH @old_file; flock(FH,LOCK_UN); #unlock the file close FH or die "close damn you : $!"; print "Location: $newspage_url\n\n"; }