Cut an paste your entire script here... without inline comments... That global message you got sounds more like a typo to me since you init the var with my directly above the open call...
I have an app here that uses LWP to fetch images and it works in win200/activeperl 5.6 and linux 2.4.20/perl5.8 and there is no problem.. so show us the relevant code. in one block. I'd also suggest you checkout the general perl/cgi mailing lists at http://groups.yahoo.com regards Frank -----Original Message----- From: eric lin [mailto:[EMAIL PROTECTED]] Sent: Sunday, 22 December 2002 8:11 PM To: Clint Cc: [EMAIL PROTECTED] Subject: Re: [cgiapp] broken link from other site, please help Clint wrote: > On Saturday, December 21, 2002, at 09:24 PM, eric lin wrote: > >> I tried , it show some compile error in my perl >> >> /usr/bin/perl /usr/lib/cgi-bin/showphoto.pl >> Global symbol "$file" requires explicit package name at >> /usr/lib/cgi-bin/showpho >> to.pl line 8. >> Execution of /usr/lib/cgi-bin/showphoto.pl aborted due to compilation >> errors. >> > > The following works on Mac OS X and Linux > > ------- > #!/usr/bin/perl -w > use strict; > > # Eric, you must first define $filename before you can use it. > #Well, at least when you use strict and that should be always. > my $filename = "/tmp/image.jpg"; > > print( "Content-type: image/jpg\n\n" ); > > do { > # warn puts an error into the logs so that you can read it. > # I dont think printing the error to stdout will show up under a > mime type > # of image/jpg. > warn( "Cannot open $filename because $!" ); > die( 1 ); > } unless open( IN, "<$filename" ); > > print <IN>; > close( IN ); > ------- > > You should not have much trouble making it work on windows as simple as > it is. You should only have to change the #! line and the 'my $filename > =' line as far as I know unless the windows port is really wonky. > > While I don't mind answering questions no matter what the list, I feel > compelled to point out that this list is for CGI::App discussion and > that there are many other lists for general Perl CGI programming that > are better suited to the task of answering questions like this. > > I also respectfully recommend that you pick up a copy of Learning Perl > if you are going to do much Perl programming. > > > PS > I just tested the above code again to make sure before I sent it and > I messed up and out of habit (i guess, though nowadays I use CGI) > changed the header to 'Content-type: text/html\n\n' and it still > worked. It makes sense but was still unexpected. > > -cm > > > --------------------------------------------------------------------- > Web Archive: http://www.mail-archive.com/[email protected]/ > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > I already copy that piece of code fully,(include cpoy my file.jpg to /tmp/phot.jpg) It is not work in 2.4.20, perl 5.8 if you do not believe you can try http://www.linuxspice.com/cgi-bin/showphoto.pl on any browser regard eric /* hope to hear from you again */ -- Sincere Eric www.linuxspice.com linux pc for sale --------------------------------------------------------------------- Web Archive: http://www.mail-archive.com/[email protected]/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- Web Archive: http://www.mail-archive.com/[email protected]/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
