#!/usr/bin/perl -w my $REGEX_CGI = 'http://devel3.ourdomain.org/cgi-bin/regex.pl'; use strict; $|++; use lib "/devel/www/cgi-bin"; use OurModules::CGI; use OurModules::Config; use OurModules::DBIFunctions qw( do_dbi_connect regex_get_data regex_delete regex_update regex_new validate_regex ); use OurModules::UI qw ( ui_template ui_user_error ui_permission_denied pretty_table ); use OurModules::Session qw ( login_session ); use OurModules::Perms qw( allow_s_re_editor ); my $q = OurModules::CGI->new(); print $q->header; my $dbh = do_dbi_connect( $DB_TYPE, $DB_NAME, $FILTER_USERNAME, $FILTER_PASSWORD ); END{ $dbh->disconnect if $dbh }; # session code removed, substitued with null values my $session = ''; my $user_id = 1; if ( $q->param('action') and $q->param('action') eq 'update' ) { my $html = ''; my $need_hup = 0; for my $param ( sort $q->param() ) { if ( $param =~ m/update_(\d+)$/ ) { next if $q->param($param) eq 'OK'; my $regex_id = $1; $need_hup = 1; if ( $q->param($param) eq 'DELETE' ) { $html .= regex_delete( $dbh, $regex_id ); } else { $html .= regex_update( $dbh, $regex_id, $q->param("regex_string_$regex_id"), $q->param("location_$regex_id"), $q->param("comments_$regex_id"), $user_id ); } } elsif ( $param =~ m/new/ ) { next unless $q->param($param) eq 'NEW'; $need_hup = 1; $html .= regex_new( $dbh, $q->param("regex_string_new"), $q->param("location_new"), $q->param("comments_new"), $user_id ); } } #do{ system( 'sudo', $SEND_HUP ) and ui_system_error( "Could not HUP redirector! $SEND_HUP $?" ) } if $need_hup; $html ||= 'No Updates Found'; $html =<
Doing Updates: $html Done!HTML sleep 1; # <--- WORKS! #use Time::HiRes 'usleep'; # <--- DOES NOT!!!!! #usleep( 2000 ); my $html = ui_template( 'Regex Editor', '', $html ); # $html =~ s/\W/_/g; # no effect print $html; # close STDIN; close STDOUT; # no effect exit 0; # no effect } else { show_form( $dbh, $q, $session ); } exit 0; #------------------------------------------------------------------------------- # subroutines #-------------------------------------------------------------------------------