Re: Executing pdflatex via CGI script
Hi Gunnar, Gunnar Hjalmarsson wrote on 17.10.2004: Jan Eden wrote: The script manages to write data to my output file if I created it first and chmodded it to 666, but fails otherwise. This is because the script is run by the web user, of course. Is there a more or less secure way to allow the script to a) create / write to a file b) apply pdflatex to that file (i.e. create a pdf file from the .tex source) You can give the directory in which the file will be located 0777 permissions. Once the file has been created by the script, you can change the directory permissions to e.g. 0755. c) open the resulting pdf file (using the open function in OS X) To allow somebody but the web server to open a script created file for reading, have the script give it 0644 permissions. It sounds as if you need to read up on the Unix/Linux permissions system. Hrm. I do know about the permissions system. But I made a stupid mistake anyway. pdflatex is not in the web server user's path, so the script did not find it. I used the absolute path to pdflatex now, and got a result. Thanks, Jan -- There are two major products that come out of Berkeley: LSD and UNIX. We don't believe this to be a coincidence. - Jeremy S. Anderson -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Files -read write - an epiphany and question
I have been studying W/R to files... W/R to a string and to an array. and I must say I think I have it. I can read a file into an array IF i wrote the file using \n between vars, yes and I can read the entire file into a string (to later be split) by using delimiters like ,yes??? I have some data files that hold lists (like cities) that I want in an array. and some files that hold a collection of vars (name, city, color, cartype, etc) that I want to delimit and later read as a string ($Slurp) and then ($name, $city, $color, $cartype, $etc)=split (,,$Slurp) my question is if I write a file using delimiters like , can I later read the entire file into a string and then @Cities = split (,,$Slurp) ?? but how do I read a file that used the \n and then split it later??? right now i wold have to open file... @Array=read entire file into @Array close file and then... $name=$Array[1]; $city=$Array[2]; $color=$Array[3]; $cartype=$Array[4]; $etc=$Array[5]; there must be a better way like ? $name, $city, $color, $cartype, $etc)[EMAIL PROTECTED]; of can I split using the special var $\ or \n as a delimiter ?? am I making the example clear? or am i trying to do the impossible? Comment WITH example correction welcome.. the above syntax may not be completely correct but it gives you the idea...so please dont crusify me for it... Lou
Re: getting files from the internet
This is the only log file that had been modified after I tried to run the script. It was access_log 192.168.1.200 - - [18/Oct/2004:07:36:06 -0500] GET /cgi-bin/test/test.cgi HTTP/1.1 401 1248 - Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) 127.0.0.1 - - [18/Oct/2004:07:36:11 -0500] GET /arch.doc HTTP/1.1 200 27136 - LWP::Simple/5.800 192.168.1.200 - jeff [18/Oct/2004:07:36:09 -0500] GET /cgi-bin/test/test.cgi HTTP/1.1 200 25 - Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) On Sun, 17 Oct 2004 22:42:07 -0700 (PDT), Bill Jones [EMAIL PROTECTED] wrote: --- Jeff Herbeck [EMAIL PROTECTED] wrote: This code gives me a 500 internal server error. And the WWW Server Logs say - what? -Sx- = -Sx- seeking employment: http://youve-reached-the.endoftheinternet.org/ ___ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Files -read write - an epiphany and question
This doesn't have anything to do with CGI so would be better directed to [EMAIL PROTECTED] instead I have been studying W/R to files... W/R to a string and to an array. and I must say I think I have it. I can read a file into an array IF i wrote the file using \n between vars, yes Yes and know. You don't have to have any newlines in the file to read it into an array, but all of the content will appear in the first element of the array in that case. Reading/writing a file is lower level than that and doesn't specifically care about the contents having said that, if the file is read/write in a manner that will allow buffering you might have to have flushing turned on. and I can read the entire file into a string (to later be split) by using delimiters like ,yes??? Again delimiters don't affect the reading. However by using delimiters you can allow any string to be split. I have some data files that hold lists (like cities) that I want in an array. and some files that hold a collection of vars (name, city, color, cartype, etc) that I want to delimit and later read as a string ($Slurp) and then ($name, $city, $color, $cartype, $etc)=split (,,$Slurp) my question is if I write a file using delimiters like , can I later read the entire file into a string and then @Cities = split (,,$Slurp) ?? Assuming they were all on one line. In this case I would suggest putting each city on its own line and reading the file at once into an array, no split would be needed. but how do I read a file that used the \n and then split it later??? right now i wold have to open file... @Array=read entire file into @Array close file and then... $name=$Array[1]; $city=$Array[2]; $color=$Array[3]; $cartype=$Array[4]; $etc=$Array[5]; there must be a better way like ? $name, $city, $color, $cartype, $etc)[EMAIL PROTECTED]; The above will work, you can also store it directly from the HANDLE since it is list context, but in that case you need to be sure the file has the right number of lines. of can I split using the special var $\ or \n as a delimiter I believe you mean $/ which is the input record separator. For more information on it see the INPUT_RECORD_SEPARATOR section in, perldoc perlvar Essentially it sets the delimiter used when Perl reads the file to automagically delimit it. ?? am I making the example clear? or am i trying to do the impossible? Nothing is impossible ;-). Not sure about the clarity though, some sample code and an example file would be helpful. Comment WITH example correction welcome.. the above syntax may not be completely correct but it gives you the idea...so please dont crusify me for it... Lou I would suggest some further reading on the subject first, perldoc perlopentut perldoc -f open perldoc -f split perldoc -f readline Also check out the I/O Operators section of, perldoc perlop HTH, http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
perl.beginners.cgi Weekly list FAQ posting
NAME beginners-faq - FAQ for the beginners-cgi mailing list 1 - Administriva 1.1 - I'm not subscribed - how do I subscribe? Send mail to [EMAIL PROTECTED] You can also specify your subscription email address by sending email to (assuming [EMAIL PROTECTED] is your email address): [EMAIL PROTECTED]. 1.2 - How do I unsubscribe? Now, why would you want to do that? Send mail to [EMAIL PROTECTED], and wait for a response. Once you reply to the response, you'll be unsubscribed. If that doesn't work, find the email address which you are subscribed from and send an email like the following (let's assume your email is [EMAIL PROTECTED]): [EMAIL PROTECTED] 1.3 - There is too much traffic on this list. Is there a digest? Yes. To subscribe to the digest version of this list send an email to: [EMAIL PROTECTED] To unsubscribe from the digest, send an email to: [EMAIL PROTECTED] 1.4 - Is there an archive on the web? Yes, there is. It is located at: http://archive.develooper.com/beginners-cgi%40perl.org/ 1.5 - How can I get this FAQ? This document will be emailed to the list once a month, and will be available online in the archives, and at http://beginners.perl.org/ 1.6 - I don't see something in the FAQ, how can I make a suggestion? Send an email to [EMAIL PROTECTED] with your suggestion. 1.7 - Is there a supporting website for this list? Yes, there is. It is located at: http://beginners.perl.org/ 1.8 - Who do I complain to? Complaints can be sent to [EMAIL PROTECTED] 1.9 - Who currently maintains the FAQ? Kevin Meltzer, who can be reached at the email address (for FAQ suggestions only) in question 1.6 1.10 - Who will maintain peace and flow on the list? Casey West, Kevin Meltzer and Ask Bjoern Hansen currently carry large, yet padded, clue-sticks to maintain peace and order on the list. If you are privately emailed by one of these folks for flaming, being off-topic, etc... please listen to what they say. If you see a message sent to the list by one of these people saying that a thread is closed, do not continue to post to the list on that thread! If you do, you will not only meet face to face with a XQJ-37 nuclear powered pansexual roto-plooker, but you may also be taken off of the list. These people simply want to make sure the list stays topical, and above-all, useful to Perl/CGI beginners. 1.11 - When was this FAQ last updated? Feb 04, 2004 2 - Questions about the 'beginners-cgi' list. 2.1 - What is the list for? A list for beginning Perl programmers to ask questions in a friendly atmosphere. The topic of the list is, of course, CGI with Perl. 2.2 - What is this list _not_ for? * SPAM * Homework * Solicitation * Things that aren't Perl related * Non Perl/CGI questions or issues * Lemurs 2.3 - Are there any rules? Yes. As with most communities, there are rules. Not many, and ones that shouldn't need to be mentioned, but they are. * Be nice * No flaming * Have fun 2.4 - What topics are allowed on this list? Basically, if it has to do with Perl/CGI , then it is allowed. If your question has nothing at all to do with Perl/CGI, it will likely be ignored. 2.5 - I want to help, what should I do? Subscribe to the list! If you see a question which you can give an idiomatic and Good answer to, answer away! If you do not know the answer, wait for someone to answer, and learn a little. 2.6 - Is there anything I should keep in mind while answering? We don't want to see 'RTFM'. That isn't very helpful. Instead, guide the beginner to the place in the FM they should R :) 2.7 - I don't want to post a question if it is in an FAQ. Where should I look first? Look in the FAQ! Get acquainted with the 'perldoc' utility, and use it. It can save everyone time if you look in the Perl FAQs first, instead of having a list of people refer you to the Perl FAQs :) You can learn about 'perldoc' by typing: perldoc perldoc At your command prompt. You can also view documentation online at: http://www.perldoc.com and http://www.perl.com 3 - Other Resources 3.1 - What other websites may be useful to a beginner ? * Perl.org - http://www.perl.org * Perl Home Page - http://www.perl.com * PerlMonks - http://www.perlmonks.org * Perldoc - http://www.perldoc.com * Perl Archives - http://www.perlarchives.com * NMS Archive - http://nms-cgi.sourceforge.net/ * Unofficial Perl Beginners' Site - http://perl-begin.berlios.de 3.2 - What resources may be harmful to a beginner? Beware of Perl4-like code-- You might find some script archives and unauthorized mirrors with old Perl4 versions of Selena Sol and Matt Wright scripts. Don't use those scripts. They are outdated and may even in some cases
Re: getting files from the internet
--- Jeff Herbeck [EMAIL PROTECTED] wrote: 192.168.1.200 - - [18/Oct/2004:07:36:06 -0500] GET /cgi-bin/test/test.cgi HTTP/1.1 401 1248 - Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) 127.0.0.1 - - [18/Oct/2004:07:36:11 -0500] GET /arch.doc HTTP/1.1 200 27136 - LWP::Simple/5.800 192.168.1.200 - jeff [18/Oct/2004:07:36:09 -0500] GET /cgi-bin/test/test.cgi HTTP/1.1 200 25 - Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) I woud say $remote_user isn't being set then. Is this page authenticated? So the CGI knows who the $remote_user is? -Sx- = -Sx- seeking employment: http://youve-reached-the.endoftheinternet.org/ __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: getting files from the internet
[this is not a question - it is just a small follow-up] This code only gives me 404 File Not found -- which is correct behaviour - #!/usr/bin/perl use strict; use warnings; use HTTP::Response; use LWP::Simple 'getstore'; my $url = 'http://insecurity.org/test.doc'; my $remote_user = $ENV{REMOTE_USER} || 'unknown_user'; my $response= HTTP::Response-new( getstore( $url, /$remote_user/test.doc ) ); print Content-type: text/html\n\n, $response-status_line(); __END__ NOTES -- the /$remote_user/test.doc section collapses into: //test.doc -- because the User is not set -- and the // is evaluated (at least on my server) as $WWW_DOC_ROOT/path/to/file So, AFAIC, it is working. cheers; -Sx- = -Sx- seeking employment: http://youve-reached-the.endoftheinternet.org/ __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: getting files from the internet
I have this working now: #!/usr/bin/perl use strict; use warnings; use HTTP::Response; use LWP::Simple 'getstore'; my $url = 'http://www.jeffherbeck.com/arch.doc'; my $remote_user = $ENV{REMOTE_USER};# || 'unknown_user'; my $file= 'newfile.txt'; my $response= HTTP::Response-new( getstore( $url, /var/www/html/$remote_user/$file ) ); print Content-type: text/html\n\n, $response-status_line(); __END__ but the directory it goes to has to be owned by apache. Is there any way it can be made to be owned by the remote user? THanks Jeff On Mon, 18 Oct 2004 10:14:22 -0700 (PDT), Bill Jones [EMAIL PROTECTED] wrote: [this is not a question - it is just a small follow-up] This code only gives me 404 File Not found -- which is correct behaviour - #!/usr/bin/perl use strict; use warnings; use HTTP::Response; use LWP::Simple 'getstore'; my $url = 'http://insecurity.org/test.doc'; my $remote_user = $ENV{REMOTE_USER} || 'unknown_user'; my $response= HTTP::Response-new( getstore( $url, /$remote_user/test.doc ) ); print Content-type: text/html\n\n, $response-status_line(); __END__ NOTES -- the /$remote_user/test.doc section collapses into: //test.doc -- because the User is not set -- and the // is evaluated (at least on my server) as $WWW_DOC_ROOT/path/to/file So, AFAIC, it is working. cheers; -Sx- = -Sx- seeking employment: http://youve-reached-the.endoftheinternet.org/ __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: getting files from the internet
--- Jeff Herbeck [EMAIL PROTECTED] wrote: but the directory it goes to has to be owned by apache. Is there any way it can be made to be owned by the remote user? Dynamically set ownership of an unknown user? Yes - But why would you want to do that? -Sx- = -Sx- seeking employment: http://youve-reached-the.endoftheinternet.org/ ___ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response