Re: OT: use problem (need interpolation)
From: Jerrad Pierce [EMAIL PROTECTED] Is there anyway to fool perl into letting you do a: use Foo ($bar, 'baz', 'quux'); 'use' lines are executed very early on during script loading: use Foo x y z is roughly equivalent to BEGIN { require Foo; import Foo x y z } so $bar is likely to be undefined unless you also set it in a BEGIN section, eg BEGIN { $bar = } use Foo ($bar, 'baz', 'quux'); or use 'require' instead of 'use' if you can tolerate the module being loaded late, eg $bar = ; require Foo; import Foo ($bar, 'baz', 'quux'); * Dave Mitchell, Operations Manager, * Fretwell-Downing Facilities Ltd, UK. [EMAIL PROTECTED] * Tel: +44 114 281 6113.The usual disclaimers * * Standards (n). Battle insignia or tribal totems
RE: Question about $sth-finish;
Matt Sergeant [EMAIL PROTECTED] wrote: This can be demonstrated with a very simple object class with a DESTROY method. There's a message somewhere in the p5p archives about this from me. That's http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-03/msg00604.html to save anyone else having to look :-)
Re: how to check for ssl.
I've got a section of our site where I want to force the user to connect via ssl. Inside of mod_perl, is there a parameter I can grab to see whether the connection is ssl or not? Or a way to get the port number? If there isnt a special reason otherwise, why not just put a redirect in http.conf, eg VirtualHost _default_:80 . Redirect /secure https://www.mysite.com/secure /VirtualHost Then any attempts to access something under http://www.mysite.com/secure will get a redirect to same page but using https.
Re: Interfacing from Apache to Access
From: Eric Strovink [EMAIL PROTECTED] wrote: Write a simple socket interface to connect Apache Perl to your existing Windoze Perl script (which you'll hack to set up as a simple server). Invent your own protocol. Locking issues will come up, but you can manage this yourself with a little creativity. There are pretty good examples of how to do simple socket things with Perl, in the Perl books. This has already been done! See DBD::Proxy. This allows you to run a little perl Program on the machine with the Access DB which acts as a proxy DB server, then the client uses DBD::Proxy (as opposed to DBD::Oracle or whatever) to access the database. Never tried it myself, but it sounds cool! * Dave Mitchell, Operations Manager, * Fretwell-Downing Facilities Ltd, UK. [EMAIL PROTECTED] * Tel: +44 114 281 6113.The usual disclaimers * * Standards (n). Battle insignia or tribal totems
Re: Apache::Leak
According to the error log output, I'm leaking anything between 15 and 25 SVs per run of the Apache::Registry script. So, to interpreting the copious emissions: new fb1d58 : SV = PVAV(0xffee88) REFCNT = 1 FLAGS = (PADBUSY,PADMY) IV = 0 NV = 0 ARRAY = 0x0 ALLOC = 0x0 FILL = -1 MAX = -1 ARYLEN = 0x0 FLAGS = (REAL) And so on. My question is, what does all this mean? Where can I find documentation? How do I know which variable have been leaked? Try perldoc Devel::Peek and perldoc perlguts
Re: new multipart_buffer patch for libapreq
[EMAIL PROTECTED] wrote The patch I posted yesterday has a problem dealing with client disconnects - your server will hang if the upload is interrupted )! This new patch should be ok. Your patch uses memmem(), which isn't available on some OSes (eg Solaris). Also, the linux manpage warns against using memmem() because it was broken in some earlier versions of libc. I've rolled my own version, and it seems to work okay (famous last words). Here's a patch for your patch. (I'm not promising this is the greatest re-implementation of memmem() the world has ever seen.) Regards, Dave M. *** libapreq-0.31/c/multipart_buffer.c.FCS Wed Jul 5 11:17:07 2000 --- libapreq-0.31/c/multipart_buffer.c Wed Jul 5 11:22:26 2000 *** *** 71,76 --- 71,97 #define DEBUG 0 /* 0 = off, 1 = noisy */ + + /* return pointer to first occurance of s in buf */ + + void *my_memmem(const void *buf, size_t buf_len, const void *s, size_t s_len) + { + void *p, *q; + size_t n; + unsigned int c; + + if (s_len buf_len || s_len == 0 || buf_len == 0) return NULL; + p = (void *) buf; + c = *((unsigned char *) s); + for (n = buf_len - s_len + 1; n 0; n--, p++) { + q = memchr(p,c,n); + if (!q) return NULL; + n -= (q-p); + p = q; + if (memcmp(p,s,s_len) == 0) return p; + } + return NULL; + } static char *my_join(pool *p, char *one, int lenone, char *two, int lentwo) { char *res; *** *** 200,206 /* Find the boundary in the buffer (it may not be there). */ ! if (mem = memmem(self-buffer + self-buffer_off, self-buffer_len, self-boundary, self-boundary_length) ) { start = mem - ( self-buffer + self-buffer_off ); --- 221,227 /* Find the boundary in the buffer (it may not be there). */ ! if (mem = my_memmem(self-buffer + self-buffer_off, self-buffer_len, self-boundary, self-boundary_length) ) { start = mem - ( self-buffer + self-buffer_off ); *** *** 294,300 multipart_buffer_fill(self, bytes); ! if (mem = memmem(self-buffer + self-buffer_off, self-buffer_len, CRLF_CRLF, 4)) { /* have final header 'fragment' in the buffer */ --- 315,321 multipart_buffer_fill(self, bytes); ! if (mem = my_memmem(self-buffer + self-buffer_off, self-buffer_len, CRLF_CRLF, 4)) { /* have final header 'fragment' in the buffer */ *** *** 416,418 --- 437,440 return self; } +
Re: Can't find Apache::DBI on Win32 version
This worked but now I get upon start up of the apache httpd daemon: defined(@array) is deprecated at c:/Perl/site/5.6.0/lib/Apache/DBI.pm line 135 (Maybe you should just omit the defined()?) Just edit c:/Perl/site/5.6.0/lib/Apache/DBI.pm, deleting the 'defined' on line 135 :-)
Patch for 5.6.0 coredump / Bizarre copy
A patch has just been released for Perl 5.6.0, which fixes some, (or hopefully all!) of the bugs which cause coredumps or 'Bizarre copy of HASH/ARRAY' runtime errors in the general vicinity of Carp::confess(), caller(), @DB::args etc. This certainly fixes the failure in Mason's t/05-request test file, and may well fix a bunch of general mod_perl related problems. see http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-06/msg00200.html for more info, but here's the patch itself. //depot/perl/cop.h#49 (text) Index: perl/cop.h --- perl/cop.h.~1~ Thu Jun 8 06:58:03 2000 +++ perl/cop.h Thu Jun 8 06:58:03 2000 @@ -106,13 +106,9 @@ } STMT_END #endif /* USE_THREADS */ -#ifdef USE_ITHREADS - /* junk in @_ spells trouble when cloning CVs, so don't leave any */ -# define CLEAR_ARGARRAY() av_clear(cx-blk_sub.argarray) -#else -# define CLEAR_ARGARRAY() NOOP -#endif /* USE_ITHREADS */ - +/* junk in @_ spells trouble when cloning CVs and in pp_caller(), so don't + * leave any */ +#define CLEAR_ARGARRAY() av_clear(cx-blk_sub.argarray) #define POPSUB(cx,sv) \ STMT_START { \ //depot/perl/t/op/runlevel.t#16 (xtext) Index: perl/t/op/runlevel.t --- perl/t/op/runlevel.t.~1~Thu Jun 8 06:58:03 2000 +++ perl/t/op/runlevel.tThu Jun 8 06:58:03 2000 @@ -349,3 +349,18 @@ bar B 2 bar + +sub n { 0 } +sub f { my $x = shift; d(); } +f(n()); +f(); + +sub d { +my $i = 0; my @a; +while (do { { package DB; @a = caller($i++) } } ) { +@a = @DB::args; +for (@a) { print "$_\n"; $_ = '' } +} +} +EXPECT +0 End of Patch. * Dave Mitchell, Operations Manager, * Fretwell-Downing Facilities Ltd, UK. [EMAIL PROTECTED] * Tel: +44 114 281 6113.The usual disclaimers * * Standards (n). Battle insignia or tribal totems
Re: mod_perl 1.24 testing keeps failing
[Thu May 25 19:34:31 2000] [error] mod_ssl: Init: Failed to generate temporary 5 12 bit RSA private key Sorry, I missed the earlier discussion on this (so I may have got the wrong end of the stick), but I got this too when trying to build apache 1.3.12 with perl-5.6.0 and mod_ssl 2.6.4, and I found a solution. The problem was that mod_perl's test scripts invoke apache with a stub config section designed to turn SSL off: IfModule apache_ssl.c SSLDisable It so happens that mod_ssl tries to generate the tmp RSA key even though it's been disabled with SSLDisable. Because there are no SSL directives in the test conf file that define sources for randomness, the key generation fails (and apache fails to start, and so the mod_perl test fails). My workaround was to add the following lines to the IfModule apache_ssl.c session: SSLRandomSeed startup builtin SSLRandomSeed connect builtin SSLLog logs/ssl_engine_log SSLLogLevel info (I suspect only the 1st of these lines is required, but this is what I actually added that worked). * Dave Mitchell, Operations Manager, * Fretwell-Downing Facilities Ltd, UK. [EMAIL PROTECTED] * Tel: +44 114 281 6113.The usual disclaimers * * Standards (n). Battle insignia or tribal totems
Re: Storing hashes in Apache::ASP
I've been trying to store a hash in a session variable, using code like that appended below. Call me a doofus, but I can't seem to get it to work. Can anybody tell me what I'm doing wrong? You have to store a reference to the hash, ie $Session-{Stuff} = \%stuff; not $Session-{Stuff} = %stuff; Thanks, Bryan Example follows: -- html body pre % %stuff = ( a = '1', b = '2', c = '3' ); $Session-{Stuff} = %stuff; $Response-Write ( "Results --\n" ); for $i (keys %{$Session-{Stuff}} ) { $Response-Write ( "$i: $Session-{Stuff}{$i}\n" ); } % /pre /body /html -- === Bryan Wright|"If you take cranberries and stew them like Physics Department | applesauce, they taste much more like prunes University of Virginia | than rhubarb does." -- Groucho Charlottesville, VA 22901 | (804) 924-7218 | [EMAIL PROTECTED] ===
Re: Storing hashes in Apache::ASP
You have to store a reference to the hash, ie $Session-{Stuff} = \%stuff; not $Session-{Stuff} = %stuff; \%stuff is not a reference to a hash, it's a reference to each key and value in the hash. I don't think you'll ever have to use \ on arrays or hashes. The only way to get a hash ref is by using the {} operator. e.g.: {%stuff} Of course, you know how two copies of the data, so be careful. Er, I beg to differ. \%hash returns a reference to that hash - see the top of p.246 of the camel book, 2nd ed. The {} operators are for creating *anonymous* hashes.