RE: Trying to get File and Directory info off of external server quickly
> From: Philip M. Gollucci [mailto:[EMAIL PROTECTED] > I didn't write this, but ...[it]... makes us millions. I trust "you" are putting thousands into perl, mod_perl and other good things, then ;)
Apache2::Cookie odd return values
(apologies if you get this twice) (mp 2.0.1, libapreq2-2.06-dev, httpd 2.0.51, Fedora Core 2) Hi folks, I've spent 2 days trying simply to read and write cookies! Just before I pack it in and become a paper boy, can anyone help? If you haven't time to read below but have some working cookie read/write freeze/thaw code or URLs I'd be grateful! It seems I can bake cookies no problem, they're appearing in the browser: $c_out_val=Apache2::Cookie->freeze($my_hash_ref); Apache2::Cookie->new( blah blah )->bake(); But I just can't unfreeze them! I've tried the following ways to get my cookies: $jar=Apache2::Cookie::Jar->new($r) $jar=Apache2::Cookie->fetch($r) (I also tried using APR::Request::Cookie but it seems to be for Apache experts only, quite a confusing interface) ...but the cookie value is always "cookie_name=cookie_value", and with some variations I was getting a second cookie, with a blank value and the name was "cookie_name=cookie_value". Anyway, even when I strip the "cookie_name=" off the cookie value, Apache2::Cookie->thaw($value) just returns $value! Any help gratefully accepted, John O'Rourke
Re: Trying to get File and Directory info off of external server quickly
On Monday 01 August 2005 23:12, Boysenberry Payne wrote: > Hello All, > > I've got a two server platform one a static server for files and runs > the mysql server > and the other runs mod_perl. I'm trying to figure out the fastest way > to get info on directories > and files from the static server to the mod_perl server. Right now I'm > using Net::FTP which > is really slow, especially when they're a lot of files. Unfortunately, > I need to check the file info > quite frequently. I was wondering if anyone knew what was the fast way > to get this info, LDAP, > SSH, etc? mod_dav may be an option. Torsten pgpYoNwSGwB4Y.pgp Description: PGP signature
CGI character translation???
OK, not exactly perl, but this was the closest list I could find. I am running a perl CGI script that launches a java program. This java program writes output files that are delimited using what I believe to be a unicode character. On most editors it looks like an upside-down question mark, which I believe is correct. On some editors, it shows as a degree symbol. This character is represented by the hex pair 0xc2a1. Here is the character '¡'. Now here is the problem. When I test my java program everything is great. When I test the perl script to launch the java program, all is still well. When I run my perl script through CGI, though, it replaces each occurrence of the above character with ??. I cannot understand why the CGI is interfering with file output from my program. This is not going through display, but is directly writing this file. Anyone have any ideas? Also, if anyone can suggest a better list, I'd appreciate that too. Thanks.
Re: UDP Protocol Handler?
On 20 Jul 2005, at 10:40, Dan Sully wrote: Has anyone written a protocol handler for UDP? If so - could you share any examples? I haven't, but IIRC there is/was a talk at YAPC::EU about using mod_perl as a DNS server... I think it is by mock, who did the mod_perl as a mail server in Belfast last year. I guess that's not much help, except to know it's possible. Matt.
Apache2::Cookie odd return values
(mp 2.0.1, libapreq2-2.06-dev, httpd 2.0.51, Fedora Core 2) Hi folks, I've spent 2 days trying simply to read and write cookies! Just before I pack it in and become a paper boy, can anyone help? If you haven't time to read below but have some working cookie read/write freeze/thaw code or URLs I'd be grateful! It seems I can bake cookies no problem, they're appearing in the browser: $c_out_val=Apache2::Cookie->freeze($my_hash_ref); Apache2::Cookie->new( blah blah )->bake(); But I just can't unfreeze them! I've tried the following ways to get my cookies: $jar=Apache2::Cookie::Jar->new($r) $jar=Apache2::Cookie->fetch($r) (I also tried using APR::Request::Cookie but it seems to be for Apache experts only, quite a confusing interface) ...but the cookie value is always "cookie_name=cookie_value", and with some variations I was getting a second cookie, with a blank value and the name was "cookie_name=cookie_value". Anyway, even when I strip the "cookie_name=" off the cookie value, Apache2::Cookie->thaw($value) just returns $value! Any help gratefully accepted, John O'Rourke
Re: CGI character translation???
Thom Hehl wrote: OK, not exactly perl, but this was the closest list I could find. I am running a perl CGI script that launches a java program. This java program writes output files that are delimited using what I believe to be a unicode character. On most editors it looks like an upside-down question mark, which I believe is correct. On some editors, it shows as a degree symbol. This character is represented by the hex pair 0xc2a1. Here is the character '¡'. Now here is the problem. When I test my java program everything is great. When I test the perl script to launch the java program, all is still well. When I run my perl script through CGI, though, it replaces each occurrence of the above character with ??. I cannot understand why the CGI is interfering with file output from my program. This is not going through display, but is directly writing this file. Anyone have any ideas? Also, if anyone can suggest a better list, I'd appreciate that too. Are you using CGI.pm(what version if so) and are you passing this though the $ENV{QUERY_STRING} ? You might try a utf-8 perl list: from http://lists.cpan.org/ this is the only one with utf-8 in the desc. http://lists.cpan.org/showlist.cgi?name=perl-i18n UTF-8 continually has bugs fixed and enhanced in the perl core. What version of perl are you using ? Sorry I only asked questions, maybe they will point you somewhere useful.
Re: CGI character translation???
On Tue, 2 Aug 2005, Thom Hehl wrote: Possibly the LANG environment variable for the user you test with is not the same as the LANG var for the user the webserver runs as? I had a similar thing i tried to debug a few weeks ago. I couldnt 'su' to the user 'nobody' which was annoying so it took some time to figure out it was an environ problem. ged OK, not exactly perl, but this was the closest list I could find. I am running a perl CGI script that launches a java program. This java program writes output files that are delimited using what I believe to be a unicode character. On most editors it looks like an upside-down question mark, which I believe is correct. On some editors, it shows as a degree symbol. This character is represented by the hex pair 0xc2a1. Here is the character '¡'. Now here is the problem. When I test my java program everything is great. When I test the perl script to launch the java program, all is still well. When I run my perl script through CGI, though, it replaces each occurrence of the above character with ??. I cannot understand why the CGI is interfering with file output from my program. This is not going through display, but is directly writing this file. Anyone have any ideas? Also, if anyone can suggest a better list, I'd appreciate that too. Thanks. -- gedanken
Re: Apache2::Cookie odd return values
Lets move this to apreq-dev (at) httpd.apache.org ** Remember to remove modperl@ from the reply list. (mp 2.0.1, libapreq2-2.06-dev, httpd 2.0.51, Fedora Core 2) Not an issue, but httpd 2.0.54 is out since you're using the rest current :) If you haven't time to read below but have some working cookie read/write freeze/thaw code or URLs I'd be grateful! I don't know about freeze/thaw, but I wrote this FAQ :) http://perl.apache.org/docs/2.0/user/coding/cooking.html#Sending_Cookies_Using_libapreq2 (I also tried using APR::Request::Cookie but it seems to be for Apache experts only, quite a confusing interface) HA, I know you're not calling me an apache expert :) Any help gratefully accepted, HTH
Re: UDP Protocol Handler?
Matt Sergeant [02/08/05 10:42 -0400]: > > On 20 Jul 2005, at 10:40, Dan Sully wrote: > > >Has anyone written a protocol handler for UDP? > > > >If so - could you share any examples? > > I haven't, but IIRC there is/was a talk at YAPC::EU about using > mod_perl as a DNS server... I think it is by mock, who did the mod_perl > as a mail server in Belfast last year. > > I guess that's not much help, except to know it's possible. Not to take too much of Will's glory, but yes, serving UDP in mod_perl is something that we are working on. BTW Matt: Have you released the super-caching DNS query system that you were discussing a few months back? The one that works way better than Net::DNS for doing nasty things like lots of SPF checks? Regards, Ken -- MailChannels: Assured Messaging -- Curious about my strange email address? Read more at http://www.mailchannels.com/domainaliasing.html Keep up with the latest insights in email security, phishing, and spam by reading the MailChannels blog at http://mailchannels.blogspot.com -- http://www.mailchannels.com MailChannels Corporation Suite 312, 1008 Homer St. Vancouver, BC, V6B 2X1, Canada 1-888-314-8904 x701
Re: Trying to get File and Directory info off of external server quickly
Thank You Everyone, I think now that I know I can use $ftp->ls( "-lR" ), which I couldn't find anywhere in the Net::FTP docs or other O'Reilly books I have, I can stick to Net::FTP without is being slow. What was causing my script to take so long was the multiple $ftp->cwd( $directory ), $ftp->ls() and $ftp->dir( $directory . $file ) calls for each directory in my directory loop. Now I use one cwd and ls("-lR") from my public html area then process the return array, which is a lot faster. It would be nice to be able to specify the directory as well as the "-lR" without using cwd( $directory ); does anyone know how to do it? Thanks for the tips on making my code more efficient too. Boysenberry This message contains information that is confidential and proprietary to Humaniteque and / or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited. http://www.habitatlife.com The World's Best Site Builder On Aug 1, 2005, at 6:28 PM, Randy Kobes wrote: On Mon, 1 Aug 2005, Boysenberry Payne wrote: I'm not sure if HEAD would work. Basically, I'm trying to read a directory's files. After I confirm a file exists and doesn't have zero size I check that it has the appropriate extension for the directory then I add the directory address, file name and extension to a table in our database. Can you get someone on the remote server to do a cd top_level_directory ls -lR > ls-lR # or find -fls find-ls gzip ls-lR # or gzip find-ls periodically, and then you can grab and parse ls-lR.gz or find-ls.gz? -- best regards, randy kobes
Apache/mod_perl based file management
I've been doing some searching through apache.org and sourceforge to see if I could locate a web based file management app (similar to Xythos WFS) that runs on Apache, Linux and mod_perl. If anyone knows of such a product I'd greatly appreciate if you could pass me an email with the info. Thanks Erich __ Switch to Netscape Internet Service. As low as $9.95 a month -- Sign up today at http://isp.netscape.com/register Netscape. Just the Net You Need. New! Netscape Toolbar for Internet Explorer Search from anywhere on the Web and block those annoying pop-ups. Download now at http://channels.netscape.com/ns/search/install.jsp
Re: Apache/mod_perl based file management
[EMAIL PROTECTED] wrote: I've been doing some searching through apache.org and sourceforge to see if I could locate a web based file management app (similar to Xythos WFS) that runs on Apache, Linux and mod_perl. If anyone knows of such a product I'd greatly appreciate if you could pass me an email with the info. Thanks Erich Possibly, http://httpd.apache.org/docs/2.0/mod/mod_dav.html AND http://httpd.apache.org/docs/2.0/mod/mod_dav_fs.html
debugging 'server closed the connection unexpectedly' from PostgreSQL 8.0
Hello, I'm debugging why I'm getting 'server closed the connection unexpectedly' intermittently in a modperl application. Unfortunately it has only been seen on the production server and not on our development server making it harder to debug. On the database side, nothing looks unusual in the load or the logs, so I'm suspecting there is a fix on the modperl side. I am using Apache::DBI, and have identified a couple of aspects which might be "special" in this part of the application: 1. The db handle is being used inside of a Data::FormValidator constraint. From what I've read, it seems possible that the handle is suffering some "trapped in a closure" effect. However, we use constructs like this throughout the site without a problem, so I doubt this is where the issue is. 2. In a couple related modules we a construct like: "our $DBH = DBI->connect()". We don't do that elsewhere in the application. With some effort we could refactor the code to get rid of this. I tried switching to "local our", but I got a test failure. (Although I didn't get to the bottom of why that test failed before reverting). Usually we pass the handle around through the CGI::Application object, and that works fine. I'm interested to know: Does it seem like I am even looking in the right place to troubleshoot this? General suggestions? Mark
Re: debugging 'server closed the connection unexpectedly' from PostgreSQL 8.0
Mark Stosberg wrote: > 2. In a couple related modules we a construct like: "our $DBH = > DBI->connect()". > We don't do that elsewhere in the application. With some effort we could > refactor the code to get rid of this. I tried switching to "local our", > but I got a test failure. (Although I didn't get to the bottom of why > that test failed before reverting). I don't know if this is the root of you problems, but this seems like a bad idea anyway. Depending on how you do this and where, ff you preload this module it will open the db connection at server startup (which isn't bad in and of itself). That handle will have to be closed after startup is done. DB handles opened before the children are forked cannot be used after the fork. > Usually we pass the handle around through the CGI::Application object, > and that works fine. This seems like the better approach. > I'm interested to know: Does it seem like I am even looking in the right > place to troubleshoot this? General suggestions? Is this a Pg or Apacahe error? Are you using Apache::DBI? You might be ablet to reproduce the problem in your QA env if you run the server in single process mode. This will make it easier to simulate all of the children getting hit and serving requests. -- Michael Peters Developer Plus Three, LP
debian testing vs mod_perl trunk: Makefile.PL, IO and XSLoader
the most bizarre thing popped up when i was trying to build a mod_perl deb (and from regular source) on debian testing/i386: String found where operator expected at /usr/lib/perl/5.8/IO.pm line 11, near "XSLoader::load 'IO'" (Do you need to predeclare XSLoader::load?) syntax error at /usr/lib/perl/5.8/IO.pm line 11, near "XSLoader::load 'IO'" Compilation failed in require at /usr/lib/perl/5.8/IO/Handle.pm line 9. BEGIN failed--compilation aborted at /usr/lib/perl/5.8/IO/Handle.pm line 9. Compilation failed in require at /usr/lib/perl/5.8/IO/Seekable.pm line 9. BEGIN failed--compilation aborted at /usr/lib/perl/5.8/IO/Seekable.pm line 9. Compilation failed in require at /usr/lib/perl/5.8/IO/File.pm line 11. BEGIN failed--compilation aborted at /usr/lib/perl/5.8/IO/File.pm line 11. Compilation failed in require at /usr/share/perl/5.8/FileHandle.pm line 9. Compilation failed in require at /usr/share/perl/5.8/ExtUtils/Embed.pm line 6. Compilation failed in require at lib/Apache2/Build.pm line 26. BEGIN failed--compilation aborted at lib/Apache2/Build.pm line 26. Compilation failed in require at Makefile.PL line 36. BEGIN failed--compilation aborted at Makefile.PL line 36. now, if i go disambiguate XSLoader::load with parentheses, it complains of an undefined subroutine. i'm not sure what's eating XSLoader's symbols, but it's sure messing me up. has anything around this sphere been changed recently, say, in the last couple weeks? .dorian
Re: debian testing vs mod_perl trunk: Makefile.PL, IO and XSLoader
On Tue, 2 Aug 2005, Dorian Taylor wrote: the most bizarre thing popped up when i was trying to build a mod_perl deb (and from regular source) on debian testing/i386: String found where operator expected at /usr/lib/perl/5.8/IO.pm line 11, near "XSLoader::load 'IO'" (Do you need to predeclare XSLoader::load?) syntax error at /usr/lib/perl/5.8/IO.pm line 11, near "XSLoader::load 'IO'" Assuming you're aware of the renaming issue: http://perl.apache.org/docs/2.0/rename.html I've seen a similar error when installing a current CPAN/svn mod_perl-2 over top of an existing mod_perl-2 that followed the old API. Did you remove any old mod_perl-2 installation before installing the new one? In particular, is there an old Apache2.pm around that may be getting picked up? -- best regards, randy kobes
Re: debian testing vs mod_perl trunk: Makefile.PL, IO and XSLoader
> Assuming you're aware of the renaming issue: >http://perl.apache.org/docs/2.0/rename.html > I've seen a similar error when installing a current > CPAN/svn mod_perl-2 over top of an existing mod_perl-2 > that followed the old API. Did you remove any old > mod_perl-2 installation before installing the new one? > In particular, is there an old Apache2.pm around that > may be getting picked up? weird, there was an Apache2.pm, but the mtime was dated july 14, which is strange cause i thought i'd cleaned it out far before then. anyway thanks for pointer. .d
Re: UDP Protocol Handler?
On 2 Aug 2005, at 13:27, Ken Simpson wrote: BTW Matt: Have you released the super-caching DNS query system that you were discussing a few months back? The one that works way better than Net::DNS for doing nasty things like lots of SPF checks? Sort of. There's code as part of Qpsmtpd that will show you how to do Net::DNS with a single socket. And SpamAssassin has integrated similar ideas. But I don't have anything generic. Matt.
win32, mod_perl/2.0.1, Apache/2.0.54 - ithreads problem
I'd using ithreads on ActivePerl 5.8.7 and Apache/2.0.54 (Win32). All scripts with ithreads did working excellent. Since I've installed mod_perl/2.0.1 with 'ppm install', those scripts have ceased to work (there's an initial HTML-table's dumping only). Due to I couldn't find another ways to demonstrate several processes working in pseudo-parallel (on win32), I was forced to write CGI- scripts just for a browser, not for shell. That is why I print out a multicolumn table. What there are on my PC: w2k SP3 MSIE6 SP1 Apache/2.0.54 (Win32) mod_ssl/2.0.54 OpenSSL/0.9.7g PHP/4.3.11 mod_perl/2.0.1 Perl/v5.8.7 I downloaded the pre-compiled binary file that is about 30 Mb from: http://apache.tsuren.net/perl/win32-bin/Perl-5.8-win32-bin-0.10.exe It's the "All in one packages": Apache, ActivePerl, mod_perl, mod_php and so on. Paths: C:\Perl\bin\ C:\Program Files\Apache Group\Apache2\bin\ I'm writing and running CGI-scripts under MSIE6 that use the $|++ buffering, the threads module and so on. Here are all the modules I'm using within any single thread-script: use strict; use warnings; use Time::HiRes; use threads; use threads::shared; use Thread::Queue; Also I've checked up and modified paths and some directives in the httpd.conf according to mod_perl 2.0 docs: ### ThreadsPerChild 4 MaxRequestsPerChild 0 LoadFile "C:/Perl/bin/perl58.dll" LoadModule perl_module modules/mod_perl.so DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs" Alias /modperl/ "C:/Program Files/Apache Group/Apache2/modperl/" Alias /perl/ "/Apache2/perl/" SetHandler perl-script PerlResponseHandler ModPerl::Registry Options +ExecCGI PerlOptions +ParseHeaders ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache2/cgi-bin/" AllowOverride None Options None Order allow,deny Allow from all Include conf/perl.conf ### Also I made like that in the perl.conf. A script was placed to C:/Program Files/Apache Group/Apache2/perl/ dir and running from MSIE as http://localhost/perl/myscript.pl with no shebang! Now the error.log says: Sat Jul 30 16:33:19 2005] [notice] Child 1048: Child process is running [Sat Jul 30 16:33:19 2005] [notice] Child 1048: Acquired the start mutex. [Sat Jul 30 16:33:19 2005] [notice] Child 1048: Starting 4 worker threads. Variable "$q_letters" will not stay shared at (eval 75) line 75. Variable "@threads" will not stay shared at (eval 75) line 73. ...and so on. When I'd running that script with Perl.exe interpreter from cgi-bin dir and #!C:\Perl\bin\perl -w shebang, there weren't any errors and warning messages. Here is an example of what is the $q_letters variable: my $q_letters = new Thread::Queue; $q_letters->enqueue('a','b','c', 'd','e','f', 'g','h','i'); When I'm running the same script just in a shell, I seeing a HTML-table's dumpimg again and no more, although the CPU still doing something hidden for certain period. Also I'd looking at processes and seeing something like leak of memory: Apache.exe did growing up to 45 Mb after that w2k had displayed alert msg about "virtual memory is almost up". What's wrong? How to solve the problem of running win32-CGI-thread-scripts on mod_perl 2.0 and Apache2? Is mod_perl 2.0 intended for using the win32's threads module and the rest I using? If you're interesting, I'll post my script (3 kb) here. Thanx. P.S.: While I'd writing the message I nevertheless could wait until a script shows some incorrect results in MSIE (about 10 min!!! later after script was started).
Re: win32, mod_perl/2.0.1, Apache/2.0.54 - ithreads problem
On Wed, 3 Aug 2005, Plymouth Rock wrote: I'd using ithreads on ActivePerl 5.8.7 and Apache/2.0.54 (Win32). All scripts with ithreads did working excellent. Since I've installed mod_perl/2.0.1 with 'ppm install', those scripts have ceased to work (there's an initial HTML-table's dumping only). Due to I couldn't find another ways to demonstrate several processes working in pseudo-parallel (on win32), I was forced to write CGI- scripts just for a browser, not for shell. That is why I print out a multicolumn table. What there are on my PC: w2k SP3 MSIE6 SP1 Apache/2.0.54 (Win32) mod_ssl/2.0.54 OpenSSL/0.9.7g PHP/4.3.11 mod_perl/2.0.1 Perl/v5.8.7 [ ... ] I'm writing and running CGI-scripts under MSIE6 that use the $|++ buffering, the threads module and so on. Here are all the modules I'm using within any single thread-script: use strict; use warnings; use Time::HiRes; use threads; use threads::shared; use Thread::Queue; [ ... ] A script was placed to C:/Program Files/Apache Group/Apache2/perl/ dir and running from MSIE as http://localhost/perl/myscript.pl with no shebang! Hi, The shebang isn't needed for Registry scripts. Now the error.log says: Sat Jul 30 16:33:19 2005] [notice] Child 1048: Child process is running [Sat Jul 30 16:33:19 2005] [notice] Child 1048: Acquired the start mutex. [Sat Jul 30 16:33:19 2005] [notice] Child 1048: Starting 4 worker threads. Variable "$q_letters" will not stay shared at (eval 75) line 75. Variable "@threads" will not stay shared at (eval 75) line 73. ...and so on. When I'd running that script with Perl.exe interpreter from cgi-bin dir and #!C:\Perl\bin\perl -w shebang, there weren't any errors and warning messages. Here is an example of what is the $q_letters variable: my $q_letters = new Thread::Queue; $q_letters->enqueue('a','b','c', 'd','e','f', 'g','h','i'); I'm not an expert on ithreads (Stas is the resident guru on this), but from messages such as http://marc.theaimsgroup.com/?l=apache-modperl&w=2&r=1&s=threads%3A%3Ashared&q=b there's still issues with these, especially in a mod_perl environment. Could you post a complete (but minimal) script that illustrates the problem you're encountering? From what you wrote above, I tried this Registry script: === #!D:/Perl/bin/perl ## ## printenv -- demo CGI program which just prints its environment ## use strict; use warnings; use threads; use threads::shared; use Thread::Queue; my $q_letters = new Thread::Queue; $q_letters->enqueue('a','b','c', 'd','e','f', 'g','h','i'); print <<"END"; Content-type: text/html Hello Hello END === and didn't see any messages of the sort you saw in the error log, nor did the Apache process grow (I'm using the system that I used to make up the all-in-one binary you're using). -- best regards, randy kobes