Anyway when I use 'use strict' on the CGI below I get errors about the '$IMPUT' variable and that I should declare it. I’ve tried putting my in front of it when I pass the values in into it and even creating a empty version at the start of the script with ‘My $INPUT = “”;’ but I just can’t figure it out. I’m sure it’s real simple but I’ve spent a day looking for the answer with no luck. Thanks in advance guys.
#!c:/Perl/bin/Perl.exe -w use strict; use CGI; print "Content-type: text/html\r\n\r\n"; # PDF 2 JPEG CGI my $INPUT = (); &DecodeInURL(); my $PDF2JPGEXE = 'C:\_TestSite\PDF2JPG\bin\pdf2jpeg.exe'; my $PDFFile = $INPUT{"file"}; print "**$PDFFile<br>"; my $output = 'Out_Temp\TempPDF%3.3d.jpg'; my $PDF2JPG_OutPut = system("$PDF2JPGEXE -w -d 90 -q 80 -s 240 300 -f + $PDFFile $output"); print "<p>Output: $PDF2JPG_OutPut"; sub DecodeInURL { my $Decoded = $ENV{'QUERY_STRING'}; #Get Method $Decoded =~ s/%([\a-fA-F0-9][a-fA-F0-9])/pack('C', hex($1))/eg; print "$Decoded\n"; my @INPUTVars = split /\&/ , $Decoded; foreach my $pair (@INPUTVars) { if ($pair=~m/([^=]+)=(.*)/) { my $field = $1; my $Value = $2; $Value =~ s/\+/ /g; $INPUT{$field}=$Value; return $INPUT; } } }
In reply to Use Strict & subs by Mayhem50
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |