From karic at lclark.edu Tue Aug 14 19:21:39 2001 From: karic at lclark.edu (Kari Chisholm) Date: Wed Aug 4 00:05:22 2004 Subject: require Message-ID: <3B79C093.BA00E992@lclark.edu> Howdy all-- This may be a moron question, but I can't seem to get it to work. I've got two CGI's http://www.clientone.com/coolapp.cgi http://www.clienttwo.com/coolapp.cgi that really live on my server here /www/karic/clientone/coolapp.cgi /www/karic/clienttwo/coolapp.cgi I want each of them to read in subroutines and settings from a single place /www/karic/mystuff/global.cgi So, in each of those two cgi's I've got this line require ("/www/karic/mystuff/global.cgi"); I can't find any documentation that says I can crawl around my file server like this using require, but nothing that says I can't either. Nonetheless, I'm getting a server error. Is this a problem with my perl, or with my server? Any thoughts? -kari. p.s. I couldn't get it to work with DO or USE either, though I know much less about those. TIMTOWTDI From Ian_Shaughnessy at NAI.com Wed Aug 15 05:36:19 2001 From: Ian_Shaughnessy at NAI.com (Shaughnessy, Ian) Date: Wed Aug 4 00:05:22 2004 Subject: require Message-ID: <75256BFE0332D4118969009027E77E7C798BC2@SNC-5-14.nai.com> What webserver are you running? And generally crawling around doesnt make a webserver too happy.. it runs as the user nobody (I'm assuming), so if it tries to enter a directory that does not have rwxr-xr-x permissions, it cant. Try this: su nobody cd /www/karic/clientone ./coolapp.cgi Check the output. I'm pretty sure youre going to see perl spit back a permissions problem. This is just a handy way of debugging a cgi script too, heh, you dont know how many times I've had a script not work because of a permissions problem that I didnt realize until I executed it as manually as user nobody (or whatever user the webserver runs as). Also, in case you havent used require much... make sure the require'd file ends with a '1;'. Otherwise require dumps to an error (has to do with return values). I think its silly, but I guess I'm not Alan Cox. ;) -Ian -----Original Message----- From: Kari Chisholm To: Portland Perl Mongers Sent: 8/14/01 5:21 PM Subject: require Howdy all-- This may be a moron question, but I can't seem to get it to work. I've got two CGI's http://www.clientone.com/coolapp.cgi http://www.clienttwo.com/coolapp.cgi that really live on my server here /www/karic/clientone/coolapp.cgi /www/karic/clienttwo/coolapp.cgi I want each of them to read in subroutines and settings from a single place /www/karic/mystuff/global.cgi So, in each of those two cgi's I've got this line require ("/www/karic/mystuff/global.cgi"); I can't find any documentation that says I can crawl around my file server like this using require, but nothing that says I can't either. Nonetheless, I'm getting a server error. Is this a problem with my perl, or with my server? Any thoughts? -kari. p.s. I couldn't get it to work with DO or USE either, though I know much less about those. TIMTOWTDI TIMTOWTDI From Ian_Shaughnessy at NAI.com Wed Aug 15 05:38:03 2001 From: Ian_Shaughnessy at NAI.com (Shaughnessy, Ian) Date: Wed Aug 4 00:05:22 2004 Subject: require Message-ID: <75256BFE0332D4118969009027E77E7C798BC3@SNC-5-14.nai.com> What webserver are you running? And generally crawling around doesnt make a webserver too happy.. it runs as the user nobody (I'm assuming), so if it tries to enter a directory that does not have rwxr-xr-x permissions, it cant. Try this: su nobody cd /www/karic/clientone ./coolapp.cgi Check the output. I'm pretty sure youre going to see perl spit back a permissions problem. This is just a handy way of debugging a cgi script too, heh, you dont know how many times I've had a script not work because of a permissions problem that I didnt realize until I executed it as manually as user nobody (or whatever user the webserver runs as). Also, in case you havent used require much... make sure the require'd file ends with a '1;'. Otherwise require dumps to an error (has to do with return values). I think its silly, but I guess I'm not Alan Cox. ;) -Ian TIMTOWTDI From Ian_Shaughnessy at NAI.com Wed Aug 15 06:02:59 2001 From: Ian_Shaughnessy at NAI.com (Shaughnessy, Ian) Date: Wed Aug 4 00:05:22 2004 Subject: require Message-ID: <75256BFE0332D4118969009027E77E7C798BC4@SNC-5-14.nai.com> Heh, oops, sorry about the double response. The web based front end to outlook is, like all other microsoft products, buggy. ;P TIMTOWTDI From gminter at hevanet.com Wed Aug 15 16:28:25 2001 From: gminter at hevanet.com (Greg Minter) Date: Wed Aug 4 00:05:22 2004 Subject: require References: <3B79C093.BA00E992@lclark.edu> Message-ID: <3B7AE979.A626B126@hevanet.com> Kari Chisholm wrote: > > Howdy all-- > > This may be a moron question, but I can't seem to get it to work. > > I've got two CGI's > > http://www.clientone.com/coolapp.cgi > http://www.clienttwo.com/coolapp.cgi > > that really live on my server here > > /www/karic/clientone/coolapp.cgi > /www/karic/clienttwo/coolapp.cgi > > I want each of them to read in subroutines and settings from a single place > > /www/karic/mystuff/global.cgi The approach I use is to place everything in subroutines in a perl module file. This is like a ".cgi" or ".pl" file, but has a ".pm" extension and ends with a "1;" on the last line. /www/karic/mystuff/global.pm Then use the "use lib" directive to identify the directory. use lib '/www/karic/mystuff'; use global; I don't think that variable settings can be seen across files. They must be read from subroutines. I hope this helps. -Greg TIMTOWTDI From rb-pdx-pm at redcat.com Wed Aug 15 17:18:51 2001 From: rb-pdx-pm at redcat.com (Tom Phoenix) Date: Wed Aug 4 00:05:22 2004 Subject: require In-Reply-To: <3B7AE979.A626B126@hevanet.com> Message-ID: On Wed, 15 Aug 2001, Greg Minter wrote: > I don't think that variable settings can be seen across files. They > must be read from subroutines. Well, yes and no. If an external file (like a module or library file) has any lexical variables (also called "my" variables), those can't be used from outside the file. But it may use global variables (sometimes called "package" variables) that are usable from every line of the program, even in other files. >From the other side of the mirror, if your main program uses "my" variables, those can't be used from the external file. If you want them to be initialized directly by the external file (and still be "my" variables), you would have to pass them to a subroutine as parameters to be modified. This isn't frequently done, though. It's more common to set them in the main program, something like this: my($name, $addr, @favorite_books) = &external_initialization(); ...which is what I think you were saying, when you said they "must be read from subroutines". Cheers! -- Tom Phoenix Perl Training and Hacking Esperanto Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/ TIMTOWTDI From rb-pdx-pm at redcat.com Wed Aug 15 17:20:23 2001 From: rb-pdx-pm at redcat.com (Tom Phoenix) Date: Wed Aug 4 00:05:22 2004 Subject: require Message-ID: On Tue, 14 Aug 2001, Kari Chisholm wrote: > So, in each of those two cgi's I've got this line > > require ("/www/karic/mystuff/global.cgi"); > > I can't find any documentation that says I can crawl around my file server like > this using require, but nothing that says I can't either. You should be able to do this, since you're using an absolute path. Of course, as someone else pointed out, your global.cgi file has to be readable by the webserver, and it has to return a true value (traditionally, by using "1" as its last line). > Nonetheless, I'm getting a server error. There are other ways to do this, but for debugging, I sometimes put something like this near the top of a script. # Remove this block when done debugging! BEGIN { local($|) = 1; # Temporarily turn off buffering print "Content-type: text/plain\n\n"; my $date = localtime; print "Script $0\nrunning on $date (Perl version $])\n\n"; unless (open STDERR, ">&STDOUT") { print "Can't redirect STDERR: $!"; exit; } print "\n"; } Now you should be able to see any error messages (and everything else) produced by your script, right on your browser. Hope this helps! -- Tom Phoenix Perl Training and Hacking Esperanto Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/ TIMTOWTDI From rb-pdx-pm at redcat.com Fri Aug 31 10:08:09 2001 From: rb-pdx-pm at redcat.com (Tom Phoenix) Date: Wed Aug 4 00:05:22 2004 Subject: PDX Perl Mongers September meeting Message-ID: It's happening! The PDX (Portland) Perl Mongers are getting together for a meeting! Wow! Amazing! In my experience, there are three kinds of meetings among Perl Mongers' groups. There are the technical meetings, where people talk about the workings of Perl. There are the social meetings, where people drink lots of beer. And finally, some meetings start out technical, but end up social. This one is happening in a pub, so draw your own conclusions. When: Tuesday the 11th of September Start: 6:00 PM, or whenever you can get there Stop: 8:30 PM, or whenever they kick us out Who: We don't know. But see below. Where: Bridgeport Brew Pub 1313 NW Marshall Street Portland, Oregon 97209 This is located in Portland's historic "Pe(a)rl" district. (The website below actually spells it "Perl". Those silly web admins.) You can get there very conveniently by using the new Portland Streetcar, but it's also accessible via hovercraft, pogo stick, or transporter. It's 7.8 minutes away from Powell's Technical Books, if you travel on a bicycle built for two. Let me know if you need ICBM coordinates. http://www.rdrop.com/users/pbrooks/bridgeport.html It's a no-smoking pub; with apologies to you fans of that other Camel. Here's more info, which uses a different spelling of "Perl District": http://www.bridgeportbrew.com/pubs/brewpub.html I'll be there, of course, and Randal Schwartz is going to try to make it. He and I are the authors of the new third edition of the Llama book (Learning Perl) which we released at the Perl conference last month, so it's a very new book. We love it, and we'd love to hear from you folks about it. But we're not meeting to sell books, we're meeting to chat with Perl folks. So bring your Perl questions, your Perl stories, your Perl code, your Perl divers, your Perl friends, your Perl humor, and of course your Perl money, because you get to buy your own Perl drinks and your own Perl snacks. (They've got pretty good stuff at Bridgeport. But if a couple of you want to sit around and not eat or drink anything all evening, they'll probably let you stay with the rest of us for free.) When you get to the Bridgeport, you can find the other Perl Mongers by walking up to random people in the pub and asking "Dollar underscore? Dollar underscore?" If they say, "Hey, another Perl person!", then you've found us. If they have you arrested for making lewd suggestions (at cut-rate prices) they probably don't do Perl. Alternatively, you could hunt for me (and probably Randal). We're conspicuous. Here's our picture. http://www.redcat.com/randal_and_tom.html RSVP? No, don't bother; just show up. Hope to see you there! -- Tom Phoenix Perl Training and Hacking Esperanto Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/ TIMTOWTDI From gordon at rescuebreather.com Fri Aug 31 11:25:19 2001 From: gordon at rescuebreather.com (Gordon Jackson) Date: Wed Aug 4 00:05:22 2004 Subject: LWP Modules Message-ID: <3.0.3.32.20010831092519.03765e14@4yoursafety.com> Hi all I am trying to use a program that utilizes the LWP Perl Modules on my server and they are not working. I am using a virtual server with AIT. I have located the modules on my server at: /usr/lib/perl5/site_perl/5.005/LWP but AIT says they are not there. They tell me for 20.00 they will load them, so to end all this I am going to pay the 20 so that I can force them to fix the problem. My problem is for them to install the module for me they need me to provide the following 2 pieces of the puzzle: 1) They want a copy of the module. I have been to CPAN but have no idea exactly what part is the full LWP module or to be quit honest what to send them. 2) They want me to tell them where to install them. And to be honest again I have not got a clue. Can anyone help me? THX Any questions or problems please feel free to email or call me. THX -------------------------------------------------------------------- Gordon Jackson Webmaster Rescuebreather.com http://www.rescuebreather.com mailto:gordon@rescuebreather.com OR CALL TOLL FREE 1-800-733-9007 for more information HAVE A GREAT GREAT DAY! --------------------------------------------------------------------- TIMTOWTDI From robb at empire2.com Fri Aug 31 13:43:54 2001 From: robb at empire2.com (Rob Bloodgood) Date: Wed Aug 4 00:05:22 2004 Subject: LWP Modules In-Reply-To: <3.0.3.32.20010831092519.03765e14@4yoursafety.com> Message-ID: > I am trying to use a program that utilizes the LWP Perl Modules on my > server and they are not working. I am using a virtual server with AIT. I > have located the modules on my server at: > /usr/lib/perl5/site_perl/5.005/LWP but AIT says they are not there. They > tell me for 20.00 they will load them, so to end all this I am > going to pay the 20 so that I can force them to fix the problem. > > My problem is for them to install the module for me they need me > to provide > the following 2 pieces of the puzzle: > > 1) They want a copy of the module. I have been to CPAN but have no idea > exactly what part is the full LWP module or to be quit honest what to send > them. > > 2) They want me to tell them where to install them. And to be honest again > I have not got a clue. using CPAN, I pulled down Bundle::LWP and it lists: URI is up to date. Net::FTP is up to date. (this one is libnet-*.tar.gz) MIME::Base64 is up to date. Digest::MD5 is up to date. HTML::Tagset is up to date. HTML::Parser is up to date. HTML::HeadParser is up to date. LWP is up to date. (libwww-*.tar.gz) A good way to find them is to look at: http://www.perl.com/CPAN-local/modules/by-module (alternatively, s/-local// and be redirected to a "local" mirror). If it was me, I would pull down the .tgz files from CPAN, and write a install.sh script like: for a in source/*; do tar xvfz `basename $a`; cd `basename $a`; perl Makefile.PL; make && make test && make install; cd ..; rm -rf `basename $a`; done and put them in a tarfile of install.sh source/(modules here) Alternatively, you could put the modules in your own userspace and twiddle with @INC. But what you should REALLY do is explain to the person that the pissy little tech works for that they are stealing $20 from you, that these things are an integral part of what perl is, that the installation process is automatically handled by perl, and it's obvious that they are completely ignorant of how the Web REALLY works if they are afraid to install a couple of Perl modules. But of course, that's just me... :-) Have a nice day! L8r, Rob #!/usr/bin/perl -w use Disclaimer qw/:standard/; TIMTOWTDI From rb-pdx-pm at redcat.com Fri Aug 31 16:00:12 2001 From: rb-pdx-pm at redcat.com (Tom Phoenix) Date: Wed Aug 4 00:05:22 2004 Subject: LWP Modules In-Reply-To: <3.0.3.32.20010831092519.03765e14@4yoursafety.com> Message-ID: On Fri, 31 Aug 2001, Gordon Jackson wrote: > I am trying to use a program that utilizes the LWP Perl Modules on my > server and they are not working. I am using a virtual server with AIT. > I have located the modules on my server at: > /usr/lib/perl5/site_perl/5.005/LWP but AIT says they are not there. Have you seen the perlmodinstall manpage? Don't forget to use lib in your program, if you're installing the modules yourself (not as root). Maybe you already have LWP installed. You can find out which modules are available on your system by using the program "inside", available via the URL below. http://www.cpan.org/authors/id/P/PH/PHOENIX/ > They tell me for 20.00 they will load them, so to end all this I am > going to pay the 20 so that I can force them to fix the problem. This may be better than it sounds. I recommend that you offer to buy the admins some pizza and beer in exchange for their help. It never hurts to be on good terms with your admins. (Of course, I'm assuming that you're geographically close enough that this is practical. But even if they're in another city, you could arrange for a delivery from their local pizza shoppe.) You can say something like, "My boss doesn't have any budget for the twenty dollars, but I'll be glad to buy you a pizza with my own cash if you can help me." Even if it costs you more than twenty, it can be a good deal; these admins will be more likely to help you with your next problem if you're their pizza buddy. On the other hand, you should also consider installing a clueful admin. If you upgrade to an ISP with better admins, you may have to pay a higher monthly fee, but you'll know that you're getting better value for your money. (But, in my experience, there's little correlation between the ISP's fees and the quality of their service - except that "free" services are typically more expensive than they look.) > 1) They want a copy of the module. LWP is really a bundle of related modules, with prerequisites which also need installing in some cases. But they should use the CPAN module to do the work. The CPAN command 'install Bundle::LWP' will do the job, if they've set everything up correctly. (But it may be a bumpy ride if they haven't.) See perlmodinstall. > 2) They want me to tell them where to install them. Probably the CPAN module will install in the right place automatically. But if you use 'perl -V', it will tell you what the @INC paths are; these are the directories where your perl looks for modules. Good luck with it! -- Tom Phoenix Perl Training and Hacking Esperanto Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/ TIMTOWTDI