Re: [Perl-unix-users] Stopping pdf from cacheing
>I have a pdf document that I CANNOT let cache on the users machine due to >it's sensitive nature. I have played with different headers to resolve >this >but to no avail. -pragma => 'no-cache' and -expires => '-1d' What is the exact nature of the problem?? isnt the page cached for certain browser types and versions only?? please provide more details. i would suggest you also post your question to the PERL forum at Experts-Exchange. http://www.experts-exchange.com/jsp/qList.jsp?ta=perl >Below is a script that prints the pdf to the browser. >This is extremely important, any help would be GREATLY appreciated. >byron#!/usr/local/bin/perl -w > >use CGI; >use strict; >use Salu; >my $q = new CGI; > >my $BUFFER_SIZE = 4_096; >my $IMAGE_DIRECTORY = $q->param('path'); >my $buffer = ''; >my $flag=0; > >if ( $q->param('info') ) > { > print $q->header( -type => "application/pdf"); > $flag = 1; > } >if ( $ENV{'HTTP_REFERER'} =~ /neuroresults.cgi$/ ) > { > print $q->header( -type => "application/pdf"); > $flag = 1; > } >if ($flag == 0) > { > print "Location: /error.htm\n\n"; > } > >binmode STDOUT; > >$IMAGE_DIRECTORY =~ s/^"//; >$IMAGE_DIRECTORY =~ s/"$//; > >open (IMAGE, $IMAGE_DIRECTORY) or die "Can't open the image \n"; >while (read( IMAGE, $buffer, $BUFFER_SIZE)) > { > print $buffer; > } > >close IMAGE; >exit(1); > > > > > > > > >___ >Send a cool gift with your E-Card >http://www.bluemountain.com/giftcenter/ > > >___ >Perl-Unix-Users mailing list. To unsubscribe go to >http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users _ Get your FREE download of MSN Explorer at http://explorer.msn.com ___ Perl-Unix-Users mailing list. To unsubscribe go to http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users
Re: [Perl-unix-users] String problem from post method
Craig, "..is outputting the string without the carriage returns so all lines run together on the html page..." are you sure that the carriage returns are not being shown?? i would suggest you look a the HTML source of the page and you might see the carriage returns being displayed. its just that the broser would ignore carriage returns while showing the actual content. if you want to confirm that, there are 2 ways. 1) enclose that variable in tags so that the carriage returns are now displayed properly. 2) replace all occurences of the carriage return with the HTML tag, as follows $postInputs{'procedure_field'}=~ s/\r\n//g; ## OR $postInputs{'procedure_field'}=~ s/\n$//g; Hope that helps. Let me know how it goes > >Hello, > >I am using a form on my website for procedure submission. The form has >several input boxes for the user to enter information. The actual >procedure input box may have several lines that contain carriage returns. >As an example, a numbered list of steps to follow. > >I am using the post method to send the data to my perl script. Within the >script, I am decoding the data with the following routine: > >sub readPostInput(){ > my (%searchField, $buffer, $pair, @pairs); > if ($ENV{'REQUEST_METHOD'} eq 'POST'){ > read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); > @pairs = split(/&/, $buffer); > foreach $pair (@pairs){ > ($name, $value) = split(/=/, $pair); > $value =~ tr/+/ /; > $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; > $name =~ tr/+/ /; > $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; > $searchField{$name} = $value; > } >} > return (%searchField); >} > >Following the decoding, I am writing the procedure out to a file as html >for review and placement on the corporate intranet: > >sub fileStorage(){ > > open (OUTFILE, >">apps:/intranet/IRIS/Admin/NetAdmin/Procedures/review_storage/$postInputs{'fn_store'}"); > select (OUTFILE); > >print << "EOF"; > >Procedure: $postInputs{'title_field'} > >$postInputs{'title_field'} >Created by: $postInputs{'select_author'} >Date Created: $postInputs{'date_field'} >Procedure Category: $postInputs{'select_category'} >Procedure Introduction >$postInputs{'intro_field'} >Procedure Description >$postInputs{'procedure_field'} > > > > >EOF > > close (OUTFILE); > select (STDOUT); > >} > >Herein lies the problem, the last line of field output: > >$postInputs{'procedure_field'} > >is outputting the string without the carriage returns so all lines run >together on the html page. > >I need to have the information formatted as the user had intended with the >carriage returns in the correct place. > >I would greatly appreciate any insite into solving this problem. > >Thanks for your time, > >Craig A. Sharp >Unix System Administrator >DNS Administrator >Roush Industries >734-779-7282 > ><< CraigSharp.vcf >> _ Get your FREE download of MSN Explorer at http://explorer.msn.com ___ Perl-Unix-Users mailing list. To unsubscribe go to http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users
Re: [Perl-unix-users] Problems setting up ActiveState Perl...
>I'm having problems setting up ActiveState from the RPMs. Everything seems >to run fine, and I can even run a simple script by typing "$ perl test", >but >I can't get it to execute a script without including "perl" in front of it. >I made it executable with "$ chmod +x test", but when I run it nothing >happens (it just returns to another prompt). Any ideas? John, what operating system have you installed ActiveState PERL on?? i think its meant to run only on Win32 systems. so how can you use the chmod UNIX command?? what is the full path to your perl executable?? can you post the exact code that you are trying to execute (test) here?? pl. provide as much info as you can. this will help you get a working solution, faster. Manesh _ Get your FREE download of MSN Explorer at http://explorer.msn.com ___ Perl-Unix-Users mailing list. To unsubscribe go to http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users
Re: [Perl-unix-users] Can't delete files from file-upload-> www user
>I have a perl script that accepts file uploads. When the file uploads are >recieved, the user is wwwrite. I am unable to go back in and delete files >because of this(Permission is denied ). I'd like to change the user on the >upload but I'm not sure how to do this. Have you instead considered changing the permission of the files after they have been uploaded?? in the same script where you are doing the upload, after all processing has been done and the file handle to the uploaded file has been closed, you can use the chmod function of PERL to give the uploaded file proper permissions. Eg. let say the file you have uploaded is /tmp/001254_1.pdf close(UP_FILE_HANDLE); $cnt = chmod (0775, '/tmp/001254_1.pdf') if ($cnt){ ## chmod worked!! ## Do soemthing here } Another alternative would be to write a admin script, that would delete these files for you. Since this script would also run under user wwwrite, you will not have any permissions issues to delete the file. Hope that helps >-rwxrwx--- 1 www wwwrite71310 Jan 4 14:04 0012547_4.pdf* >-rw--- 1 www wwwrite56694 Dec 21 13:01 001254_1.pdf >-rwxr-x--- 1 www wwwrite 4040938 Dec 26 11:49 001254_2.pdf* > > >Perhaps part of this problems lies with the fact I create direcories on the >fly and put these files into them. > >any help would be appreciated, > >byron > > > > > > >"When you sell a man a book, you don't sell him 12 ounces of paper and ink >and glue - you sell him a whole new life." - Christopher Morley > >"Thanks O'REILLY." - Me > > > > > >___ >Send a cool gift with your E-Card >http://www.bluemountain.com/giftcenter/ > > >___ >Perl-Unix-Users mailing list. To unsubscribe go to >http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users _ Get your FREE download of MSN Explorer at http://explorer.msn.com ___ Perl-Unix-Users mailing list. To unsubscribe go to http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users
Re: [Perl-unix-users] Using split
>Hi Every one, > > >I have a single cuestion how i do using the funtion split to separate a >date, example: > >$date = 2001/01/16; > >I whant do this give to $year = 2001; > $month = 01; > $day = 16; > >I do somthing like this > >($year, $month, $day) = split (/ /, $date); > >And in doesnt work. try this instead. #!/usr/local/bin/perl $date = '2001/01/16'; ($year,$month,$day)=split(/\//,$date); print "Year = $year Month = $month Day = $day\n"; Hope that helps. > Note: sorry for my bad english > > Thanks a lot for the help > > Ricardo Cumberbatch L. > > > > > >___ >Perl-Unix-Users mailing list. To unsubscribe go to >http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users _ Get your FREE download of MSN Explorer at http://explorer.msn.com ___ Perl-Unix-Users mailing list. To unsubscribe go to http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users