Re: [OT] MP2 Apache Settings
Why not just make an include file that contains the module directives, and then just add an Include myloginconffile.conf to each virtualhost section? Issac - Original Message - From: Chris Faust To: [EMAIL PROTECTED] Sent: Thursday, September 18, 2003 10:04 PM Subject: MP2 Apache Settings Hello Group, Hope this isn't too apache related and considered off topic. I have a bunch of sites, each have their own IP. Some of those sites have subsites within them with different domain names, these subsites are virtual's based on domainname with all the same parent IP. If I have MP2 modules and location names that I want to share to specific IPs or Specific Virtual Hosts is there was way to define it once or does it have to be within each virtual host. For example: VirtualHost 10.0.0.5 ServerName domain1.com PerlModule YADDA::LoginLocation "/login" SetHandler perl-script PerlHandler YADDA::Login/Location /VirtualHost VirtualHost 10.0.0.5 ServerName domain2.com /VirtualHost VirtualHost 10.0.0.6 ServerName domian3.com /VirtualHost In the case above I want the module YADDA::Login and the location to be available to BOTH the .05 virtual hosts, but not the .06 - so both /domain1.com/login and domian2.com/login do the same thing but domain3 would not. Is the choice either global to everything or defined within each virtual that I want it? I've been reading the server and dir create/merge section on perl.apache.org but I'm not even sure it relates. Thanks -Chris
Re:[OT] Sending a different protocol header
btw, can you please explain what ICY is for me? the $r-assbackwards(1) thing was specifically implemented in mod_perl 1.0 to support ICY, and I used it in examples I give of this, but I always have to say that I have no idea what ICY is. IceCast. The LINUX version of WinAmp's streaming MP3 server. Issac
Re: post max and MP2
Right now Apache::Request is in the final proting stages... Until it's done, jjust request Apache::Request with CGI Issac - Original Message - From: Tofu Optimist [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 02, 2003 6:43 PM Subject: post max and MP2 Hello -- I'm moving a module from MP1 to MP2. What is the MP2 equivalent of this code? Thanks! code my $q = Apache::Request-new($r, POST_MAX = 10 * 1024, DISABLE_UPLOADS = 1); $q-no_cache(1); /code __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html
Re: [mp2] BEGIN blocks
I'm not really sure what's going on... I tried making a test module to see what was going on inside, which appeared to function correctly. However, the real module is still having troubles. The database handle is opened ($dbh=DBI-connect...) in a BEGIN block in the real module, but the connections don't seem to work when the server originally loads, until I make a change in the file and Apache::Reload reloads it (after which it works fine as long as the server's alive). Here's the module and test results : package MyTest; use strict; use warnings; use Apache2; use Apache::Const qw(-compile OK); use carp qw(cluck); #use vars qw($VAR); our $VAR; BEGIN { warn (Calling BEGIN block); warn (BEGIN: VAR is $VAR); $VAR=HELLO; warn (BEGIN: CHANGED VAR to $VAR); } warn (Interpreting module); warn (VAR is $VAR); sub handler { my $r=shift; $r-content_type('text/plain'); $r-print(VAR is $VAR); return Apache::OK; } END { warn (Calling END block); warn (VAR is $VAR); } 1; (httpd.conf) PerlModule MyTest; Location /TEST SetHandler perl-script PerlResponseHandler MyTest /Location (error_log) [Thu Jul 24 11:42:01 2003] [notice] Parent: Created child process 2896 calling begin at f:/you/web//YOU/Objects.pm line 17. Calling BEGIN block at f:/you/web//MyTest.pm line 11. Use of uninitialized value in concatenation (.) or string at f:/you/web//MyTest.pm line 12. BEGIN: VAR is at f:/you/web//MyTest.pm line 12. BEGIN: CHANGED VAR to HELLO at f:/you/web//MyTest.pm line 14. Interpreting module at f:/you/web//MyTest.pm line 17. VAR is HELLO at f:/you/web//MyTest.pm line 18. [Thu Jul 24 11:42:07 2003] [notice] Child 2896: Child process is running [Thu Jul 24 11:42:07 2003] [notice] Child 2896: Acquired the start mutex. [Thu Jul 24 11:42:07 2003] [notice] Child 2896: Starting 250 worker threads. (the you/objects.pm is the real module giving me trouble) (output of http://localhost/TEST) VAR is HELLOHere's the relevant parts (I hope) of my code (full code available if needed):package YOU::ApacheApp;...use warnings;use CGI;use DBI;...use YOU::Objects;...my $event=YOU::Event-new($i); #Should connect to DB using $dbh..unless ($event-valid) {print ERROR ACCESSING DB! $DB::Objects::VERSION ${YOU::ApacheApp::VERSION}/${YOU::Objects::VERSION}BR /; my $dump=Dumper($event);$dump=~s/ /\nbsp;/mg;$dump=~s/\n/\BR \/\/mg;print $dump}# $event-valid returns true if connected to DB(Objects.pm)package YOU::Objects;use strict;use warnings;use DBI;use DB::Objects;use vars qw($VERSION);our $dbh;BEGIN {$VERSION=0.01;my $mysqldsn=DBI:mysql:database=...;host=...;mysql_compression=1; $dbh=DBI-connect($mysqldsn,...,...) or die couldn't connect: .DBI-errstr;}END {$dbh-disconnect();}...In this example, I get the error message until Apache::Reload reloads the module, after which it works fine.Any insight would be appreciated. Issac- Original Message - From: Stas Bekman [EMAIL PROTECTED] To: Issac Goldstand [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Sunday, July 20, 2003 10:21 PM Subject: Re: [mp2] BEGIN blocks Issac Goldstand wrote: I seem to be having some trouble that I think may be associated with BEGIN blocks. To make sure I'm not jumping at shadows, could someone tell me what the expected behavior of BEGIN blocks in use()d modules is? How many times are they called (during server startup and/or restarts of any type) and when? This is not documented yet for 2.0. I think it should be similar to 1.0. BEGIN blocks are called when the module is loaded. What unusual behavior do you see? __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [MP2] Placing Apache::RequestRec Apache::RequestIO APR::Tableuse statements in startup.pl
It will work. Just be careful - if you distribute this module, the people who use it may not include these modules in their startup.pl, and if you discontinue usage of this module, you may end up with extra modules in memory which aren't needed. Issac - Original Message - From: Jamie Krasnoo [EMAIL PROTECTED] To: Modperl list [EMAIL PROTECTED] Sent: Thursday, July 24, 2003 11:32 AM Subject: [MP2] Placing Apache::RequestRec Apache::RequestIO APR::Tableuse statements in startup.pl Will placing Apache::RequestRec Apache::RequestIO APR::Table in startup.pl to load them up for multiple handlers have any bad side effects? I noticed that when I load them via startup.pl the handlers that use them don't complain that they don't have the use statements within the module code and still work as normal. Jamie Krasnoo
Re: Apache::UploadMeter
Sven wrote... [snip] - use Apache (); use Apache::Request (); $apr = Apache::Request-new($r); foreach $parm($apr-param){ print -.$parm. : .$apr-param($parm).\n; } print -\n; - First of all, use instance() instead of new(). I believe the documentation for Apache::UploadMeter mentions this. [snip] Can someone show me an example of a upload.pl where a file is stored on the server please? Sure. Here is the response handler for the testbed for Apache::UploadMeter at http://epoch.beamartyr.net/umtest/form.html package ApacheUploadMeterTest; use Apache::Request; use Apache::Constants qw(OK DECLINED); use CGI::Carp qw(fatalsToBrowser); use Data::Dumper; sub handler { my $r=shift; my $q=Apache::Request-instance($r, POST_MAX=2097152); # Actually, the above line doesn't work - POST_MAX will be a parameter to # Apache::UploadMeter in future releases local($|)=1; my $num=0; print PART1; Content-Type: text/html HTML HEAD TITLEApache::UploadMeter Test Module/TITLE /HEAD BODY H1Upload Complete/H1 PART1 foreach my $upload ($q-upload) { $num++; my $name=$upload-name; my $size=$upload-size; my $filename=$upload-filename; my $type=$upload-type; my $info=Dumper($upload-info); my $tempname=$upload-tempname; print EOP UL LIUpload field: $num/LI LIDetected upload field: $name/LI LIDetected filename: $filename ($size bytes)/LI LIReported MIME type: $type/LI LISpool file: $tempname/LI LIOther debug info: $info/LI /UL EOP } print /BODY/HTML\n; return OK; } 1; Hope this gets you started, Issac
Re: [Fwd: Call for Participation for ApacheCon US 2003]
Actually, it is. I found it by going to the ApacheCon 2003 page, click the CFP link and then logging in. The page Stas sent doens't appear to work directly... Issac - Original Message - From: Bill Weinman [EMAIL PROTECTED] To: mod_perl Mailing List [EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 7:36 PM Subject: Re: [Fwd: Call for Participation for ApacheCon US 2003] At 04:14 AM 7/22/2003, Stas Bekman wrote: If you would like to be a speaker at the ApacheCon US 2003 event, please go to the ApacheCon Web site, log in, and choose the 'Submit a CFP' option from the list there: I went through the process of creating an account only to find that the Submit a CFP option isn't there. Until they get that fixed, you can select Contact Us from the bottom menu, then under the cfp@ address there's a link to the online submission form. --Bill --- Bill Weinman http://bw.org/ Music http://music.bw.org/ Whois Client http://whois.bw.org/ Music Database http://www.webmusicdb.com/ --+
[mp2] BEGIN blocks
I seem to be having some trouble that I think may be associated with BEGIN blocks. To make sure I'm not jumping at shadows, could someone tell me what the expected behavior of BEGIN blocks in use()d modules is? How many times are they called (during server startup and/or restarts of any type) and when? Thanks, Issac
Re: [MP2 - BUG ?] Issue handing Apache config. error messages
- Original Message - From: Stas Bekman [EMAIL PROTECTED] To: Issac Goldstand [EMAIL PROTECTED] Issac Goldstand wrote: Looking at it now, I tend to agree... I just have a vague recollection of my first mod_perl 2 handler (Written only 2 weeks ago, though I dabbled with the C API 9 months ago, already) and reading it and playing with httpd.conf and overall being very confused. I've just committed the examples, hopefully they will appear online soon. I'd consider having 2 guides written - a porting guide - yours is nice, but more as reference than as tutorial - and the second for newbies (Starting with mor_perl 2)... I'm toying with the idea of starting the porting tutorial, but I want to make sure it's written well for clueless people (which I probably still at least half count as :-)) and with accurate content. porting or starting? We already have a porting guide: http://perl.apache.org/docs/2.0/user/porting/porting.html a porting reference: http://perl.apache.org/docs/2.0/user/porting/compat.html Right - I read it, and it's reference. It's not a good guide. A guide should start with the basics. The mp_1 guide is one of the most beautiful pieces of electronic documentation in existance! It should be a book (I know: practical mod_perl) Seriously though - the guide is what personally turned me on to mod_perl, but the above two documents make me shiver and stay the hell away from mp_2. What's needed is a good friendly piece of documentation to get people moving... to mp_2 and even getting started: http://perl.apache.org/docs/2.0/user/intro/start_fast.html Will look at it shortly - Let's not bite off more than we can chew in one mouthful. I'd suggest to improve these docs where approapriate and start a new doc only if it really doesn't fit into the existing docs. I'm just not sure if it *does* fit... Issac
Re: [MP2 - BUG ?] Issue handing Apache config. error messages
Right. Could you possibly clarify the difference between SetHandler perl-script and SetHandler modperl? I'm still not sure I've got the straight of it yet... Issac Stas Bekman wrote: Sreeji K Das wrote: [...] You need to use 'SetHandler perl-script' for that, see: http://perl.apache.org/docs/2.0/user/config/config.html#C_SetHandler_
Fw: [Perl] HTML::Mason help anyone?
Forwarded from the Israeli Perl Mongers mailing list: - Original Message - From: Ron [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, June 09, 2003 1:48 PM Subject: [Perl] HTML::Mason help anyone? I have a simple form that looks like so: form method=GET action=/company/contact_us/handle_info_req.html enctype=text/plain input type=text name=end_email size=15 input type=submit name=submit value=click /form all HTML files are processed by Mason using the filesmatch directive in httpd.conf and my simple handler object simply does: % foreach (sort %ARGS) { % $_ % % } The problem is that I only see the values printed when I use the GET option in the form above, when I change GET to POST nothing gets printed... what am I doing wrong? it seams to me that Mason is not seeing any posted data... Thanks Ron. ___ Perl mailing list [EMAIL PROTECTED] http://www.perl.org.il/mailman/listinfo/perl
Re: getting *any* variables out of the server environment
Ryan, Ust out of curiosity, at what stage in the request chain are you doing this? If you are doing anything before mod_ssl populates its environment variables (which I seem to rembmer being at Fixup, although I may be confusing with something else), you wouldn't be able to access them. You *should* still be able to get to other Apache environment variables. Try an easy one: test for mod_perl. If that works, your environment variables are OK, and it's likely a mod_ssl problem that you're having. Issac - Original Message - From: Ryan Muldoon [EMAIL PROTECTED] To: Geoffrey Young [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, June 09, 2003 10:13 PM Subject: Re: getting *any* variables out of the server environment Geoffrey, Thanks for the explanation. Unfortunately, I think I am still a little unclear as to how to proceed. If I understand you correctly, my first method is completely wrongheaded. (I tried this because it is how the Writing Apache Modules with Perl and C does it. p.327) So it sounds like the second way is the appropriate usage for subprocess_env(). But it seems like you're saying that I shouldn't be using that at all. Specifically, here is what I'd like to get out of the environment: SSL_CLIENT_S_DN_CN SSL_CLIENT_S_DN_O and things of that nature. According to mod_ssl's documentation, these are put in ENV upon processing of a client certificate. Ideally, I'd like to make which fields to extract configurable, so I don't want to hard-code. Currently, I have PerlPassEnv SSL_CLIENT_S_DN_O PerlPassEnv SSL_CLIENT_S_DN_CN in my httpd.conf, but it doesn't seem to make any kind of difference. To make sure it isn't just mod_ssl being lame for some reason, I've tried it with DOCUMENT_ROOT and other standard ENV variables. But to no avail. :( --Ryan On Mon, 2003-06-09 at 13:59, Geoffrey Young wrote: Ryan Muldoon wrote: I'm not able to get *any* variables out from the apache server environment. ok, first off, this is a two step process for Apache. the first step is that modules (like mod_ssl) populate the subprocess_env table with various values. then, modules like mod_cgi and mod_perl come along and populate %ENV with the values from subprocess_env as well as various other CGI specific variables (like DOCUMENT_ROOT or whatever else there is). the point is that you're really not after environment variables if you want to test for something like $r-subprocess_env('HTTPS') - that it ends up as $ENV{HTTPS} is a byproduct of modules like mod_cgi and mod_perl. just for your own edification :) As you might be able to imagine, this is extremely frustrating, and inhibits my ability to do anything of use with mod_perl. My basic technique has been: my $uri = $r-uri; return unless $r-is_main(); my $subr = $r-lookup_uri($uri); my $apachecertcomp = $subr-subprocess_env($certcomponent); I don't understand the need for a subrequest to the same URI - subprocess_env has nothing to do with an actual subprocess. each request (including subrequests) have their own subprocess_env table attached to $r. in many cases, modules are coded to behave differently for subrequests than for the main request, so something you may see in $r-subprocess_env() could not be in $r-lookup_uri($uri)-subprocess_env(). But this doesn't work. I also tried my $var = $r-subprocess_env(VARIABLE_NAME); And this does not work either. I really need to be able to use environment variables that mod_ssl sets in my authentication handler. a few things here too. for the reasons described above, subprocess_env() is not a substitute for %ENV, so if what you want is a true %ENV value (such as those from PerlPassEnv), you will not be able to get to it via $r-subprocess_env(). Any ideas? Thanks! HTH --Geoff
Re: file upload object - getting form field name
Sorry for the latte reply. Absolutely: [snip] **use Apache::Request; **my $q=Apache::Request-instance($r); my $upload_id = 0; **for my $upload ($q-upload) { $upload_id++; **my $name=$upload-name; # do stuff } [snip] All the best, Issac
Apache::ReadConfig and method handlers
After a few fruitless days of fiddling with this, I find myself getting nowhere... Can anyone really explain how Apache::ReadConfig and/or direct me to the source code (for handling the namespace, not the code for Perl sections) Issac
Re: UploadMeter
Sorry for the late reply. http://epoch.beamartyr.net/umtest/form.html That's a development version, but there shouldn't be any noticable differences between that and the currect version. It's just configuration issue. One thing I did note is that MSIE 6 is not refreshing the meter... Issac - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, May 31, 2003 7:02 PM Subject: UploadMeter Hi, Anyone know a site that uses UploadMeter? I would like to take a live look at it to see if its what I am after. So far when I try it it simply does not print 'any' form input fields. This is likely due to something about Stacked Handlers. Well TIA. Best Regards, [EMAIL PROTECTED] -- /* Security is a work in progress - dreamwvr */ # 48 69 65 72 6F 70 68 61 6E 74 32 # Note: To begin Journey type man afterboot,man help,man hier[.] # 66 6F 72 20 48 69 72 65 0001 // Who's Afraid of Schrodinger's Cat? /var/(.)?mail/me \? ;-]
Re: UploadMeter
Feature. definately - That page is a seperate module called ApacheUploadMeterTest.pm whose sole purpose is to analyze the upload fields recieved in that request and report all information on them. It's not part of the Apache::UplaodMeter distro at all (Although up till version 0.22 I believe there was a dummy response handler included in it) REmember that the whole library is for the upload progress meter that pops up, not the response page :-) Issac - Original Message - From: Ryan Farrington [EMAIL PROTECTED] Cc: 'modperl list' [EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 2:18 PM Subject: RE: UploadMeter Feature or bug? Other debug info: Apache::Table=HASH(0xa1223ec) Here is what it told me when I used it. Upload Complete Detected upload field: TestUploadField Detected filename: /yame100.zip (320327 bytes) Reported MIME type: application/x-zip-compressed Spool file: /tmp/apreqHHY8vh Other debug info: Apache::Table=HASH(0xa1223ec) -Original Message- From: Issac Goldstand [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 6:04 AM To: [EMAIL PROTECTED] Cc: modperl list Subject: Re: UploadMeter Sorry for the late reply. http://epoch.beamartyr.net/umtest/form.html That's a development version, but there shouldn't be any noticable differences between that and the currect version. It's just configuration issue. One thing I did note is that MSIE 6 is not refreshing the meter... Issac - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, May 31, 2003 7:02 PM Subject: UploadMeter Hi, Anyone know a site that uses UploadMeter? I would like to take a live look at it to see if its what I am after. So far when I try it it simply does not print 'any' form input fields. This is likely due to something about Stacked Handlers. Well TIA. Best Regards, [EMAIL PROTECTED] -- /* Security is a work in progress - dreamwvr */ # 48 69 65 72 6F 70 68 61 6E 74 32 # Note: To begin Journey type man afterboot,man help,man hier[.] # 66 6F 72 20 48 69 72 65 0001 // Who's Afraid of Schrodinger's Cat? /var/(.)?mail/me \? ;-]
[OT] CGI::Push
Does anyone have success/failure stories using Push responses? Please share. Thanks. Issac
Using Apache::ReadConfig and method handlers
I want to assign a method handler from within the Apache::ReadConfig namespace. Right now, what I have is some function which somewhat resembles: package My::Object; sub method1 { my $self=shift; package Apache::ReadConfig; no strict; $Location{'/some/URL/'} = { Options = '+ExecCGI', PerlHeaderParserHandler = sub {$self-some_other_method;} }; But when I browse to /some/URL, some_other_method never gets called, let alone by $self Any advice? Issac
Re: Using Apache::ReadConfig and method handlers
- Original Message - From: Perrin Harkins [EMAIL PROTECTED] On Mon, 2003-06-02 at 11:36, Issac Goldstand wrote: I want to assign a method handler from within the Apache::ReadConfig namespace. Right now, what I have is some function which somewhat resembles: package My::Object; sub method1 { my $self=shift; package Apache::ReadConfig; no strict; $Location{'/some/URL/'} = { Options = '+ExecCGI', PerlHeaderParserHandler = sub {$self-some_other_method;} }; But when I browse to /some/URL, some_other_method never gets called, let alone by $self What are you trying to do? You know you can only do this sort of thing during server startup, right? After startup, you can still push handlers but you have to do it differently. No - this is at startup. It's also, to the best of my knowledge, the *only* way to push handlers onto a dynamic URL (eg, where the URL is a variable) - which is what I'm trying to do. This worked fine when it was just: PerlHeaderParserHandler = __PACKAGE__.::some_handler; Now, I'm realizing it should be something more akin to: PerlHeaderParserHandler = ref($self).-some_method; But even that's not working... Issac
Re: Using Apache::ReadConfig and method handlers
- Original Message - From: Perrin Harkins [EMAIL PROTECTED] On Mon, 2003-06-02 at 15:19, Issac Goldstand wrote: No - this is at startup. It's also, to the best of my knowledge, the *only* way to push handlers onto a dynamic URL (eg, where the URL is a variable) - which is what I'm trying to do. I was referring to the $r-push_handlers method which you can use when handling a request. This worked fine when it was just: PerlHeaderParserHandler = __PACKAGE__.::some_handler; Now, I'm realizing it should be something more akin to: PerlHeaderParserHandler = ref($self).-some_method; But even that's not working... That doesn't look like the syntax in the docs: http://perl.apache.org/docs/1.0/guide/config.html#Perl_Method_Handlers Or here: http://perl.apache.org/docs/1.0/guide/method_handlers.html If you really want an object method and not a class method, you need to do something like this: PerlHeaderParserHandler = sub { my $r = shift; $self-some_method($r); } Right - for $r-push_handlers, I do that:. $r-push_handlers(PerlFixupHandler,sub {return $self-uf_handler(@_);}); # A lot more elegant than the example in the Guide, IMHO But that's not what's needed for Apache::ReadConfig, I think - Here, we don't expect a sub reference, but rather the *name* of the routine (in the Apache::ReadConfig namespace) which we want to run... I'm still experimenting. Issac
[OT] YAPC::Israel
Hey all, Was just wondering if anyone here was planning on attending YAPC::Israel::2003 (http://www.perl.org.il/YAPC/2003 )? Issac
Fw: [Perl] CPAN was hacked !
- Original Message - From: Gabor Szabo [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, March 31, 2003 11:41 PM Subject: [Perl] CPAN was hacked ! by Matt's Script Archive, Inc. april fools!
Fw: Apache::GD::Thumbnail Question
Forgive my use of the list if this is a tad OT - but I seem to not be able to contact Steven directly all of the sudden (my ISP got but on a RBL, I think, and it will take them another bit to get off - that's why it took so long, Steven) Issac On Tue, 2003-03-25 at 00:12, Issac Goldstand wrote: - Original Message - ...snip... From the man page: * ThumbnailBaseDir Sets the directory that contains the images to be thumbnailed. Defaults to .. if not specified Since the virtual directory /home/me/pics/thumbs/../ is where the pictures are (eg, /home/me/pics), I can use the default. ...snip... Why don't you show me your exact configuration, and I'll see if I can help you out... Issac ...another snip... Hey Issac, Ok, I've dumbed this down to the lowest common denominator ( in this case, I qualify as this ). In my httpd.conf I have the following lines: Alias /pics/ /data/httpd/htdocs/image1/pics/ Directory /data/httpd/htdocs/image1/pics Order allow,deny AllowOverride None Order allow,deny Allow from all /Directory Location /*/pics/thumbs SetHandler perl-handler PerlHandler Apache::GD::Thumbnail PerlSetVar ThumbnailMaxSize 75 /Location Why are you using /image1/pics/ for the thumbnails and /pics/ for the pictures? I would use: Location /pics/thumbs for the location block and then IMG SRC=/pics/tumbs/roses.jpg/ in the HTML. See if that helps matters... In my script source I have the following line: $r-print ('PA href=/pics/roses1.jpgIMG src=/image1/pics/thumbs/roses.jpg/A I have tried this with the PerlSetVar ThumbnailBaseDir set to the Location, No - ThumbnailBaseDir, would you want to set it, should be set to /data/httpd/htdocs/image1/pics/ with PerlModule Apache::GD::Thumbnail you still need this (or use Apache::GD::Thumbnail; in mod_perl_start.pl) , with the OBJECT tag instead of the IMG tag no - you want IMG and they all yield the same 404 Not Found error. At this point I think that I'm probably missing something really stupid, considering I am following the man page to the letter. The only thing missing from the man page is any example of HTML/script usage but that looks to me as really basic - access the URL and the handler takes over. Any suggestions would be appreciated. Steve -- Steven A. Adams [EMAIL PROTECTED]
Re: speeding up CGI.pm
That would be really amazing if it could still be implemented in mp1, too, as it would allow for interoperability between libapreq-based applications (like Apache::UploadMeter) and response handlers like CGI scripts which use CGI.pm I suppose that this isn't such a big problem in mp2 whose filters will probably make using one API for request handling unnecessary... Issac - Original Message - From: Stas Bekman [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 1:41 AM Subject: speeding up CGI.pm While we are at the CGI.pm issue, I was thinking that those who stick with CGI.pm because of its extended all-in-one functionality (request parsing/ HTML generation), but unhappy about request parsing speed, could benefit by integrating Apache::Request in CGI.pm to do the request parsing. So if Apache::Request is available CGI.pm could re-alias its args(), params(), etc. functions to call Apache::Request functions instead. What do you think? __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Apache::GD::Thumbnail Question
It does work - I use it on http://pics.beamartyr.net/ Remember that it's a tricky sorta configuration - you must configure it within a location block which will be the thumbnail directory, and specify the real source directory: Example: The below configuration maps /home/me/pictures to http://foo.bar/pictures/ and generates on-the-fly thumbnails in http://foo.bar/pictures/mythumbs/ Alias /pictures/ /home/me/pictures Directory /home/me/pictures Order allow,deny Allow from all /Directory Location /pictures/mythumbs SetHandler perl-handler PerlHandler Apache::GD::Thumbnail /Location Remember that it only works on JPEGs. Issac - Original Message - From: Steven A. Adams [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, March 24, 2003 3:06 AM Subject: Apache::GD::Thumbnail Question Does anyone use this handler to make on-the-fly thumbs? I've used the standard example code in my apache (1.3.27 with MP1) and it seems to ignore the handler. Any suggestions? -- Steven A. Adams [EMAIL PROTECTED]
Fw: [Perl] how to static link mod_perl 2 into apache 2.0
Forwarding this from another list, because it's more appropriate here :-) - Original Message - From: Ron Gidron Sent: Monday, February 10, 2003 3:48 PM Subject: [Perl] how to static link mod_perl 2 into apache 2.0 I am trying to install a Mason based system. This package requires mod_perl statically linked and not as a DSO. for this new installation I decided to test Apache 2.0 and mod_perl 2.0. I downloaded the source for both packages and I am able to configure and make / make test /make install for both without problems however when I issue the command "apachectl -l" I don't see any reference to mod_perl. I have tried playing with the ./configure options for apache (--enable-perl etc) but nothing seams to get me to where I need to go, this is getting quite frustrating... does anyone have any tips? have any of you installed this configuration before, do you happen to remember the order of steps you took? Regards, Ron Gidron.
Fw: OT - Santa uses PERL
Title: OT - Santa uses PERL This came yesterday on the httpd-users list, and I haven't seen it on the mod_perl list yet (apologies if I just happened to not notice it). I thought that people might enjoy it. I'm sure one or two of you will want to flame me for it so I'd ask those people to do it off-list to avoid *really* unnecessary traffic :-) http://www.perl.com/pub/a/2002/12/18/hohoho.html Happy Holidays to all, Issac
Re: [OT] Ideas for limiting form submissions
- Original Message - Subject: RE: [OT] Ideas for limiting form submissions Can GIMP be programmatically set up to warp/woof/weird-out an image? Yahoo's warped words works, I bet, since they use it. I'm referring to get getting an anon email account from yahoo.com They actually use a third-party provider, although if anyone has information about doing this, I'd love to hear about it. Issac
Re: pass-thru/redirect/DECLINE to *.jpg
From: Ged Haywood [EMAIL PROTECTED] It seems a bit wasteful to have a mod_perl Apache process involved at all in serving .jpg and other static files. Why not run a two-Apache setup and let the non-mod_perl server serve them without even letting a heavyweight process see the request? It's described in the Guide. Not necessarily. There are always exceptions. For example, take a look at http://pics.beamartyr.net/ All of the pictures there go through mod_perl handlers which translate the entire path into a unique database entry. The application then stats the file on the filesystem, and does: my $fh=$pic-open; #returns the filehandle $r-send_fd($fh); close($fh); return OK; I used send_fd because it seemed from the documentation that it is a easier/better(?) method than rewriting the URI and setting default-handler. Is that not so? Issac
Re: [MP2] Handler feauters in a filter?
Implemented it in C: if (f-r-status==HTTP_NOT_FOUND) // If this is so, we need to revamp the request_rec { f-r-status=HTTP_OK; // Spoof HTTP_OK f-r-status_line=200 OK; APR_BRIGADE_INSERT_TAIL(ctx-bb,apr_bucket_eos_create(f-c-bucket_alloc)); // Add an EOS to the new bb ap_pass_brigade(f-next,ctx-bb); // and pass the new bb to the next filter return APR_SUCCESS; } Not sure how to translate that to mod_perl's API (the first half is easy and understandable in C, I think, though...) This was *my* solution - I'm not sure if it's the best way to do it... I'm sure that as I delve deeper into Apache 2, I'll find better solutions... Issac - Original Message - From: Stas Bekman [EMAIL PROTECTED] To: Issac Goldstand [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, December 03, 2002 3:43 PM Subject: Re: [MP2] Handler feauters in a filter? Issac Goldstand wrote: I'm writing a filter in which two lines of data are to be appended to the content going back. However, I'd like to test for a 404, and if found set the response to 200. Can this be done from the output filters? Or am I going to have to do something more complex with a handler? Haven't tried this yet, but you can either write a connection filter which rewrites the headers if they were sent already, or insert your filter just before the one that generates the headers. Since you want to add something to the end, the former case is probably the best. I suggest that you ask for the best way at the httpd-dev list, as it's a pretty generic httpd topic and that list has real filter experts. Then once you figure out from them what's the best way to go (and share with us :) implementing it in perl is a piece of cake. The big problem is mod_proxy (or any other module, for that matter) - it's not as simple as checking the file on disk - the content could be coming from a proxy or from another content-handler. Any ideas? Issac -- __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
[MP2] Handler feauters in a filter?
I'm writing a filter in which two lines of data are to be appended to the content going back. However, I'd like to test for a 404, and if found set the response to 200. Can this be done from the output filters? Or am I going to have to do something more complex with a handler? The big problem is mod_proxy (or any other module, for that matter) - it's not as simple as checking the file on disk - the content could be coming from a proxy or from another content-handler. Any ideas? Issac
Re: default Content-Length calculation has been removed in 2.0 (was Re: mod_perl 2.x vs. mod_perl 1.x benchmarks)
Issac Goldstand wrote: I think I got it... I was under the understanding that each fireman could only hande 1 bucket at a time, but there could be up to as many buckets as firemen on the stack at any given time... Do you know why it's like that? a limitation of the current mpms, there is only one thread/process for the whole pipeline of stages (filters/handlers). You could benefit from a real pipelining on an SMP machine. In any case we rather discuss this on the list. Well, it's been getting *WAY* OT - more geared for dev@httpd if anywhere, but I'm sure they've argued this out already :-) My initial ideas all counted on the fact that each handler/filter would have a way of getting its own per-request thread... there is a talk about async I/O mpms for 3.0, or later 2.x This sounds like our many buckets with firemen scenario - but, again, it only really becomes useful if the handlers/filters have their own thread running space. But the conclusion I'd draw from this, getting back to the original question, is that under Apache 2, it's *still* worth doing a frontend/backend setup where the frontend buffers all the backend data. Even if we *did* write the buffer filter, if the whole pipeline is stuck in one thread, then we're not freeing up the resources when the heavy handler/filter is done, so slow clients will still clog server resources. The frontend/backend solution takes care of this, because here, we're creating our own 2-threaded pipeline: the important thing being that the frontend should either have a buffer filter, or better yet, a constant flush + buffer filter to get the data from the backend straight to the client, while buffering additional data if needed. Does this make sense to you? Issac
Re: default Content-Length calculation has been removed in 2.0 (was Re: mod_perl 2.x vs. mod_perl 1.x benchmarks)
- Original Message - From: Stas Bekman [EMAIL PROTECTED] Cc: Ask Bjoern Hansen [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, November 28, 2002 11:07 AM Subject: default Content-Length calculation has been removed in 2.0 (was Re: mod_perl 2.x vs. mod_perl 1.x benchmarks) Actually, returning to Issac's question regarding releasing the handler early, you need a slightly modified version of the cl filter to do that. Since it's already buffering the data, you just want to do this unconditionaly. How do you mean unconditionaly? BTW: I'm wondering whether the solutnio for the whole buffering thing is write a buffer filter or is this something that should be done internally within the brigades? After all, once the [mod_perl] response handler (or filter) passes the EOS bucket, it's not needed anymore, and who cares if the other filters are ready or not? Stas, it sounded to me like you were suggesting something like: mod_perl handler/filter---Filter API---buffer filtercore-outputclient The assumption is that if bufer_filter slurps up the data, it will release the previous filters' resources, but I think that's kinda backwards thinking. As far as I understand, the only buffer you EVER have to worry about is the data coming IN to your filter. Once you pass the buckets along, you never have to worry about them again. 2 conclusions on this (my thought process included :-)): 1) The seemingly correct thing to do here would be to ensure that a handler/filter's resource pool (and entire thread?) is cleaned up as soon as it's done running. I think the latter is true, and to do this properly, Apache'd really have to give each filter plugged into each request it's own running thread. That's gonna add lotsa overhead. Maybe just a flag to request it's own thread if the module author/user is expecting their handler/filter to really use heavy resources (like an on-the-fly image processing filter for example). That way, heavy modules can get their own resources for when their eneded and release them ASAP. 2) The flipside of this is that a heavy module (like discussed above) *would* need this buffer filter; but it would want the buffer to slurp up the data coming *in*. The idea would be to let these heavy modules *create* themselves only when the data is ready (to optimize resource allocation/usage). The problem with this is that it's useless. Each request, as I understand, requires each filter in the chain to register itself in the bucket brigade chain right at the offset - which means that the private thread idea can't work since it will have to create the thread at the beginning of the request anyway - certainly before the data is ready. Comments? Issac
Re: Apache 2?
- Original Message - From: Stas Bekman [EMAIL PROTECTED] To: Philip Mak [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, November 27, 2002 2:24 AM Subject: Re: Apache 2? . Since if your mod_perl handler sends the data to a thread which runs a filter that send the data to a client (and doesn't need perl) it'll still block on the network transfer, which will block the response handler sending the data. So I can imagine that we will need a special filter that buffers the data, immediately releasing the perl handler and then slowly feeding it to the the client. This isn't just a mod_perl thing, either. This would be a generic Apache2 thing. *ANY* content should be filtered as such through a 2-tier system like this - but I thought that's what the bucket brigades did. Please correct me if I'm wrong in this picture: Response Handler start of buckets Filter API End of buckets Core Output client it was my understanding that one of the purposes of the core-output filter was to do exactly what we want - free the backend request and filter threads once they've finished with the EOS bucket. Am I missing something? Issac
Re: partial page display
local $|=1; - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 9:11 PM Subject: partial page display I would like to have some of the page display while the rest of the data for the page is still being retrieved (i.e. a Please wait, this operation takes several seconds... kind of message). I thought (perhaps naively) that a print Please wait.\n; at the beginning of my handler would accomplish this, but mod_perl seems to cache all output until the entire handler has returned. Is this possible without the use of a module like CGI::Push? Perhaps I need to modify the header? Thanks, Fran
Re: partial page display
Add a BR/ tag. That's what I throw in to force the browser to flush whatever I fed it onto the screen... Issac - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 9:25 PM Subject: RE: partial page display That doesn't work for us. It seems that the browser also maintains a buffer, because if I loop the please wait message 1 times, it does show up immediately. I suspect possibly there's some massaging we can do to the header? Thanks, Fran -Original Message- From: Issac Goldstand [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 26, 2002 2:13 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: partial page display local $|=1; - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 9:11 PM Subject: partial page display I would like to have some of the page display while the rest of the data for the page is still being retrieved (i.e. a Please wait, this operation takes several seconds... kind of message). I thought (perhaps naively) that a print Please wait.\n; at the beginning of my handler would accomplish this, but mod_perl seems to cache all output until the entire handler has returned. Is this possible without the use of a module like CGI::Push? Perhaps I need to modify the header? Thanks, Fran
Re: How do I force a 'Save Window?'
To force the save window is easy - make up your own content subtype (main type application) and set it: Content-Type: application/x-download-this-file-you-stupid-browser Remember to start with an x- as your type is obviously not registered with the IANA. The tricky part is setting up the default file name - if your script is http://foo.com/cgi-bin/download.pl?filename=bar the save dialog will default to download.pl; not to the expected bar. The solution is to force the file name out of the query string. You want to create a URI that looks like http://foo.com/download/bar?param1=val1param2=val2 or even better: http://foo.com/download/val1/val2/bar You should use mod_rewrite to take requests of this scheme and translate it to http://foo.com/cgi-bin/download.pl?filename=barparam1=val1param2=val2... The magic is that you then tell mod_rewrite to trigger an INTERNAL redirect, so the server works flawlessly without any funny configurations and the browser never sees it. If you're using a mod_perl handler, another way to do it is set up a location /download that calls your handler and read the filename (and possibly the parameters) directly out of the URI using the request object, but that's a bit harder (although more elegant and probably uses less resources then the big mighty mod_rewrite's rewrite engine). Issac - Original Message - From: Dennis Daupert [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 20, 2002 1:02 AM Subject: How do I force a 'Save Window?' I have file upload working, can upload files of ascii or binary format. But a problem when you browse to a page that dynamically displays hyperlinks to files. Text and html files display normally in a browser, and Word docs popup MS Word as a helper app, and the word doc opens fine. But MS Project files popup a browser instance and MS Project, and you get the usual Enable macros and such popups as normal, but only a subset of the project displays in the browser window, and none of the buttons are active in the Project application. Bummer. How can I force a Save File dialog screen for selected files, so the user will have the option to download the file, then open it in Project or whatever? Thanks for any help or information. /dennis -- - Office phone: 817-762-8304 -- - Great leaders never tell people how to do their jobs. Great leaders tell people what to do and establish a framework within which it must be done. Then they let people on the front lines, who know best, figure out how to get it done. ~ General H. Norman Schwarzkopf
Re: How do I force a 'Save Window?'
Becuase some browsers and mail clients don't follow the RFC. The RFC clearly states that When a mail reader encounters mail with an unknown Content-type value, it should generally treat it as equivalent to 'application/octet-stream' (SECTION 4 last paragraph - page 12) So my suggestion should actually translate into application/octet-stream. However, I've noted that where many browsers do all sorts of strange, interesting, and usually unexepcted things when it parses application/octet-stream, they'll usually do exactly what you want if you confuse them with a type that they've certainly never heard of. Issac - Original Message - From: Tom Hukins [EMAIL PROTECTED] To: Issac Goldstand [EMAIL PROTECTED] Cc: Dennis Daupert [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, November 20, 2002 12:27 PM Subject: Re: How do I force a 'Save Window?' On Wed, Nov 20, 2002 at 11:24:33AM +0200, Issac Goldstand wrote: To force the save window is easy - make up your own content subtype (main type application) and set it: Content-Type: application/x-download-this-file-you-stupid-browser Remember to start with an x- as your type is obviously not registered with the IANA. Why not use the application/octet-stream MIME type as recommended in RFC 1521? Tom
[OT] Persistant MySQL connections in Apache 2
This is really a C API thing, but I was wondering if Apache2::DBI people can help me shed some light on this... - Original Message - From: Kent Fitch To: [EMAIL PROTECTED] Sent: Monday, November 18, 2002 5:37 AM Subject: Re: [apache-modules] Persistant MySQL connections in Apache 2 Hi Issac, From: Issac Goldstand Subject: [apache-modules] Persistant MySQL connections in Apache 2 Hi all, I'm a rookie C API programmer (mod_perl was just so much *easier* most of the time :-)), and am working on coding a module to with in my front-end Apache 2/mod_proxy server. The idea of the module is to provide access to the front-end server with a list of blacklisted IPs which are stored in a MySQL database. So I'm thinking the module's child_init should open the connection to the MySQL database and then the access_handler can grab the MySQL connection from the child-pool. Yes, but beware that in a threaded Apache run-time, there could be many threads fo execution processing many requests simultaneously in your child process, so you'll have to arrange to lock the connection whilst a thread is using it and possibly have a pool of them. See Thread Safety http://httpd.apache.org/docs-2.0/developer/thread_safety.html But the problem is that I would *like* for the connections to the database be closed before the pool is simply swept clean upon destruction. I would think that that would be a good thing to do - maybe I'm wrong... Yes - you should register a cleanup function on the pool you allocate the data structures for the connection(s) from in your init. See these notes on pooling (which may be a bit 1.3-ish and hence out of date, but the ideas are relevant): http://httpd.apache.org/docs-2.0/developer/API.html#pools and see the apr_pool_cleanup_register api Kent Fitch
Re: File Upload Questions
So far, I've seen two suggestions; both are very good, and I wanted to try to offer a combination, based on a real implementation. The relevant parts of the source code for uploading the content (as related to writing the actual file on the server): my $r=shift; my $q=Apache::Request-instance($r); [snip] my $File=$q-upload('fid') || undef; [snip] my $hFile=$File-fh || undef; [snip] my $fLoc=fqName($hMD5); open(my $DOUT,$fLoc); binmode $DOUT; [snip] seek($hFile,0,0); ps_status(Compressing $fname...); while ($hFile) { ($output,$status)=$dStream-deflate($_); $status == Z_OK or die (Error deflating: $status); print $DOUT $output; } ($output,$status)=$dStream-flush(); $status==Z_OK or die (Error flushing: $status); print $DOUT $output; close $DOUT; As you can see, this code uses an interim deflate stream, but the loop would work just as well without it (eg, simply print $DOUT $_; inside the while loop). Issac PS. If you want to see the application, feel free to conatct me off-list and I'll send you the URL. - Original Message - From: Dennis Daupert [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 14, 2002 10:47 PM Subject: File Upload Questions I have gotten file upload working using Apache::Request for text files. But binary files seem to have other ideas :-) For example, uploading a word doc, I get a success message, but when I retrieve the doc after uploading it, and try to open it in Word 2000, I get the popup error message: The document name or path is not valid... etc Do I need to do anything to detect the content type of the file and set binary versus ascii transfers? The man page for Apache::Request talks about type, but not how to set the transfer. In case I have done something silly in my code, here is a section in which I untaint the filename, and also remove the leading c:\path\to\file info (for windows uploads) or similar /path/to/file for unix uploads: # now let's untaint the filename itself if ($data{'up_filename'} =~ /^([-\@\/\w\:\\.]+)$/) { $data{'up_filename'} = $1; my $cleanfile = $data{'up_filename'}; $cleanfile = $1; # $cleanfile now untainted $cleanfile =~ s#\.\.##g; $cleanfile =~ s[//][/]g; # take out windows backslashes if ($cleanfile =~ /\\/) { my @parts = split ( /\\/, $cleanfile ); $cleanfile = pop @parts; } # take out unix forward slashes if ($cleanfile =~ /\//) { my @parts = split ( /\//, $cleanfile ); $cleanfile = pop @parts; } $data{'up_filename'} = $cleanfile; } And then: my $fh = $upload-fh; my @file = $fh; open ( WRITEFILE, $data{'write_dir'}/$data {'up_filename'} ) or die couldn't open $data{'up_filename'} for writing: $! \n; print WRITEFILE @file; close (WRITEFILE); Any insight greatly appreciated. /dennis -- - Office phone: 817-762-8304 -- - Great leaders never tell people how to do their jobs. Great leaders tell people what to do and establish a framework within which it must be done. Then they let people on the front lines, who know best, figure out how to get it done. ~ General H. Norman Schwarzkopf
[OT] Re: sending ssl certificate according to virtual host
- Original Message - From: Vivek Khera [EMAIL PROTECTED] Newsgroups: ml.apache.modperl To: [EMAIL PROTECTED] Sent: Wednesday, November 06, 2002 6:52 PM Subject: Re: sending ssl certificate according to virtual host MJ == Mathieu Jondet [EMAIL PROTECTED] writes: MJ Depending on the vh requested I set the SSLCertificateFile and MJ SSLCertificateKeyFile which will point to the correct ssl files for the MJ requested vh. What they should have done is what is done now with TLS in SMTP. You connect to the same port, but issue a STARTTLS command to switch over to secured mode. With this type of scheme, the header info with the desired host could be in the initial request, so then you could pick the right certificates to use. Alas, the HTTP protocol doesn't work this way as far as I can tell. I dunno... What if you want to send a cookie in secured mode? That's part of the headers, and of equal priority as the Hostname: header used to determine the correct VirtualHost to use... I'm sure that SSL could be fit much nicer over HTTP/1.1, but it would probably rip apart alot of the solid standards involved - such as creating priorities inside the headers, or the option to take multiple commands... Origianlly, when writing this email, I was going to suggest a CONNECT / STARTTLS scheme which would work in Keep-Alive mode until the server clsoed the connection... But then I found an existing RFC which describes it - so the question (probably a stupid one which I don't realize is stupid only because I just now stumbled accross the RFC and still don'ty properly understand what's involved) is: why is it not implemented? Anyway, the RFC in question is 2817 (http://www.ietf.org/rfc//rfc2817.txt) Issac
Re: Problems writing binary uploaded data...
Well, there are 2 issues here: 1) Getting $upload-link to work (yes, you can do it if you really want to:-)) 2) Fixing your original problem So: 1) Use TEMP_DIR to set a different spool directory for the uploaded file: From the same manpage: (under methods to pass $apr-new()) TEMP_DIR Sets the directory where upload files are spooled. On a *nix-like that supports link(2), the TEMP_DIR should be located on the same file system as the final destination file: my $apr = Apache::Request-new($r, TEMP_DIR = /home/httpd/tmp); my $upload = $apr-upload('file'); $upload-link(/home/user/myfile) || warn link failed: $!; 2) I'm not really sure - I only gave your problem a rather casual look-over, but my first instinct is to add close (OUTFILE); to the end of your code - perhaps it's not flushing the output buffer to the file since you never explicitly close the filehandle... Issac - Original Message - From: Leif Snorre Schøyen Boasson [EMAIL PROTECTED] To: Issac Goldstand [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, October 22, 2002 8:51 PM Subject: Re: Problems writing binary uploaded data... Well, the original reason I didn't use that was I didn't know what linking it was used for... (so much for RTFM... :) ). However, my /tmp (which Apache is using as it's tmp-directory) is on its own partition, so I cant really link it anywhere else but /tmp, which is not exactly where I'd like it to go... Is there any other way to get it saved directly like that, and not having to cp it somewhere else? (and I'd still like to know why my original code doesn't work... :) ) Thanks alot for the advice, though! cheers Snorre On Tue, 22 Oct 2002, Issac Goldstand wrote: Um... Why don't you simply use $upload-link on the handle? From Apache::Request manpage my $upload = $apr-upload('file'); $upload-link(/path/to/newfile) or die sprintf link from '%s' failed: $!, $upload-tempname; /From Apache::Request manpage Issac - Original Message - From: Leif Snorre Schøyen Boasson [EMAIL PROTECTED] To: mod_perl [EMAIL PROTECTED] Sent: Tuesday, October 22, 2002 6:08 PM Subject: Problems writing binary uploaded data... I'm trying to save an uploaded binary file (a jpg) through a perlscript. The code doing this looks like: if (open OUTFILE, /var/www/tmp/test.jpg){ binmode $ULFILE, :raw; binmode OUTFILE, :raw; while ($sizeread=read($ULFILE, $buffer, 1024)) { print OUTFILE $buffer; $size += $sizeread; } print brRead ,$size, bytes.; } Where ULFILE is the filehandle for the uploaded file, gotten from an Apache::Request object. Now, the sum of the sizes reported by the read-command is correct for the original jpg file I use to test, but the written file is somewhat smaller (7192 bytes smaller), so I figure something gets lost in the writing. But I cant figure out how or why... ...anybody see some reason why I shouldnt get the exact binary data out?
Re: Problems writing binary uploaded data...
Um... Why don't you simply use $upload-link on the handle? From Apache::Request manpage my $upload = $apr-upload('file'); $upload-link(/path/to/newfile) or die sprintf link from '%s' failed: $!, $upload-tempname; /From Apache::Request manpage Issac - Original Message - From: Leif Snorre Schøyen Boasson [EMAIL PROTECTED] To: mod_perl [EMAIL PROTECTED] Sent: Tuesday, October 22, 2002 6:08 PM Subject: Problems writing binary uploaded data... I'm trying to save an uploaded binary file (a jpg) through a perlscript. The code doing this looks like: if (open OUTFILE, /var/www/tmp/test.jpg){ binmode $ULFILE, :raw; binmode OUTFILE, :raw; while ($sizeread=read($ULFILE, $buffer, 1024)) { print OUTFILE $buffer; $size += $sizeread; } print brRead ,$size, bytes.; } Where ULFILE is the filehandle for the uploaded file, gotten from an Apache::Request object. Now, the sum of the sizes reported by the read-command is correct for the original jpg file I use to test, but the written file is somewhat smaller (7192 bytes smaller), so I figure something gets lost in the writing. But I cant figure out how or why... ...anybody see some reason why I shouldnt get the exact binary data out?
Re: posts headers and so on.
I just hit reply now - note that it is AUTOMATICALLY to you, plus [EMAIL PROTECTED] Also note the original headers below: Issac - Original Message - From: Innerlab [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 16, 2002 3:18 PM Subject: posts headers and so on. Hello: I just subscribed to the list. I don't want to be a pain in the ass so soon, but I've noticed that (at least on yahoo), these posts cannot be automatically replied to the list. They go by default to whoever wrote the original email, thus one has to manually replace that address for [EMAIL PROTECTED] . Also, neither the Subject, the To: or the From: information in the header doesn't mention modperl * , making it hard to filter these emails. Has anyone noticed all this already or is it me? = ___ Eduardo Gomez www.innerlab.com __ Do you Yahoo!? Faith Hill - Exclusive Performances, Videos More http://faith.yahoo.com
[OT] Re: Testing mod_perl app on Windows
FYI: MS Windows .NET server (which is the XP server equivalent) is available for beta. Find out at windowsbeta.microsoft.com Issac - Original Message - From: Adam Nelson [EMAIL PROTECTED] To: 'Ken Y. Clark' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, October 11, 2002 4:07 PM Subject: RE: Testing mod_perl app on Windows ME is just windows 98 with some bells and whistles. If you want server, then win2k Server is still the standard (XP is only for workstation/desktop). I think mod_perl/Apache will run fine on ME,2000,XP,and even 98. But for real server environment, the choice is 2000 Server. -Original Message- From: Ken Y. Clark [mailto:[EMAIL PROTECTED]] Sent: Friday, October 11, 2002 8:32 AM To: [EMAIL PROTECTED] Subject: Testing mod_perl app on Windows My boss has asked me to pick up a Windows box so that I can test my application using the standard browsers on that OS. OK, I can see how it is a Good Thing to make sure that those people unfortunate enough to use Windows are able to use my application without errors. But I also had another idea: As I'm trying to make sure my code is platform-neutral, I'd like to try installing everything on the Windows platform as some people who download my app might try to do this. Not having touched Windows in about 3 years, all the different products really confuse me. When I go to the local PC store to pick up a box, what should I ask for? Windows 2000, ME, XP? Is there a specific XP server, or can I install Apache/mod_perl on the standard desktop OS? ky
[OT] Re: asynchronous downloads
- Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, October 03, 2002 5:09 PM Subject: Re: asynchronous downloads How do I send a file asynchronously? The classic example is download sites. You click on the file you want and it generates a thankyou page for your browser and also sends the file. So what's the correct way to do this? Use a refresh META tag on the thank-you page, that points to the requested file. Look at any download page at SourceForge to see how it is done. Alternatively, you can return a multipart/mixed MIME message with both documents as the result of the HTTP request. Actually, that is not defined for HTTP. Although people commonly interchange the Content-Type field defined by HTTP, and that defined by MIME, the two are not interchangable. The closest that HTTP comes to working with multipart fields is the multipart/form-data Content-Type defined in RFC 2388 (http://www.ietf.org/rfc/rfc2388.txt) As it happens, I noticed this a couple of years ago, and am currently planning an I-D which will implement multipart/related HTTP responses. If anyone at all is interested in this, please don't hesitate to contact me about it - BUT, let's keep that off-list, please :-) Issac
Re: mod_perl Windows 2000 install notes
It's needed, for example, to enable the system-wide PATH to include \Perl\bin in it, which is needed to load mod_perl.so into the server when running as a system service. Note that you can still go to a command shell, add perl\bin to the path and manually start apache from the command shell - that will work. Issac - Original Message - From: Randy Kobes [EMAIL PROTECTED] To: Larry Leszczynski [EMAIL PROTECTED] Cc: mod_perl list [EMAIL PROTECTED] Sent: Wednesday, October 02, 2002 11:30 PM Subject: Re: mod_perl Windows 2000 install notes On Wed, 2 Oct 2002, Larry Leszczynski wrote: Just wanted to send along some info that might be useful to add as a Windows installation note in the mod_perl guide. The short story is: You may need to shut down and restart your machine after installing to get things to start working! [ ... ] That's a good point ... I'm not sure why that would be needed in this case (maybe something to do with using it as a service), but in any case, on Win32, it's not unusual to recommend a reboot. I'll add that to the docs - thanks. -- best regards, randy
Re: Error compiling mod_perl/1.27/Apache-1.3.26/Perl-5.8.0 for Native Win32
Worked. Thanks. Issac - Original Message - From: Randy Kobes [EMAIL PROTECTED] To: Issac Goldstand [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, September 23, 2002 1:37 AM Subject: Re: Error compiling mod_perl/1.27/Apache-1.3.26/Perl-5.8.0 for Native Win32 On Sun, 22 Sep 2002, Issac Goldstand wrote: I keep getting the following error when compiling mod_perl under MS-Dev-6.0 Constants.xs(158) : error C2065: 'errno' : undeclared identifier It's the only compilation error I'm stuck on, but I've been stuck for 2 weeks now... Everything is natively built for Win32 from source (read: no activestate, no binary packages) HELP!!! (I'm not going to include other files in this post, as I have no idea what is needed - it's my first production Win32 Apache/Perl system and I'm floundering a lot during compilation) Issac I don't have this problem with the cvs mod_perl sources - maybe try giving those a shot. -- best regards, randy kobes
Error compiling mod_perl/1.27/Apache-1.3.26/Perl-5.8.0 for Native Win32
I keep getting the following error when compiling mod_perl under MS-Dev-6.0 Constants.xs(158) : error C2065: 'errno' : undeclared identifier It's the only compilation error I'm stuck on, but I've been stuck for 2 weeks now... Everything is natively built for Win32 from source (read: no activestate, no binary packages) HELP!!! (I'm not going to include other files in this post, as I have no idea what is needed - it's my first production Win32 Apache/Perl system and I'm floundering a lot during compilation) Issac - Maybe in order to understand mankind, we have to look at the word itself: Mankind. Basically, it's made up of two separate words - mank and ind. What do these words mean ? It's a mystery, just as is mankind. --Unknown
Re: New mod_perl site and oddness with IE
Not just you. I have the same problem under MSIE. Issac - Original Message - From: Jim Helm [EMAIL PROTECTED] To: 'Perrin Harkins' [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, July 17, 2002 8:23 AM Subject: New mod_perl site and oddness with IE Has anyone else had problems with this particular page under IE (6.0.2600 under XP) being extremly slow to update when paging up/down? It works fine under Mozilla, and it's not a memory or cpu issue (checked with task manager already). And when I say slow, I mean a simple down cursor causes the visible portion of the page to get painted in 4 noticble steps/chunks. An older version I tracked down with Google (http://www.apache.jp/perl/guide/performance.html) which is also 300K+ doesn't have the same problem - just to show that it's not purely the raw size of the page that is the problem. Just a little feedback for the new site (which is great, btw). If it's just me with the problem, I'll go find a rock to hide under. :) --Jim A number of the most common sources of memory growth are explained in the guide: http://perl.apache.org/docs/1.0/guide/performance.html#Improving_Perform ance_by_Prevention - Perrin
Re: Idiot question: headers at the base of the page.
umm... If you send them twice. Aside from happening by doing $r-send_http_header twice (it's happened), it could be something else is automatically sending header s for you... Just an idea... Issac - Original Message - From: Rafiq Ismail (ADMIN) [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 13, 2002 12:19 AM Subject: Idiot question: headers at the base of the page. I'm doing squinty eyed coding and need someone to knock common sense into me. In the right order - as far as I can see - I have my content_type ;send_http_headers; $r-print'ed. With loads of poo in between. Under what circumstances would my page render, dumping the HTTP headers at the base? Other than their being sequentially out of order, that is. It's probably one of those look at it again in the morning questions. Someone hit me over the head with a hammer please.
Re: mod_perl/passing session information (MVC related, maybe...)
- Original Message - From: John Siracusa [EMAIL PROTECTED] To: Mod Perl Mailing List [EMAIL PROTECTED] Sent: Wednesday, June 12, 2002 8:06 PM Subject: Re: mod_perl/passing session information (MVC related, maybe...) On 6/12/02 12:57 PM, Per Einar Ellefsen wrote: But what if someone opens one of the links in a different window, and continue on the same pages as in the original window, but with different parameters? The session ID would be the same, the context id would be the same, but the params would be different, right? Well, then things break I guess... :) Maybe you could do some magic based on what browsers send as the referrer when users explicitly open a link in a new tab or window? Probably not worth it... -John Wait a second! But then what are you gaining out of your context ID? If you can't amke new contexts for new windows, when WILL you make contexts? That's coming back to the original problem of session IDs, isn't it? Issac
Re: How to proxy everything except selected urls?
Ken Miller wrote: I the past, when I've setup a proxy/app server configuration, it's always been to forward certain url's to the app server, with the rest being processed by the proxy. However, I need to turn this around. I want to pass everything to the app server, except for some url's that point at static content (images, mostly). I initially thought something like this would work: --- ProxyPass On ProxyPass / http://other.server.com:1234/ ProxyPassReverse / http://other.server.com:1234/ alias /graphics /local/path --- However, /graphics also get's proxied to the app server. This isn't what I want. I actually have had to do this myself... The solution is as follows: ProxyPass/staticstuff/! ProxyPass/ http://other.host/ ProxyPassReverse / http://other.host/ ! is a special symbol telling it not to proxy that stuff - also, I think order counts (eg, do !s first) Issac Issac
Re: Memory Leaks
I'd like to try to disagree here. I have built several file-related webapps where I have implemented virtual filesystems which require special perl modules to access the files at all. mod_perl takes care of serving the requests. If I need a restart, then I can still safely use graceful. Admittedly there are times when something could very well get screwed up, but my solution to that is to develop a better front-end server with it's own buffer so that the back-end can swiftly serve the files leaving much more idle time (in comparison to directly connecting remote client to fileserver) for backend restarts if needed. Issac Per Einar Ellefsen wrote: At 23:54 20.05.2002, Allen Day wrote: I've noticed that if I restart apache while I'm in the middle of a download (MP3 stream), after the buffer in my MP3 player runs out, it skips to the next track -- presumably because the connection was closed. This might cause a problem for you if your users are downloading big files. They might have to restart from the beginning if they didn't cache the partial download somewhere. Hmm, if you are serving big files off of mod_perl, memory leaks are the least of your problems :) That doesn't apply to Apache::MP3 of course, for which it's normal, but in no case should your mod_perl server be serving your big files. On Mon, 20 May 2002, Matt Sergeant wrote: On Monday 20 May 2002 9:30 pm, Gregory Matthews wrote: I too thought of setting a cron job to restart the server once per day in order to keep the memory fresh. In a production environment, are there any downsides to doing this, i.e., server inaccessibility, etc..? It's very rare to have a site that can't cope with just a few seconds downtime. Most users won't even notice, save for some slight delay in getting their request through. Users tend to be pretty used to trying again in this world of reliable computing.
Re: $r-args vs $r-content
Quoting Mike Melillo [EMAIL PROTECTED]: Hi, One of the fields is an image file that will be uploaded so I need to use POST requests. Is this a job for Apache::Request? The eagle book doesn't cover it much because it was experimental at the time of publishing. There's a version 1.0 out by now. That means stable as it's ever gonna get :-) I use it all the time, go for it! Issac Internet is a wonderful mechanism for making a fool of yourself in front of a very large audience. --Anonymous Moving the mouse won\'t get you into trouble... Clicking it might. --Anonymous PGP Key 0xE0FA561B - Fingerprint: 7E18 C018 D623 A57B 7F37 D902 8C84 7675 E0FA 561B
Re: full-featured online database apps
I've actually USED Ms Access for just this purpose on a few occasions... It's a lot easier to do using the GUI... Issac Adi Fairbank wrote: Does anyone know of a good customizable, user-friendly, online database application, preferably mod_perl-based? I want to migrate a small Access database to MySQL with a web interface, for added features and room for growth. Has anyone come across a good open source project or toolkit that would make this job really easy? TIA, -Adi
Re: Inline generation of error document?
Bas A.Schulte wrote: Hi all, On Thursday, April 18, 2002, at 04:58 PM, Geoffrey Young wrote: I'm a little confused (honestly). I want to handle parameter errors in a content handler. When there's a parameter missing in the URL, my handler returns HTTP_BAD_REQUEST. Now Apache sees the HTTP_BAD_REQUEST return value from my handler and generates an error (HTML) document. How can I create this document right from within my handler? I could create another handler of course and use the ErrorDocument directive to point to that but I am wondering if I can do it in my handler directly. Somehow I can't find this in the eagle book. look for $r-custom_response I did, even before my post ;) My confusion was caused by the client testing tool I used: lwp-request. Apparently, it generates HTML-formatted documents in error conditions that *do not come from the webserver*. I was doing something like this: $request-custom_response(HTTP_NOT_ACCEPTABLE,'invalid request (application identifier not found)'); return (HTTP_NOT_ACCEPTABLE); Expecting a plain text document in the response. lwp-request however creates an HTML document itself and displays that. Going in with telnet to the appropriate port etc. revealed this was actually working as advertised. One of those 'put it in quickly at the end of the day' things ;) Bas. MSIE also overwrites custom responses with built-in ones, per the response number. Netscape and Mozilla are VERY nice, though :-) Issac
Re: Help required
Murugan K wrote: Hi I am new to mod_perl and i am developing some samples using mod_perl . While developing sample , i do not want to restart the server frequently with respect to my changes. So i used the$r-header_out(Pragma, no-cache); statement not to cache the results. i seems to be not working for me . Any suggestions and how to include the directives in the server side not to cache the results. Thanks in advance With Regards K.Murugan $r-no_cache(1); Issac
Re: Help required
Issac Goldstand wrote: Murugan K wrote: Hi I am new to mod_perl and i am developing some samples using mod_perl . While developing sample , i do not want to restart the server frequently with respect to my changes. So i used the$r-header_out(Pragma, no-cache); statement not to cache the results. i seems to be not working for me . Any suggestions and how to include the directives in the server side not to cache the results. Thanks in advance With Regards K.Murugan $r-no_cache(1); Issac Actually, Per is correct. I just saw you trying to tell the browser not to caache and assumed you wanted to know how to do that. See Per's answer above. Sorry. Issac
Re: Trapping browser events
Jacob Elder wrote: On Tue, Apr 09, 2002 at 11:13:09AM +0100, Martin Harriss wrote: I am using Embperl on an intranet system to perform complex database searches and display the results. My problem is that, depending on the parameters given by the user, some searches can take some time - returning thousands of rows, and there is a danger that the user will hit the stop button, execute the Back command or even close the browser session altogether. If this happens at the wrong time, an oracle connection could have been made, but no SQL sent to it, leaving an Oracle process hanging there. I need to be able to trap these browser events, and I can then call a cleanup routine to close any database connections. I can use the Javascript onUnload event, I can't figure how to commmuncate with the Perl process. I don't remember where I saw this, but I think it might be what you're looking for. while ($dbh-fetch) { # format, print, etc. last if $r-connection-aborted; } $dbh-disconnect; Remember that if you're using Apache::DBI, your database connection will be persistant anyway, so that's not a total waste :) The above code's still a good idea (although the $dbh-disconnect will be silently ignored under Apache::DBI) as it will still free the process (or thread soon :)) which is dealing with the current response, which would otherwise still have lots of work to do for a client who's no longer interested. Issac
Re: OT: Status Page
I sometimes use pages with a text INPUT field and javascript to upate it to display status. I'm also planning on releasing a more complex version of that that uses a seperate thread under Apache 2, based on the IPC methods I use for Apache::UploadMeter... Issac Rasoul Hajikhani wrote: Folks, please excuse this off topic thread, but I thought since a lot of you work in creating a informative user experience, some of you may be able to help me. I am trying to create a status page, the kind that shows a horizental status bar that looks to work in real time and changes as events happen behind the scenes. EToys had it when confirming a cc sale, or expedia has one during the search. Can some one direct me as where would I find info in creating one of those pages. are those applets? Again, accept my sincere, humble, unreserved, and advance appology. Thanks in advance -r
Typo
Did I *really* write Apache::expat? Stupid error - Apache::compat.. Sorry :) Issac
Re: mod_perl restart vs. graceful
[snip] we could change the script to do a stop then restart, but we've seen where this method (done manually) was not 100% reliable and would sometimes require a couple of stops before we could really restart apache (never understood why this was so.) It's most likely that the stop is actually taking longer than you expect to process. Apachectl just sends the kill and doesn't wait around for everything to exit. Depending on what each of the children is doing, this can take awhile. So the better approach is not to stop again but, if start fails, wait a few seconds and try the start again. Better yet, probe for the existance of the httpd.pid file. That's basically the last thing Apache does when shutting down (unlinking it, that is). Issac
Re: Unsubscribe me please
Fran Fabrizio wrote: The info is in too many places: posted many times here (read: search archives), on the front page of perl.apache.org, in the guide (search!) and probably many other places. Not to mention in the header of every single message to this list. -Fran Well, the point was that noone seems to LOOK there :-) Issac
Re: [ANNOUNCE] Cache::Cache 1.0
DeWitt Clinton wrote: [snip] I've actually meanty to ask this for a while: I'm curious as to the auto_purge functionality of Cache::Cache - especially under mod_perl... I tend to use it a lot, but from time to time, which is basically EVERY time I look at /tmp, I notice bunches of stale entries from Cache::FileCaches - and that's on the development server. So how exactly is the auto_purge meant to be used - the documentation is very hazy on that point (sure I can patch it - but you have to explain it to me first :)), and I just got lost when looknig at the module source. So: 1)What is it meat to do 2) How should it be used 3) What about constistancy issues between processes - when will perl forget what's in the cache and not clean it up? Thanks, Issac
Re: Access right on files from CGI script
I would say you should set up suexec to let the user that Apache runs as execute those specific commands as a privaleged user. But use suexec with EXTREME care. Issac bo wrote: Hello gurus, I am notivice on Apache configuration. I wrote a CGI program, which will display some system status on the client PC's browser window. This CGI program will execute a couple of system command under /sbin with reading some system status from /proc. I have no problem to access or execute any file or binary under /www/cgi-bin but I have an access problem to other system directories like /sbin or /proc. I followed the apache configuration document and I modified directory and created .htaccess file under /sbin but it did not help. How do I allow those files accessible from the CGI script? Please help me out. Thanks in advance, Bo
Re: cvs commit: modperl/t/net/perl util.pl
A casual user won't understand that documentation... Hell, I'm not even sure I completely understand the implications of it and when to use/not use escape_html based on it... I think an example is called for, but not in the POD... Maybe in the Guide? Issac Eric Cholet wrote: --On Sunday, March 24, 2002 21:57:54 + [EMAIL PROTECTED] wrote: dougm 02/03/24 13:57:53 Modified:.Changes STATUS src/modules/perl Util.xs t/net/perl util.pl Log: Submitted by: Geoff Young [EMAIL PROTECTED] Reviewed by:dougm properly escape highbit chars in Apache::Utils::escape_html This is uncool for those of us using a non-ASCII encoding and sending out lots of characters with the 8th bit set, e.g. in a French page many accented characters will be replaced by 6-byte sequences. If I'm sending out Content-type: text/html; charset=ISO-8859-1, and calling escape_html to escape '', '' and the like, I'm going to be serving quite a lot more bytes than before this patch. However escape_html () has no clue as to what the character set is, and whether it has been correctly specified in the Content-Type. It has also be mentionned here that escape_html is only valid for single-byte encodings. So this patch does the right thing to escape the odd 8 bit char in a mostly ASCII output, but users of other charsets should be warned not to use it. I use HTML::Entities::encode($_[0], '') myself. Therefore I propose a doc patch to clear this up: Index: Util.pm === RCS file: /home/cvs/modperl/Util/Util.pm,v retrieving revision 1.8 diff -u -r1.8 Util.pm --- Util.pm4 Mar 2000 20:55:47 -1.8 +++ Util.pm25 Mar 2002 18:19:37 - @@ -68,6 +68,13 @@ my $esc = Apache::Util::escape_html($html); +This function is unaware of its argument's character set and encoding. +It assumes a single-byte encoding and escapes all characters with the +8th bit set. Do not use it with multi-byte encodings such as utf8. +When using a single byte non-ASCII encoding such as ISO-8859-1, +consider specifying the character set in the Content-Type header, +and using HTML::Entities to avoid unnecessary escaping. + =item escape_uri This function replaces all unsafe characters in the $string with their -- Eric Cholet - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to identify an interrupted downloads?
F.Xavier Noria wrote: I would like to know whether in the server side one can figure out if a user has completed the download of a known file. Would bytes_sent() give the actual number of bytes sent if the download gets interrumpted by the client? Would yo know a better approach if not? -- fxn If you send the file in chunks, I suppose you can use $c-aborted every so often to check... Even if not, you can still use $c-aborted at the end to check if the connection's still there. That ought to tell you, although I'm not sure if that it's a fail-saif solution... Issac
Re: Can't open perl script -spi.bak
Garth Winter Webb wrote: On Fri, 2002-03-22 at 12:57, Robert Landrum wrote: That's is very weird, because this code doesn't seem to work: perl -e 'system(perl, -e1) == 0 or die oops' Actually, that's not all that weird. Most shells take care of stripping out garbage before setting the argument list. Since system(LIST) doesn't use the shell, it's passing perl the literal -e1 which perl won't recognize as a command line option (and correctly so in my opinion). Actually this isn't standard behavior. I can't think of a situation where I would want to use system to concatanate a string for me rather than interpreting the string as an argument and act accordingly. If you check 'perldoc -f system', this is exactly what system is supposed to do when given a program name and a list of arguments, so it looks like 'systetm' may be buggy in the win32 version of perl G I think so too. I,m no Perl guru, but I know from my personal experiance that it works fine under unix and cygwin, but I _always_ have had to manually do this under normal Win32 (I know, I know, I never submitted a patch... I guess the reason was because I never [finally] compiled mod_perl for Win32 and had enough strength left to diff the Makefiles... :-( ) Issac
Re: mod_perl developers cookbook... a kitchen hand asks... doh!
You must have taken this subroutine out of context. There are a certain number of things which must appear for an Apache handler to work: package Apache::Whatever; You need to have that line to uniquely identify your module. If you use the name Apache::Whatever, your handler must be named Whatever.pm and be placed in your INC search path under Apache/ This is probably the reason for your number 2 problem: you must have used the same package name twice. Or not used a package name at all. Actually, this isn't true.. You don't *have* to use the Apache namespace... You can just as easily call it Foo::Bar if you'd like... I don't mean to come across as being an extremist on this issue, but we were all newbies once, and I know that as a newbie, *I* would take anything written here as the authorative answer, so I didn't want anyone here to be misled... Issac
Re: Non-web use for Apache/mod_perl
Bas A.Schulte wrote: Hi, I've been meaning to write an article about how I used Apache/mod_perl to implement a mobile SMS application platform as it demonstrates use of Apache/mod_perl outside the Web realm, something I hadn't seen so far. Time constraints (as always) have prevented me from doing this properly, however, I'll try to give a short description of the system. The goal kinda is to see if others are using Apache/mod_perl in a similar way to share experiences, discuss issues that arise or discuss alternatives (I'd love someone to tell me I'm an idiot for handling all this lowlevel stuff myself and move to J2EE/java at once, if he can convince me I could have implemented this with the same budget and time frame). [snip] I actually implemented a similar system, although it's not SMS specific. Basically, I have a central system in Apache/mod_perl. The eventual design is for full I/O in many protocols, including HTTP, SMTP, FTP and a handful of other protocols. So far the output is pretty much ready, and I think I'm going to wait for Apache 2 before I do the inputs. I _could_ write mod_perl handlers to understand other protocols, but Apache 2 is being designed around this, as far as I understand, so I'm going to do that around Apache 2 (as soon as I get off my ass and learn the new API :-)) Issac
Re: checking a site for ssl cert?
Kirk Rogers wrote: hello, kind of a long shot but does anyone know if its possible to check a site for ssl certificate information from a mod perl handler or perl script? thanks k it's all exported into %ENV if you do: SSLOptions + StdEnvVars Issac
Re: [OT] checking a site for ssl cert?
IT's a feature of mod_ssl, not of mod_perl, so the answer is no, it does not need another module to be accessed by standalone perl. Issac Kirk Rogers wrote: What about a standalone CGI script? Is there some module or package I need acquire or is it also exported into %ENV? Thanks, K -Original Message- From: Issac Goldstand [mailto:[EMAIL PROTECTED]] Sent: Monday, March 18, 2002 7:16 AM To: [EMAIL PROTECTED] Cc: modperl Subject: Re: checking a site for ssl cert? Kirk Rogers wrote: hello, kind of a long shot but does anyone know if its possible to check a site for ssl certificate information from a mod perl handler or perl script? thanks k it's all exported into %ENV if you do: SSLOptions + StdEnvVars Issac
Re: mod_perl does not see multipart POSTs
I'm not sure I understand what you're asking... Apache, on it's own, does not support any internal parsing of POST data, multipart or otherwise, so why should mod_perl? For this, we have the Apache::Request library in mod_perl (Which is the mod_perl interface to the libapreq library for Apache's C API). libapreq supports multipart/form-data, even without a file upload... Issac Vuillemot, Ward W wrote: All, I am still trying to figure out why my setup of mod_perl does not have multipart POSTs. I rebooted my machine, and found that, whereas I reported before mod_perl would try to reload the page (which it should not but send out a text/plain attachment for download), it appears the script (running as a perl handler) does not see any of the multipart POST. Vanilla posts are not a problem, though. Even if the information being sent via multipart is _not_ a file to upload to the server, the information is lost in transit. Here is what is odd. The same scripts/modules unmodified and running as perl_cgi are okay. Multipart forms allow me to upload files, et cetera. In short, I am confident the problem is not with my programming. I am using the code snippet, POST2GET, to capture the one-time read of POST and storing as if it was retrieved via GET. Any ideas how to debug this? I REALLY REALLY would love some feedback. I would love to think that all my effort to stay away from M$ ASP are worth it -- esp. when I stand up to defend Perl, Apache, and mod_perl in an environment that is decidely M$-bent. Thanks! Ward
Re: where is libperl.so.1?
so if it's statically compiled, why are you using LoadModule? Issac J S wrote: Hi there, I've installed an apache build I did onto a Solaris 2.6 box, and when I try to start it I get the following error message: ld.so.1: /opt/apache_1.3.22/bin/httpd: fatal: libperl.so.1: open failed: No such file or directory Killed I can't find libperl.so on either the original box, or the box I'm installing to. Can anyone help me out please? Thanks for any help, JS. _ Chat with friends online, try MSN Messenger: http://messenger.msn.com
Re: where is libperl.so.1?
*looks again* oops... I didn't look close enough at tyhe error, assumed it couldn't find mod_perl.so *hits himself in head*. Did you install perl yourself? If so, you may want to make sure that the directory containing the libperl.so file (usually TOP_LEVEL/libexec/) is included in the file /etc/ld.so.conf and then run ldconfig as root. That might help... Issac J S wrote: Not sure I understand your answer. I'm not using LoadModule. JS. so if it's statically compiled, why are you using LoadModule? Issac J S wrote: Hi there, I've installed an apache build I did onto a Solaris 2.6 box, and when I try to start it I get the following error message: ld.so.1: /opt/apache_1.3.22/bin/httpd: fatal: libperl.so.1: open failed: No such file or directory Killed I can't find libperl.so on either the original box, or the box I'm installing to. Can anyone help me out please? Thanks for any help, JS.
Re: problems with $r-status('OK')
You don't want to do that... You want to do this: use Apache::Constants qw(:common); and then $r-status(OK); # (no quotes) Issac - Original Message - From: clayton cottingham [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, March 04, 2002 6:47 PM Subject: problems with $r-status('OK') hello: im using Apache/1.3.12 and mod_perl/1.24 every time i use the $r-status('OK'); it gives me this error Argument OK isn't numeric in subroutine entry has anyone come accross this before? thanks
[ANNOUNCE] Apache::GD::Thumbnail-0.03
Changes: Cache control headers are returned to the browser BEFORE the thumbnail is generated now (why I didn't do this originally is beyond me :-)) The uploaded file Apache-GD-Thumbnail-003targz has entered CPAN as file: $CPAN/authors/id/I/IS/ISAAC/Apache-GD-Thumbnail-003targz size: 2589 bytes md5: cecadf3fdfa04f6aa50d94243a49ed0e
Re: another article on perl.com
Can I humbly suggest some articles that would lead to a guide for mod_perl 2? I'm actually a bit embarrassed to admit that this is more out of personal laziness than real need... I've just been so swamped lately, I've never gotten around to looking at the API for Apache 2.0, and therefore have no idea what to expect :-) But it's still a useful thing to have... Issac - Original Message - From: Stas Bekman [EMAIL PROTECTED] To: Geoffrey Young [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, February 27, 2002 5:34 PM Subject: Re: another article on perl.com Geoffrey Young wrote: it seems mod_perl is gathering some serious momentum lately... in addition to Paul's Preventing Cross-site Scripting Attacks article last week http://www.perl.com/pub/a/2002/02/20/css.html we have a new article by Stas, Why mod_perl? http://perl.com/pub/a/2002/02/26/whatismodperl.html so, mod_perl is front and center on perl.com this week. nice work everyone! Yeah, I'm trying to push mod_perl everywhere I can. publicity never hurts. There is a bunch of articles I'm republishing at apacheweek.com. Unfortunately apachetoday.com doesn't publish anymore (but the articles are still available if you search the site) and perlmonth.com has gone ;( At this moment I'm poking Dr.Dobb's J. and a few others. If you know of other prospective magazines looking for articles please let me know. I've about 18 articles in stock and growing. If you want to publish yourself, go ahead help yourself with the guide (reuse/reuse/reuse/...), we need many articles in all possibly relevant publications. Soon I will start working on the new articles for 2.0, but not before the new site is released. _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
Re: another article on perl.com
[snip] Just to assure you, 99.9% of the old code will run as is. Though there are many new things ;) Actually, that's what I'm interested in... I've mentioned on the IRC room on a number of occasions, that I'd like to try to use the new threaded interface to try to design some new innovative types of WebApps, based on IPC or shared memory pools... Every once in a while I decide to start looking into it, and then just as quickly put off delving into the Apache 2.0 API... Oh well... It can wait, I suppose :) Issac
Re: Status of mod_perl 2.0
Which gives me another nice idea for articles... How about some pointers in thread safety with Apache/Perl... What you sould and should not do? Issac - Original Message - From: Stas Bekman [EMAIL PROTECTED] To: Jeff Stuart [EMAIL PROTECTED] Cc: Mod Perl Devel List [EMAIL PROTECTED]; Mod perl mailing list [EMAIL PROTECTED] Sent: Wednesday, February 27, 2002 8:00 PM Subject: Re: Status of mod_perl 2.0 Jeff Stuart wrote: Question? What is the status of mod_perl 2.0? Also, is it working with/playing with Apache 2.0 at all? Tell me what's the status of apache 2.0 and I'll tell you the status of mod_perl 2.0 :) But seriously mod_perl 2.0 will be ready about the time apache 2.0 (i.e. httpd-2.0) gets released. You can start playing with it already. I've successfully run my singlesheaven.com code using mod_perl 2.0 a few months ago. And there are many tests, so you can see what works and what not. Registry is almost completed, a few thread-safety issues unresolved (e.g. chdir() in the threaded env). If you plan on adding a testing platform for you product, make sure to use the Apache::Test framework from 2.0 distro, which rocks! _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com http://singlesheaven.com http://perl.apache.org http://perlmonth.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: file globbing question
It occurred to me that using a scheme like this, it might be possible to help improve mod_perl's popularity... Or, at least, the popularity of Toolkits built under mod_perl... Using Files (or the Apache::MIMEMapper module), makes mod_perl a bit more ISP friendly, as it's a lot easier for users to add code to their files... Maybe using Embperl or something like that inside pages... Anyway, it's just a thought... Issac Geoffrey Young wrote: Cees Hek wrote: On Wed, 2002-02-20 at 13:27, John Stauffacher wrote: All, I am a bit confused as to what httpd.conf directives need to be used in order to get apache to execute a PerlHandler when it encounters a certain file type. What I want to do: Execute a handler whenever a *.qw file is accessed. The same handler whether or not the file exists and not look for the file. So the user makes the request: get /somewhere/my.qw and gets the response moo. Then they request /other/place/boo.qw and gets the response moo. I have tried using a Files directive, but it envokes the handler, then looks for the file and throws a 404. Any ideas? The Files directive is the right way to go. Are you sure you are returning OK in your Handler? If you return something else (like DECLINED) then Apache will take over the request and handle it in the default manner (ie look up the file). Returning OK lets Apache know that the request was dealt with appropriately and it can move on to the next phase. another alternative is something like Apache::MIMEMapper... http://www.modperlcookbook.org/download/Apache-MIMEMapper-0.10.tar.gz which expands the AddHandler directive to make it a bit more mod_perl friendly. so, instead of using Files (which is perfectly legitimate) you can instead simply use AddHandler My::Module .qw and Apache will use My::Module::handler() for the content-generation phase. all the stuff Cees said it true, though - you still need to make sure your handler returns OK and follow the other handler rules. HTH --Geoff
Re: Image Magick Alternatives?
Ooh!!! Ooh!!! *jumps to publicize his module in a desperate attempt to find someone who might actually NEED it* [So I'm shameless... So what? :-)] Apache::GD::Thumbnail - CPAN friendly. It needs, however, GD, which means that instead of using Perl Magick for the sole use of generating thumbnails, you'll be using GD for the sole purpose of generating thumbnails... Also, it only has jpeg support currently... But it _is_ easy :-) Issac Jonathan M. Hollin wrote: The WYPUG migration from Win2K to Linux is progressing very nicely. However, despite my best efforts, I can't get Perl Magick to work (Image::Magick compiled successfully and without problems). All I use Perl Magick for is generating thumbnails (which seems like a waste anyway). So, is there an alternative - a module that will take an image (gif/jpeg) and generate a thumbnail from it? I have searched CPAN but haven't noticed anything suitable. If not, is there anyone who would be willing to help me install Perl Magick properly? Kindest regards, Jonathan M. Hollin - WYPUG Co-ordinator West Yorkshire Perl User Group http://wypug.pm.org/
Re: mod_perl cookbook ... next steps
[EMAIL PROTECTED] wrote: [snip] As I need information between the stage of life, I would use $r-notes to communicate down the cycle. But then again, if I have some data tied to the session (I use Apache::Session), how can I give it to the PerlHandler. Is $r-notes proofed for any export, object or blessing behavior? I think $r-pnotes should work fine with this... But I'm not positive... Other than that, it sounds fine... Except that usually youll authenticate the user in PerlAuthenHandler and use AuthzHandler to decide whether or not to let him do whatever he's trying to do... The Eagle book had some nice explanations of this... Issac
Re: Cookie as session store
Perrin Harkins wrote: When the cookie is recovered, I simply decode, uncompress, thaw, check the digest, and thaw the inner object. It's really a good idea to do this even when the cookie is nothing but a session ID. A standard module for this like the one Jay mentioned would definitely be nice. I dunno... That sounds lie a LOT of overhead for just a session ID that's gonna result in server lookups too... Issac
Re: mod_perl + UNIVERSAL
Jean-Michel Hiver wrote: [snip] A list of things I've noticed: * If you have two *different* modules which have the same name, then either one, or the other is loaded in memory, never both. This is dead annoying. I think Perl standard modules + CPAN modules should be shared, other modules which are specific to a given script should not. And who's to say that a custom module that you write can't end up on CPAN??? Or even as a Standard module? There may be ways of fiddling with @INC to do what you want, but it would be much easier if you, the developer, took care to make unique namespaces for your different projects... * Global variables should be reinitialized on each request. Or at least if we want them to be persistent we do not want them to be shared with different scripts on different virtual hosts! If you want them reset each time, then reset them to undef manually. The alternative is having Apache reload the entire module from scratch on every request - and then you may as well be using mod_cgi.. [snip] * Despite numerous heroic efforts, HTTP HEAD requests are still screwed! Apache::Registry serves HEAD + Body, and Geoffrey's Apache::HEADRegistry doesn't work with redirects and 404's (I get like two headers and 3 bodies for 404's. Now that's verbose :-)) No real mod_perl problem on that - that's a problem (or maybe intentional functionality?) in Apache::Registry and Apache::HEADRegistry... These are the - painful - issues I discovered during the last 6 month of intensive mod_perl coding. I hope they'll be fixed at some point because mod_perl could be so popular if they were! I dunno... I think that the main reason mod_perl isn't as popular as mod_php is because PHP is SSI based, making it more appetizing to lots of developers who don't have such good access to the server, or who don't want to understand the internals of Apache module writing (remember that that's the real point of mod_perl: to write Apache modules in Perl instead of C), whereas mod_perl means pre-writing modules and having to reload the server (or use a top-heavy module like Apache::StatInc) every time you want to change your code. Of course, that's the power of mod_perl over mod_php. And I know that personally, it's why I use it. As to the non-ISP friendliness disadvantage, that's a critical issue, but I think it's being re-analyzed for mod_perl 2.0 Just my two agorot (a bit less than $0.005 now, I think, although due to that the smallest currency here is actually _5_ agorot :-) ) Issac
Re: mod_perl + UNIVERSAL
Jean-Michel Hiver wrote: * If you have two *different* modules which have the same name, then either one, or the other is loaded in memory, never both. This is dead annoying. I think Perl standard modules + CPAN modules should be shared, other modules which are specific to a given script should not. And who's to say that a custom module that you write can't end up on CPAN??? Or even as a Standard module? There may be ways of fiddling with @INC to do what you want, but it would be much easier if you, the developer, took care to make unique namespaces for your different projects... Consider this. I develop a piece of software in Perl which is quite big. Therefore it's split into a horde of modules. Now do these modules changes between versions? Yes (bug fixes, improvements, API changes, etc). Do the modules name change? Nope! As a result I had to amend the software so that it can run multiple websites. But then if there is a need to change the logic of just one site I can't just go and change one module because it would change it for everything else. In other words it'd be nice to be able to run different versions of the same software for different websites on the same server (via virtual hosts). And that doesn't work. TMTOWTDI: Make all of your global (base) functionality wrapped into some OO Perl module, and then if you need to change specific behavior for certain apps, you can easily subclass it. If the main functionality has to be changed, change the parent object; if it has to be changed for a specific web-app, dump it into the inheritted class. That's one solution, and I'm sure there are others... Besides this: with @INC to do what you want, but it would be much easier if you, the developer, took care to make unique namespaces for your different projects... is highly bullshit. I am not the only developer on the planet. For instance there is a CPAN module called HTML::Tree. But there is also another module on the web called HTML_Tree, which installs itself as HTML::Tree. The developer does not want to rename his module (I understand that). Even if I install / compile the module locally, mod_perl is going to screw everything up! Great! That's the developer's fault. I'm sorry. But that's why you're _supposed_ to check in with [EMAIL PROTECTED] before deciding on your modules namespaces. Just because _another_ developer is using a taken namespace doesn't make it right enough that special pains have to be made to get around it. And if they _did_, that would be a Perl problem, not a mod_perl related issue! For example, how would you get the CPAN Html::Tree to work in the same script as this other HTML::Tree? You couldn't, because the Perl interpreter wouldn't know what to do with it. Same here! * Global variables should be reinitialized on each request. Or at least if we want them to be persistent we do not want them to be shared with different scripts on different virtual hosts! If you want them reset each time, then reset them to undef manually. I think this is wrong. Variables should be reinitialized by default, or persistent if specified otherwise in some config file. What if I _want_ a variable that stays consistant across a specific child process' lifetime? Right now, a way _exists_ of resetting variables, but how would you propose to keep them static if your idea was implemented? * Despite numerous heroic efforts, HTTP HEAD requests are still screwed! Apache::Registry serves HEAD + Body, and Geoffrey's Apache::HEADRegistry doesn't work with redirects and 404's (I get like two headers and 3 bodies for 404's. Now that's verbose :-)) No real mod_perl problem on that - that's a problem (or maybe intentional functionality?) in Apache::Registry and Apache::HEADRegistry... intentional functionality. I though that bugs were called features, but this is even better. I'll have to remember this one :- ;-) don't want to understand the internals of Apache module writing (remember that that's the real point of mod_perl: to write Apache modules in Perl instead of C), whereas mod_perl means pre-writing True, however the real point of Apache::Registry is to run unaltered CGI scripts under mod_perl and it just doesn't work properly does it? No. That's Apache::PerlRun. Apache::Registry usually needs some tweaking to run properly. There's plenty of information about that in the guide under the HUGE portion devoted to CGI_to_mod_perl_porting (or even in the special manpage under the same name). Of course, that's the power of mod_perl over mod_php. And I know that personally, it's why I use it. As to the non-ISP friendliness disadvantage, that's a critical issue, but I think it's being re-analyzed for mod_perl 2.0 Do you know where to find mod_perl 2 related info on the web? I'd be interested in knowing what's it gonna be. Not really sure. I asked about that and got the current state of the mod_perl 2 docs from CVS, but I, too,
[ANNOUNCE] Apache::UploadMeter-0.21
The URL http://prdownloads.sourceforge.net/apache-umeter/Apache-UploadMeter-0.21.tar.gz has entered CPAN as file: $CPAN/authors/id/I/IS/ISAAC/Apache-UploadMeter-0.21.tar.gz size: 7293 bytes md5: c2b830b7a6204d40050946c5d84c9583 Also available on SourceForge (see above URL). SourceForge project homepage http://sourceforge.net/projects/apache-umeter Issac Release Notes ChangeLog: *Notes:* The following Perl libraries are now required: Format::Number Format::Date I hope to remove these dependancies as soon as I can get formatting done in XSL *Changes:* UploadMeter_port.patch: Adds the port number to the generated Refresh URL UploadMeter_finished.patch: Stops the Meter from Refreshing endlessly when the upload is complete UploadMeter_starttime.patch: Adds the time the upload started to the output to allow upload rate calculations (Patches submitted by Cees Hek ) ### XSLT + XML Patch submitted by Cees Hek Started migrating internal calculations to XSLT Updated Schema (switch from DTD to xsd) ### 0.21 : Feb 3, 2002 - Prebundled basic skin on sourceforge. Migrate from DTD to schema. Time/Date formatting currently server-side.
Re: New mod_perl Logo
Jay Lawrence wrote: I looked at some of the candidates at http://wypug.digital-word.com/mod_perl/ must confess I am partial to http://wypug.digital-word.com/mod_perl/logos/louise_bramald_1.jpg so far Thinking camels for Perl and feathers for Apache putting them together all I could see is flying camels - is that too close to flaming logos? That's my 0.02CAD which is substantially less than 0.02USD... ;-) J I really don't want to see this topic going out of control, but I had to add something here: didn't we have a discussion about this months ago? I seem to remember an idea of a camel with a headband with the Apache feather... I'm sure that's not my own idea. Issac
Re: performance coding project? (was: Re: When to cache)
Ah yes, but don't forget that to get this speed, you are sacrificing memory. You now have another locally scoped variable for perl to keep track of, which increases memory usage and general overhead (allocation and garbage collection). Now, those, too, are insignificant with one use, but the significance will probably rise with the speed gain as you use these techniques more often... Issac Stas Bekman wrote: Rob Nagler wrote: Perrin Harkins writes: Here's a fun example of a design flaw. It is a performance test sent to another list. The author happened to work for one of our competitors. :-) That may well be the problem. Building giant strings using .= can be incredibly slow; Perl has to reallocate and copy the string for each append operation. Performance would likely improve in most situations if an array were used as a buffer, instead. Push new strings onto the array instead of appending them to a string. #!/usr/bin/perl -w ### Append.bench ### use Benchmark; sub R () { 50 } sub Q () { 100 } @array = ( x R) x Q; sub Append { my $str = ; map { $str .= $_ } @array; } sub Push { my @temp; map { push @temp, $_ } @array; my $str = join , @temp; } timethese($ARGV[0], { append = \Append, push = \Push }); Such a simple piece of code, yet the conclusion is incorrect. The problem is in the use of map instead of foreach for the performance test iterations. The result of Append is an array of whose length is Q and whose elements grow from R to R * Q. Change the map to a foreach and you'll see that push/join is much slower than .=. Return a string reference from Append. It saves a copy. If this is the page, you'll see a significant improvement in performance. Interestingly, this couldn't be the problem, because the hypothesis is incorrect. The incorrect test just validated something that was faulty to begin with. This brings up you can't talk about it unless you can measure it. Use a profiler on the actual code. Add performance stats in your code. For example, we encapsulate all DBI accesses and accumulate the time spent in DBI on any request. We also track the time we spend processing the entire request. While we are at this topic, I want to suggest a new project. I was planning to start working on it long time ago, but other things always took over. The perl.apache.org/guide/performance.html and a whole bunch of performance chaptes in the upcoming modperl book have a lot of benchmarks, comparing various coding techniques. Such as the example you've provided. The benchmarks are doing both pure Perl and mod_perl specific code (which requires running Apache, a perfect job for the new Apache::Test framework.) Now throw in the various techniques from 'Effective Perl' book and voila you have a great project to learn from. Also remember that on varous platforms and various Perl versions the benchmark results will differ, sometimes very significantly. I even have a name for the project: Speedy Code Habits :) The point is that I want to develop a coding style which tries hard to do early premature optimizations. Let me give you an example of what I mean. Tell me what's faster: if (ref $b eq 'ARRAY'){ $a = 1; } elsif (ref $b eq 'HASH'){ $a = 1; } or: my $ref = ref $b; if ($ref eq 'ARRAY'){ $a = 1; } elsif ($ref eq 'HASH'){ $a = 1; } Sure, the win can be very little, but it ads up as your code base's size grows. Give you a similar example: if ($a-lookup eq 'ARRAY'){ $a = 1; } elsif ($a-lookup eq 'HASH'){ $a = 1; } or my $lookup = $a-lookup; if ($lookup eq 'ARRAY'){ $a = 1; } elsif ($lookup eq 'HASH'){ $a = 1; } now throw in sub attributes and re-run the test again. add examples of map vs for. add examples of method lookup vs. procedures add examples of concat vs. list vs. other stuff from the guide. mod_perl specific examples from the guide/book ($r-args vs Apache::Request::param, etc) If you understand where I try to take you, help me to pull this project off and I think in a long run we can benefit a lot. This goes along with the Apache::Benchmark project I think (which is yet another thing I want to start...), probably could have these two ideas put together. _
RFC: Thumbnail generator
I recently decided that Apache::Gallery is really nice if you want to sit down and start fiddling with templates, but that I needed to make a quick-easy version for myself. The design is to be extremely simple, and is divided into two seperate modules. The first is an on-the-fly thumbnail generator (currently supports only jpeg), which is just a spiced up implementation of Image::GD::Thumbnail. The second is a directory index generator, which displays each file name and a link to the picture, using URIs to the on-the-fly thumbnail generator to show the previews. Ideas are welcome, but my main questions are: 1) Put it on CPAN? 2) Namespace? Issac
Re: Thumbnail generator
Robert Landrum wrote: At 4:13 PM +0100 1/21/02, Gerald Richter wrote: I recently decided that Apache::Gallery is really nice if you want to sit down and start fiddling with templates, but that I needed to make a quick-easy version for myself. The design is to be extremely simple, and is divided into two seperate modules. The first is an on-the-fly thumbnail generator (currently supports only jpeg), which is just a spiced up implementation of Image::GD::Thumbnail. You may want to take a look at Apache::ImageMagick (if you not already have). It's let's you create thumbnails very easy (just two parameters pic.xxx/scale?geometry=100x100) and ImageMagick supports over 80 different formats. It also handles conversion from 4 color pictures to RGB for your thumbnails and many other things, if you need them. ImageMagick is way too slow for use in a production system. Especially if your resizing large images into thumbnails. I suggest sacrificing space for speed and pre-generating all your thumbnails. Most of the time libjpeg will do everything you need, including scaling. I suggestion GD with Jpeg support or Inline.pm/C/libjpeg for real time conversion of jpegs. There are probably other faster libs out there, and I'm just citing the ones I've heard about or used in the past. Rob -- When I used a Mac, they laughed because I had no command prompt. When I used Linux, they laughed because I had no GUI. Part of the idea here is to do everything on-the-fly so that changes on the filesystem (in terms of adding/removing pictures) will IMMEDIATELY take effect (including caching, etc) on the web interface. That means no thumbnails to start with. Issac
[ANNOUNCE] Apache::GD::Thumbnail-0.01
The uploaded file Apache-GD-Thumbnail-0.01.tar.gz has entered CPAN as file: $CPAN/authors/id/I/IS/ISAAC/Apache-GD-Thumbnail-0.01.tar.gz size: 2428 bytes md5: 5c46eca45e213e98a2d2388b7a6fcb8a NAME Apache::GD::Thumbnail - Apache module which generates on- the-fly thumbnails using GD and libjpeg SYNOPSIS Location /pics/thumbnails SetHandler perl-handler PerlHandler Apache::GD::Thumbnail PerlSetVar ThumbnailMaxSize 75 PerlSetVar ThumbnailBaseDir /usr/local/httpd/htdocs/pics /Location DESCRIPTION Just what it looks like: creates on-the-fly thumbnails of a jpeg image. There are two optional configuration direc tives. · ThumbnailMaxSize Sets the maximum number of pixels to be used in the thumbnail for length or width (whichever is larger) · ThumbnailBaseDir Sets the directory that contains the images to be thumbnailed. Defaults to .. if not set. AUTHOR AND COPYRIGHT Copyright (c) 2002 Issac Goldstand - All rights reserved. This library is free software. It can be redistributed and/or modified under the same terms as Perl itself.
[ANNOUNCE] Apache::UploadMeter-0.17
The URL http://prdownloads.sourceforge.net/apache-umeter/Apache-UploadMeter-0.17.tar.gz has entered CPAN as file: $CPAN/authors/id/I/IS/ISAAC/Apache-UploadMeter-0.17.tar.gz size: 6182 bytes md5: 184038fd7ce8255c1591f0ec4f5eff25 No action is required on your part Also available on SourceForge (see above URL). SourceForge project homepage http://sourceforge.net/projects/apache-umeter Issac
Re: [ANNOUNCE] Apache::UploadMeter-0.15
Eventually, yes, but unfortunately not yet. Until the configuration for _one_ meter isn't 100% stable, I'm not going to set up multiple meters. But it is the first thing on the ToDo list after it becomes stable. Issac eCap wrote: So if I have two different html forms that perform uploads, can I define two different forms in the httpd.conf file? -Original Message- *From:* Issac Goldstand [mailto:[EMAIL PROTECTED]] *Sent:* Monday, January 07, 2002 10:08 PM *To:* [EMAIL PROTECTED] *Subject:* [ANNOUNCE] Apache::UploadMeter-0.15
[ANNOUNCE] Apache::UploadMeter-0.15
Finally, after a month of being bogged down on [EMAIL PROTECTED], the barriers have being cleared and Apache::UploadMeter's hit CPAN! The URL http://telia.dl.sourceforge.net/apache-umeter/Apache-UploadMeter-0.15.tar.gzhas entered CPAN as file: $CPAN/authors/id/I/IS/ISAAC/Apache-UploadMeter-0.15.tar.gz size: 5781 bytes md5: 635457cab775fa4c169d74180b9219f6No action is required on your partRequest entered by: ISAAC (Isaac Goldstand)Request entered on: Tue, 08 Jan 2002 06:04:40 GMTRequest completed: Tue, 08 Jan 2002 06:05:08 GMT Issac
Smart Web Apps with IPC and threading
Since I started work on Apache::UploadMeter, I've started to look into the possibilities of creating smarter and more user-interactive webapps using IPC between webserver processes. Basically, the way this works is that you can open a magic URL at form submission/link-click time, which can be tied to a slave server, which can be instructed to provide any type of realtime feedback that you'd like - in the case of Apache::UploadMeter, the magic URL displays a snapshot of the upload process and reloads itself every X seconds, but form submissions can be done with this too. The problem is that under Apache 1.3, that wouldn't work well due to the fact that each child process is just that: a standalone process. And that's going to tie up a lot of servers and child processes, and basically make a big mess. However, under the Apache 2 threading MPM, this wouldn't seem to be a problem - especially if there is good shared resources between the threads. And mod_perl shouldn't be a problem either, as long as shared perl interpreters are used... So basically, I'd like to know if other people have any ideas that they'd be interested in sharing, and just basically see if we could look at some of the new ways of designing webapps like this. Looking forward to getting feedback, Issac PS. I posted to this list because I'd like to hear from mod_perl users - not just developers or advocates - but if this gets way OT, let's move this thread to the appropriate place.
Re: HTTP file uploads with mod_accel
I use it with uploads and it all works fine. What I still haven't tested is the UPLOAD_HOOK functionality of Apache::Request under it, but I'll get around to that shortly. Issac Philip Mak wrote: Has anyone been using mod_accel on a website that has HTTP file uploads? I'm having trouble getting file uploads to work with Internet Explorer 5.5, Netscape 4.7, or Opera 6 through mod_accel 1.0.10. If I access the backend Apache directly, it works. I can upload a 1491 byte file, but I can't upload a 13643 byte file (no matter which web browser I use). When I try to upload the 13643 byte file through mod_accel, the browser just keeps acting like it's loading the page and never finishes. I'm guessing there might be a buffering problem, but I'm not sure how to go about finding the cause of the problem and fixing it... any suggestions?
Re: Fixed (Re: HTTP file uploads with mod_accel)
Igor, DOES mod_accel buffer the uploads as they come through? That feature would be critical for compatibility with libapreq's UPLOAD_HOOK, which I'm finding lots of nice uses for... Issac - Original Message - From: Igor Sysoev [EMAIL PROTECTED] To: Philip Mak [EMAIL PROTECTED] Cc: Issac Goldstand [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, January 06, 2002 6:56 PM Subject: Re: Fixed (Re: HTTP file uploads with mod_accel) On Sun, 6 Jan 2002, Philip Mak wrote: Never mind, I'm an idiot. I just took a look at the error_log of my frontend and the problem became clear. [Sun Jan 6 09:42:04 2002] [error] [client 206.173.36.189] (13)Permission denied: accel: can't create tempfile /usr/local/apache/cache/tmpFtYxlf My fault. I've just fixed it and in next release mod_accel would return 500 in this case. Igor Sysoev
[ANNOUNCE (sort of)] Apache::UploadMeter-0.15
Since I'm still waiting after a month for a PAUSE account (apparantly there's some major hold-up at [EMAIL PROTECTED]), I've released Apache::UploadMeter on sourceforge.net The project homepage is http://sourceforge.net/projects/apache-umeter Version 0.15 is out, but it's still Alpha, since I'm still having trouble getting the configuration to work properly, but due to the fact that I haven't had the time to give it proper attention, I decided to release it anyway, and if anyone wants to patch it for me, I'll make a working Beta release of it. Questions/Comments welcome. Issac