Re: Undefined subroutine error
On Tue, Apr 14, 2009 at 01:56:57PM -0400, Perrin Harkins wrote: On Tue, Apr 14, 2009 at 1:34 PM, Roberto C. Sánchez robe...@connexer.com wrote: On Tue, Apr 14, 2009 at 01:21:09PM -0400, Perrin Harkins wrote: On Tue, Apr 14, 2009 at 12:48 PM, Roberto C. Sánchez robe...@connexer.com wrote: As far as loading the module, I have tried: - PerlModule Example::Image in .htaccess - use Example::Image; in the main HTML::Mason component Either of those should be ok. If you decide to export the sub later, you'd need to call it from Mason. I'm not sure what you mean by this. Well, read up about exporting and then it should make more sense. Perl has namespaces, and when you export a sub you need to export it to the namespace where you want to call it, which is Mason in this case. So, on a lark I tried moving the PerlModule Example::Image from the .htacess file to the virtual host configuration. I then restarted apache. So far, it seems to have been working for several days. In the past, the problem would usually manifest itself within 8 hours or so of an apache restart. Could this have something to do with threading? Regards, -Roberto -- Roberto C. Sánchez http://people.connexer.com/~roberto http://www.connexer.com signature.asc Description: Digital signature
Re: Undefined subroutine error
On Tue, Apr 21, 2009 at 01:30:58PM -0400, Perrin Harkins wrote: On Tue, Apr 21, 2009 at 12:22 PM, Roberto C. Sánchez robe...@connexer.com wrote: So, on a lark I tried moving the PerlModule Example::Image from the .htacess file to the virtual host configuration. I then restarted apache. So far, it seems to have been working for several days. In the past, the problem would usually manifest itself within 8 hours or so of an apache restart. Why were you putting it in a .htaccess file? Were you trying to avoid loading it until people access a certain directory? I have the .htaccess in subversion, but not the virtual host config. Could this have something to do with threading? Are you using a threaded MPM? That's not recommended unless you're on Windows because of memory consumption. I haven't heard any bug reports about this kind of behavior on threads though. I'm actually using apache2-mpm-prefork. Regards, -Roberto -- Roberto C. Sánchez http://people.connexer.com/~roberto http://www.connexer.com signature.asc Description: Digital signature
Re: Undefined subroutine error
On Wed, Apr 15, 2009 at 10:29:20AM +0200, Torsten Foertsch wrote: Ok, then how about checking if your module is really loaded. Apache2::Status provides that or you could probably use this PerlResponseHandler (untested): Location /DUMPMODULES SetHandler modperl PerlResponseHandler sub { \ use Data::Dumper; \ use Apache2::RequestRec();\ use Apache2::RequestIO(); \ $_[0]-content_type(q{text/plain}); \ $_[0]-print(Dumper(\%INC)); \ return 0; \ } /Location It prints %INC to the browser. So you can check if your module is loaded from the correct path. This is in the output: 'Example/Image.pm' = '/etc/perl/Example/Image.pm' Regards, -Roberto -- Roberto C. Sánchez http://people.connexer.com/~roberto http://www.connexer.com signature.asc Description: Digital signature
Re: Undefined subroutine error
On Mon, Apr 13, 2009 at 10:12:27PM -0400, Perrin Harkins wrote: Are they really identically configured? Are you sure there isn't a difference in startup.pl or in MaxRequestsPerChild or something like that? OK, so the changes to include the mod_include and mod_disk_cache on the production server did not do the trick. The problem persists. Regards, -Roberto -- Roberto C. Sánchez http://people.connexer.com/~roberto http://www.connexer.com signature.asc Description: Digital signature
Re: Undefined subroutine error
On Tue, Apr 14, 2009 at 12:36:25PM -0400, Perrin Harkins wrote: On Tue, Apr 14, 2009 at 8:38 AM, Roberto C. Sánchez robe...@connexer.com wrote: OK, so the changes to include the mod_include and mod_disk_cache on the production server did not do the trick. The problem persists. I think it's all about the way you export your function, but you haven't answered my question about how you call it. Sorry, I thought that you were asking how I loaded the module. It appears that you want to know how I call the specific function. As far as loading the module, I have tried: - PerlModule Example::Image in .htaccess - use Example::Image; in the main HTML::Mason component As far as calling the function: - get_image_data('masthead.png', $urls{'img'}, $dirs{'img'}); - Example::Image::get_image_data('masthead.png', $urls{'img'}, $dirs{'img'}); As far as exporting, I'm not sure to what you are referring. Regards, -Roberto -- Roberto C. Sánchez http://people.connexer.com/~roberto http://www.connexer.com signature.asc Description: Digital signature
Re: Undefined subroutine error
On Tue, Apr 14, 2009 at 01:21:09PM -0400, Perrin Harkins wrote: On Tue, Apr 14, 2009 at 12:48 PM, Roberto C. Sánchez robe...@connexer.com wrote: As far as loading the module, I have tried: - PerlModule Example::Image in .htaccess - use Example::Image; in the main HTML::Mason component Either of those should be ok. If you decide to export the sub later, you'd need to call it from Mason. I'm not sure what you mean by this. As far as calling the function: - get_image_data('masthead.png', $urls{'img'}, $dirs{'img'}); - Example::Image::get_image_data('masthead.png', $urls{'img'}, $dirs{'img'}); Ok, I don't see how the first one could work with the code you've shown. You're defining the sub in a package, so you either have to export it or call it with the fully-qualified path, like you do in the second case. I have used the first syntax and have not noticed a different in the prevalence of the Undefined subroutine error between the two. If you're not familiar with this stuff, read up on exporting in the perlmod man page or your favorite Perl book. If you use the second syntax everywhere, I think this problem will go away. The issue is with the sub being available in your current namespace, not with loading the module. I am currently using the latter call everywhere and it is still generating the Undefined subroutine error. - Perrin Regards, -Roberto -- Roberto C. Sánchez http://people.connexer.com/~roberto http://www.connexer.com signature.asc Description: Digital signature
Re: Undefined subroutine error
On Tue, Apr 14, 2009 at 07:48:49PM +0200, Torsten Foertsch wrote: On Tue 14 Apr 2009, Roberto C. Sánchez wrote: I am currently using the latter call everywhere and it is still generating the Undefined subroutine error. Would it be possible to post your module? Perhaps you forgot the package declaration? --8--8-- package Example::Image; use Image::ExifTool; use vars qw( %dirs %urls ); sub get_image_data ($;$$) { my $image_name = $_[0]; my $image_src = $_[1] ? $_[1] : $urls{'img'}; my $image_dir = $_[2] ? $_[2] : $dirs{'img'}; my %image_data; $image_data{'src'} = $image_src . $image_name; my $info = Image::ExifTool::ImageInfo($image_dir . $image_name); $image_data{'comment'} = $$info{'Comment'}; $image_data{'width'} = $$info{'ImageWidth'}; $image_data{'height'} = $$info{'ImageHeight'}; return %image_data; } 1; --8--8-- Also, let me ephasize that I have three sites using this exact same module in the same exact manner as the problem site, yet without any sort of problem. Regards, -Roberto -- Roberto C. Sánchez http://people.connexer.com/~roberto http://www.connexer.com signature.asc Description: Digital signature
Undefined subroutine error
So, I've been dealing with trying to figure out an Undefined subroutine error on one of my sites. At first I thought it was something to do with Apache::ASP, so I sent a message requesting help to that list: http://mail-archives.apache.org/mod_mbox/perl-asp/200811.mbox/thread However, even after upgrading the server from Debian Etch to Lenny and migrating the site from Apache::ASP to HTML::Mason, I still get the exact same Undefined subroutine error. That makes me think that this something at a lower level. If anyone could possibly help or provide any insight, I would really appreciate it. This has really been causing me to wrack my brain since it only occurs on the production server and not on the development server (both are identically configured). Regards, -Roberto -- Roberto C. Sánchez http://people.connexer.com/~roberto http://www.connexer.com signature.asc Description: Digital signature
Re: Undefined subroutine error
On Mon, Apr 13, 2009 at 10:12:27PM -0400, Perrin Harkins wrote: In your Image.pm module, do you declare a package name? Do you export get_image_name()? How do you load this module in your new Mason setup? The entire Example/Image.pm: --8--8-- package Example::Image; use Image::ExifTool; use vars qw( %dirs %urls ); sub get_image_data ($;$$) { my $image_name = $_[0]; my $image_src = $_[1] ? $_[1] : $urls{'img'}; my $image_dir = $_[2] ? $_[2] : $dirs{'img'}; my %image_data; $image_data{'src'} = $image_src . $image_name; my $info = Image::ExifTool::ImageInfo($image_dir . $image_name); $image_data{'comment'} = $$info{'Comment'}; $image_data{'width'} = $$info{'ImageWidth'}; $image_data{'height'} = $$info{'ImageHeight'}; return %image_data; } 1; --8--8-- The module is loaded with a 'PerlModule Example::Image' directive. I have also tried without the PerlModule directive and with 'use' in the global.asa (for Apache::ASP) and the main component (for HTML::Mason). This has really been causing me to wrack my brain since it only occurs on the production server and not on the development server (both are identically configured). Are they really identically configured? Are you sure there isn't a difference in startup.pl or in MaxRequestsPerChild or something like that? I have no startup.pl and the MaxRequestsPerChild setting is identical for both servers. The only differences that I found were mod_include and mod_disk_cache were enabled on the development server, but not on the production server. I have enabled them in production to see if that makes a difference. For the moment, the 500 errors have seemingly disappeared. However, they have on occasion disappeared only to return after a day or so. But for now it appears to be OK for a few tens of thousands of requests. Regards, -Roberto -- Roberto C. Sánchez http://people.connexer.com/~roberto http://www.connexer.com signature.asc Description: Digital signature
Re: Trouble with mod_perl, Archive::Zip and taint mode
On Tue, May 27, 2008 at 05:48:14PM -0400, Perrin Harkins wrote: On Sun, May 25, 2008 at 3:45 PM, Roberto C. Sánchez [Sun May 25 08:57:35 2008] [error] [asp] [11570] [error] error executing code for include /var/www/templates/Photo_page_edit.tmpl: Insecure dependency in open while running setgid at /usr/lib/perl/5.8/IO/File.pm line 70. -- ; compiled to SCALAR(0x91f6f24) at /usr/share/perl5/Apache/ASP/Response.pm line 844. -- , /usr/share/perl5/Apache/ASP.pm line 1521 You may be seeing the same problem that these people had: http://mail-archives.apache.org/mod_mbox/perl-modperl/200705.mbox/[EMAIL PROTECTED] If so, upgrading to Perl 5.8.8+ and mod_perl 2.0.3+ will probably fix it. That was it. Etch already has Perl 5.8.8, but only mod_perl 2.0.2. Updating to 2.0.4 cause that particular error to go away. Of course I have a different one now, but I am working on tracking it down. P.S. The server running this site is Debian Etch, so unfortunately, I cannot use Archive::Extract which is included in Perl 5.10.0. Just because it's not part of the core perl libs doesn't mean you can't install it. This problem is probably fixable by upgrading Perl or mod_perl though. Of course, except that if I install it, as soon as I upgrade the server to the next Debian release, I will have a conflict. That is why I was trying to avoid installing it out of band, so to speak. Thanks for the tip on the mailing list thread. Regards, -Roberto -- Roberto C. Sánchez http://people.connexer.com/~roberto http://www.connexer.com signature.asc Description: Digital signature
Re: Trouble with mod_perl, Archive::Zip and taint mode
Does anybody have any ideas on this? Regards, -Roberto On Sun, May 25, 2008 at 03:45:24PM -0400, Roberto C. Sánchez wrote: [Please CC me on all replies] So, I am writing some simple code to allow a user to upload his own photo galleries. The section of code giving me problems is this: my $scratch_dir = $gallery_dir . /scratch; my $zipper = Archive::Zip-new(); my $zip_stat = $zipper-read($destfile); if ($zip_stat == Archive::Zip::AZ_OK) { $zipper-extractTree('.', $scratch_dir); print Extracted archive contents into target directory./p\n; } else { print Unable to operate on the uploaded archive file. Please fix the problem and upload again./p\n; } When I call extractTree() in the manner shown above, I get the Extracted archive... output, but nothing is actually extracted. If I change the call to extractTree() with no arguments, I get a 500 error and this in my Apache log: [Sun May 25 08:57:35 2008] [error] [asp] [11570] [error] error executing code for include /var/www/templates/Photo_page_edit.tmpl: Insecure dependency in open while running setgid at /usr/lib/perl/5.8/IO/File.pm line 70. -- ; compiled to SCALAR(0x91f6f24) at /usr/share/perl5/Apache/ASP/Response.pm line 844. -- , /usr/share/perl5/Apache/ASP.pm line 1521 If I try this, I also get the same taint error: my $scratch_dir = $gallery_dir . /scratch; my $zipper = Archive::Zip-new(); my $zip_stat = $zipper-read($destfile); if ($zip_stat == Archive::Zip::AZ_OK) { my @members = $zipper-memberNames(); foreach my $fn (@members) { $fn =~ /(.*)/; $fn = $1; $zipper-extractMember($n); } print Extracted archive contents into target directory./p\n; } else { print Unable to operate on the uploaded archive file. Please fix the problem and upload again./p\n; } I have also tried adding in gratuitous untaintings, but to no avail. Has anyone been able to make Archive::Zip work? If so, how? I am very close to just using system() to call /usr/bin/unzip, but that is not very portable. Regards, -Roberto P.S. The server running this site is Debian Etch, so unfortunately, I cannot use Archive::Extract which is included in Perl 5.10.0. -- Roberto C. Sánchez http://people.connexer.com/~roberto http://www.connexer.com -- Roberto C. Sánchez http://people.connexer.com/~roberto http://www.connexer.com signature.asc Description: Digital signature
Trouble with mod_perl, Archive::Zip and taint mode
[Please CC me on all replies] So, I am writing some simple code to allow a user to upload his own photo galleries. The section of code giving me problems is this: my $scratch_dir = $gallery_dir . /scratch; my $zipper = Archive::Zip-new(); my $zip_stat = $zipper-read($destfile); if ($zip_stat == Archive::Zip::AZ_OK) { $zipper-extractTree('.', $scratch_dir); print Extracted archive contents into target directory./p\n; } else { print Unable to operate on the uploaded archive file. Please fix the problem and upload again./p\n; } When I call extractTree() in the manner shown above, I get the Extracted archive... output, but nothing is actually extracted. If I change the call to extractTree() with no arguments, I get a 500 error and this in my Apache log: [Sun May 25 08:57:35 2008] [error] [asp] [11570] [error] error executing code for include /var/www/templates/Photo_page_edit.tmpl: Insecure dependency in open while running setgid at /usr/lib/perl/5.8/IO/File.pm line 70. -- ; compiled to SCALAR(0x91f6f24) at /usr/share/perl5/Apache/ASP/Response.pm line 844. -- , /usr/share/perl5/Apache/ASP.pm line 1521 If I try this, I also get the same taint error: my $scratch_dir = $gallery_dir . /scratch; my $zipper = Archive::Zip-new(); my $zip_stat = $zipper-read($destfile); if ($zip_stat == Archive::Zip::AZ_OK) { my @members = $zipper-memberNames(); foreach my $fn (@members) { $fn =~ /(.*)/; $fn = $1; $zipper-extractMember($n); } print Extracted archive contents into target directory./p\n; } else { print Unable to operate on the uploaded archive file. Please fix the problem and upload again./p\n; } I have also tried adding in gratuitous untaintings, but to no avail. Has anyone been able to make Archive::Zip work? If so, how? I am very close to just using system() to call /usr/bin/unzip, but that is not very portable. Regards, -Roberto P.S. The server running this site is Debian Etch, so unfortunately, I cannot use Archive::Extract which is included in Perl 5.10.0. -- Roberto C. Sánchez http://people.connexer.com/~roberto http://www.connexer.com signature.asc Description: Digital signature
Re: modperl with SSL
On Mon, Mar 24, 2008 at 03:25:26PM +0800, J. Peng wrote: hello list, we have our own realserver called QHttpd. This realserver doesn't support SSL protocal (https). So I have to develop a proxy before QHttpd to get it be compatible with SSL. I was thinking using modperl handler to do it. modperl accept the SSL connection from clients, do the verification, and if it's valid, redirect it to realserver with non-SSL (common http) protocal. Is it possible? if so, how to begin with it? at which stage? Thanks in advance. Would something like iprelay or stunnel not be sufficient for your needs? Regards, -Roberto -- Roberto C. Sánchez http://people.connexer.com/~roberto http://www.connexer.com signature.asc Description: Digital signature
Re: Custom Object-Oriented Module using HTML::Template
On Wed, Mar 12, 2008 at 11:02:27PM +, xyon wrote: Hey everyone, Firstly, I apologize I sent the previous email under an incorrect subject line. Yes, but you still hijacked another thread. = In-Reply-To: [EMAIL PROTECTED] Please don't do that. Start a new thread by sending a new message to the list. Don't just repky some random message and change the subject line. Regards, -Roberto -- Roberto C. Sánchez http://people.connexer.com/~roberto http://www.connexer.com signature.asc Description: Digital signature
Re: Amazon
On Sat, Feb 23, 2008 at 06:25:42PM +1100, Jie Gao wrote: Choosing java for better performance would certainly be a joke. If a java solution fails, it would be an industry-standard failure, backside covered. :-) Just a variation on the old, Nobody ever got fired for choosing IBM. Regards, -Roberto -- Roberto C. Sánchez http://people.connexer.com/~roberto http://www.connexer.com signature.asc Description: Digital signature
Re: Question about open()
On Wed, Feb 06, 2008 at 10:06:05PM -0500, Mag Gam wrote: Hi All, I have been using mod_perl, and I have several perl-cgi files that use the open(). I use this function to open/include my header, footer, basically a poor man template system. Currently, when I open a file I have to use the absolute path (/var/www/appname/top.inc). Is it possible for me to use just 'top.inc'? I think it trying to read from DocumentRoot, which is causing the issue. Has anyone ever faced this? I just set something like this in global.asa: my $base_dir = cwd . '/'; Then I can make the $base_dir available globally and just use that anywhere I need to refer to an on disk file. Regards, -Roberto -- Roberto C. Sánchez http://people.connexer.com/~roberto http://www.connexer.com signature.asc Description: Digital signature
Re: Question about open()
On Wed, Feb 06, 2008 at 10:47:08PM -0500, Mag Gam wrote: What is global.asa? Sorry, I am somewhat new at this... My mistake. I am using Apache::ASP (which is built on mod_perl) for my pages. Sorry for the confusion. Regards, -Roberto -- Roberto C. Sánchez http://people.connexer.com/~roberto http://www.connexer.com signature.asc Description: Digital signature
Re: restrict virtual hosts programs
On Fri, Jan 11, 2008 at 11:24:00PM -0500, Colin Wetherbee wrote: How about suexec? I used it quite some time ago, and it was awful to use, but it got the job done. http://httpd.apache.org/docs/2.2/mod/mod_suexec.html http://httpd.apache.org/docs/2.2/programs/suexec.html I prefer to run multiple httpd processes on high numbered ports (one for each site), then have the main httpd on port 80 do proxypass proxypassrever and name-based vhosting. Then you can also customize each httpd to only load what it needs. Regards, -Roberto -- Roberto C. Sánchez http://people.connexer.com/~roberto http://www.connexer.com signature.asc Description: Digital signature
Re: headers_out
On Sat, Dec 01, 2007 at 05:56:31AM -0800, Woff3 wrote: Hi. I had Apache 2.0 and mod_perl. Now I upgraded to Apache 2.2.6 and mod_perl2. I have html-pages where I use mason code. [code] $r-header_out(Refresh = 5; url=$url); This code worked fine in my previous system. Now when run my application, I get this error: Can't locate object method header_out via packageApache::RequestRec [/code] This is strange error, because in my httpd.conf file I haven't load module Apache::RequestRec I have load just these modules: [code] PerlModule Apache2::AuthCookieDBI PerlModule Apache2::DBI PerlModule HTML::Mason::ApacheHandler PerlModule Apache2::Request PerlModule Config2::IniFiles [/code] Does someone information, how I could fix this problem? Have you tried adding PerlModule Apache2::compat in your httpd.conf? Regards, -Roberto -- Roberto C. Sánchez http://people.connexer.com/~roberto http://www.connexer.com signature.asc Description: Digital signature
Re: get apache's concurrent connection number
On Mon, Nov 26, 2007 at 11:08:32AM +0800, yonghua wrote: Hello, How to get Apache's concurrent connection number under modperl? We have a plan that, when an apache's concurrent connection is large, we make the apache to redirect user's new request to another http server. So I need to write a mp module to do that. Thanks for any guide. Umm, why would you want to do that? Why not just use a proper load balancing solution? Regards, -Roberto -- Roberto C. Sánchez http://people.connexer.com/~roberto http://www.connexer.com signature.asc Description: Digital signature
Re: Apache offers to download the perl script rather than execute it!
On Tue, Nov 20, 2007 at 03:36:55PM +0100, Tobias Regneri wrote: Hi, SetHandler perl-script I think it's only a missing file type SetHandler perl-script .pl Actually, since he specified it inside of a Location block, it will apply the handler to everything in that location. The extension is only necessary if you want it to apply to only items with that extension. Regards, -Roberto -- Roberto C. Sánchez http://people.connexer.com/~roberto http://www.connexer.com signature.asc Description: Digital signature
Re: Apache offers to download the perl script rather than execute it!
On Tue, Nov 20, 2007 at 02:22:32PM -, michael watson (IAH-C) wrote: When I go to http://localhost/perl/rock.pl, Internet Explorer asks me if I want to download or open the file. Help? Umm, what do the error and access logs say? Regards, -Roberto P.S. Any chance you can get rid of this nonsense from your messages? The information contained in this message may be confidential or legally privileged and is intended solely for the addressee. If you have received this message in error please delete it notify the originator immediately. Unauthorised use, disclosure, copying or alteration of this message is forbidden may be unlawful. The contents of this e-mail are the views of the sender and do not necessarily represent the views of the Institute. This email and associated attachments has been checked locally for viruses but we can accept no responsibility once it has left our systems. Communications on Institute computers are monitored to secure the effective operation of the systems and for other lawful purposes. -- Roberto C. Sánchez http://people.connexer.com/~roberto http://www.connexer.com signature.asc Description: Digital signature