Hi,

Thanks for the help. I've made the necessary changes. One error came up at runtime on the "use warnings;". I gather the module is not installed on the server I'm using. I've gone through and made changes to the script calling the package. I understand the syntax however the nothing is printed to the file. Also I added use strict in the script which requires %form_data hash to be declared. If I comment out use strict still nothing prints to the file.

libcgi3.pm

package libcgi3;

use strict;
#use warnings; THE MODULE warnings.pm COULD NOT BE FOUND ON THE SERVER.

sub parse_input {
        my $forminfo;
        my %form_data;
        my $whichmethod = $ENV{"REQUEST_METHOD"};
        if ($whichmethod eq "GET") {
                $forminfo = $ENV{"QUERY_STRING"};
        } else {
                $forminfo = <STDIN>;
        }
        my @key_value = split(/&/,$forminfo);
        foreach my $pair (@key_value) {
                my ($key, $value) = split(/=/,$pair);
                $value =~ s/\+/ /g;
                $value =~ s/%([0-9a-fA-F][0-9a-fA-F])/pack("C", hex($1))/eg;
                $form_data{$key} = $value;
        }
}

sub print_header {
        print "Content-type: text/html\n\n";
}

return 1;
------------------------------------------------------------------------ -----------------

writesurvey3.pl

#!/usr/bin/perl -w

#use strict;

use libcgi3;

libcgi3::parse_input();
libcgi3::print_header();

#my %form_data;

open (TOFILE,">infofile.txt") or die "Couldn't open file: $!";

print TOFILE "$form_data{'favoriteurl'} \n";

print TOFILE "\n\n\n";

print TOFILE "$form_data{'reason'} \n";

close(TOFILE) or die "Couldn't close file: $!";

print "File infofile.txt successfully saved";

------------------------------------------------------------------------ --------------------------

Thanks,

Todd


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to