Re: why you should reply to the list

2003-08-27 Thread Randal L. Schwartz
>>>>> "Douglas" == Douglas Theobald <[EMAIL PROTECTED]> writes:

Douglas>  All the other lists automatically put the list email address
Douglas> in the Reply-to: of the distributed posts, thus making
Douglas> replying to the list the default. Couldn't that be changed
Douglas> for modperl?

"Eeek.  Please make the bad man stop, mommy!"

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: Templating system opinions (CGI::Application in connection with either HTML::Template or Template::Toolkit)

2003-07-23 Thread Randal L. Schwartz
>>>>> "Dave" == Dave Baker <[EMAIL PROTECTED]> writes:

Dave> I'm curious as to why the combination of CGI::Application and
Dave> HTML::Template hasn't taken off ... CGI::Application seems to allow a
Dave> software developer to create an entire CGI app that can be stored and
Dave> distributed as a module on CPAN, but only a couple such app/modules
Dave> have been so added.

Maybe because it competes with OpenInteract, which is far more established.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


Re: templating system opinions - Mason recommendation

2003-07-19 Thread Randal L. Schwartz
>>>>> "Stas" == Stas Bekman <[EMAIL PROTECTED]> writes:

Stas> While Andy is working on it, you can read a TT for mod_perl chapter in
Stas> "Practical mod_perl", written by Andy as well! (http://modperlbook.org)

Man, that guy is *everywhere*!

:-)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


Re: Is statically-compiled mod_perl better?

2003-07-03 Thread Randal L. Schwartz
>>>>> "Ged" == Ged Haywood <[EMAIL PROTECTED]> writes:

Ged>   A recent post by Randal seemed to indicate the memory saved
Ged> by using a DSO mod_perl wasn't as large as one might think - check the
Ged> archives.

And I've confirmed that observation at least on Solaris and OpenBSD.
You can build a static mod_perl-enabled binary.  Just be sure to have:

ClearModuleList
AddModule mod_mime.c
...

and add only the modules that you're using.  Modules that don't get
"add"-ed appear to take up no data space... just becoming part of the
shared single binary that is being accessed.

(You can get the list with 'httpd -l' and a bit of text massaging.)

My front proxy processes are a mere 1.5 Meg right now, running
basically mod_ssl, mod_rewrite, and mod_proxy, and it's the same
binary as my backend mod_perl work processes, running about 10 to 15
Meg a piece.

No more DSO.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


Re: each considered harmful?

2003-06-16 Thread Randal L. Schwartz
>>>>> "Randal" == Randal L Schwartz <[EMAIL PROTECTED]> writes:

Randal> our @STATIC_FILES = (
Randal>   [ qr{^/img/(.*)$} => [ qw(/alternative/img /myapp/install/img) ],
Randal>   [ qr{^/css/(.*)$} => [ qw(/alternative/css /myapp/install/css) ],

Argh.  extra left bracket snuck in.

   [ qr{^/img/(.*)$} => qw(/alternative/img /myapp/install/img) ],
   [ qr{^/css/(.*)$} => qw(/alternative/css /myapp/install/css) ],

Randal>   ...
Randal> );

Randal> sub handler {
Randal>   my $r = shift;
Randal>   my $uri = $r->uri;
Randal>   for (@STATIC_FILES) {
Randal> my ($pat, @dirs) = @$_;
Randal> if ($uri =~ $pat) {
Randal>   my $tail = $1;
Randal>   foreach my $dir (@dirs) {
Randal> my $file = "$dir/$tail";
Randal> if (-f $file) {
Randal>   $r->filename($file);
Randal>   return OK;
Randal> }
Randal>       }
Randal> }
Randal>   }
Randal>   return DECLINED;
Randal> }

Randal> -- 
Randal> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
Randal> <[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Randal> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
Randal> See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


Re: each considered harmful?

2003-06-16 Thread Randal L. Schwartz
>>>>> "Marcin" == Marcin Kasperski <[EMAIL PROTECTED]> writes:

Marcin> Maybe it could be of some interest where I happened to get this
Marcin> problem. I got it in my custom TransHandler implemented to reduce stat
Marcin> calls and to obtain 'select from multiple directories' effect.

Marcin> ... (config file) 

Marcin> our %STATIC_FILES = (
Marcin> '/img' = [ '/alternative/img', '/myapp/install/img' ],
Marcin> '/css' = [ '/alternative/css', '/myapp/install/css' ],
Marcin> ...
Marcin> )

Marcin> ... (transhandler file, simplified of course) ...

Marcin> sub handler {
Marcin> my $r = shift;
Marcin> my $uri = $r->uri;
Marcin> ... detecting dynamic handlers ...
Marcin> while( my($url, $dirs) = each %STATIC_FILES ) {
Marcin> if( $uri =~ m{$url/(.*)$} ) {
Marcin> foreach my $d (@$dirs) {
Marcin> my $file = "$d/$1";
Marcin> if( -f $file ) {
Marcin>$r->filename($file);
Marcin>return OK;
Marcin> }
Marcin> }
Marcin> }
Marcin> }
Marcin> }

That's actually the wrong data structure then.  What you want
if you're only ever accessing it as a list, is a list!

And, you're needlessly recompiling the regex each time.  Here's
a much better way to do that...

our @STATIC_FILES = (
  [ qr{^/img/(.*)$} => [ qw(/alternative/img /myapp/install/img) ],
  [ qr{^/css/(.*)$} => [ qw(/alternative/css /myapp/install/css) ],
  ...
);

sub handler {
  my $r = shift;
  my $uri = $r->uri;
  for (@STATIC_FILES) {
my ($pat, @dirs) = @$_;
if ($uri =~ $pat) {
  my $tail = $1;
  foreach my $dir (@dirs) {
my $file = "$dir/$tail";
if (-f $file) {
  $r->filename($file);
  return OK;
}
  }
}
  }
  return DECLINED;
}

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


Re: each considered harmful?

2003-06-15 Thread Randal L. Schwartz
>>>>> "Marcin" == Marcin Kasperski <[EMAIL PROTECTED]> writes:

Marcin> You probably see the problem - when this code is re-executed (next
Marcin> request), the loop iterates just over 'the rest' of the hash.

This is similar to the problem that shows up when you use glob in a
scalar context... it also has lexically-attached state.

And now that I think about it, so does the flip-flop scalar dot-dot
operator.

These are all examples of where it is non-trivial to take a CGI-based
script and just "drop it in" as Apache::Registry.  There's really
nothing A::R can do about it.  You must still use your Branes.
-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


static linking vs DSO linking

2003-06-11 Thread Randal L. Schwartz

At a recent client, I had the mandate to develop a front/back server
setup, with the front being a thin mod_proxy setup and the back being
a fat mod_perl setup.  One of the things I noticed while compiling and
deploying Apache on Solaris via the pmap command is that the static
linking and selective loading (via LoadModule) didn't really save me
that much stuff... only the AddModule selected whether the module had
been activated, and therefore allocated its private memory.

Has anyone else seen this?  Am I crazy for suggesting that DSO doesn't
really gain you much, and a simple selective AddModule is enough?

Also, has anyone gotten experience with AddModule mod_perl but keeping
the front-end's mod_perl tasks to a minimum, and therefore the memory
footprint very small?  I want the backend's mod_perl usage to be fat:
that's the whole point of the divergence.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


Re: getting *any* variables out of the server environment

2003-06-09 Thread Randal L. Schwartz
>>>>> "Ryan" == Ryan Muldoon <[EMAIL PROTECTED]> writes:

Ryan> Geoffrey,
Ryan>   Thanks for the explanation.  Unfortunately, I think I am still a little
Ryan> unclear as to how to proceed.  If I understand you correctly, my first
Ryan> method is completely wrongheaded.  (I tried this because it is how the
Ryan> "Writing Apache Modules with Perl and C" does it. p.327)  So it sounds
Ryan> like the second way is the appropriate usage for subprocess_env().  But
Ryan> it seems like you're saying that I shouldn't be using that at all.
Ryan> Specifically, here is what I'd like to get out of the environment:
Ryan> SSL_CLIENT_S_DN_CN
Ryan> SSL_CLIENT_S_DN_O
Ryan> and things of that nature.  According to mod_ssl's documentation, these
Ryan> are put in ENV upon processing of a client certificate.  Ideally, I'd
Ryan> like to make which fields to extract configurable, so I don't want to
Ryan> hard-code.  

Well, then, in any handler after the mod_ssl has run, you
should be be able to use $r->subprocess_env("SSL_CLIENT_S_DN_CN")
to get at that info.

Ryan> Currently, I have
Ryan> PerlPassEnv SSL_CLIENT_S_DN_O
Ryan> PerlPassEnv SSL_CLIENT_S_DN_CN
Ryan> in my httpd.conf, but it doesn't seem to make any kind of difference.
Ryan> To make sure it isn't just mod_ssl being lame for some reason, I've
Ryan> tried it with DOCUMENT_ROOT and other standard ENV variables.  But to no
Ryan> avail. :(  

That takes the enviroment variables that apache was started with
and passes those to mod_perl.  Probably not what you want.

(I'm doing this from memory, so please correct me if I'm wrong.)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


Re: how to make sure code wasn't changed

2003-05-31 Thread Randal L. Schwartz
>>>>> "Mike" == Mike Zelina <[EMAIL PROTECTED]> writes:

Mike> Here's my question: has anyone setup a clever way, possibly
Mike> using CRC/MD5 analysis, to check to make sure code hasn't been
Mike> changed?  I don't care if someone steals it or gives it to their
Mike> friends, but I don't want the code to yield results if it's been
Mike> modified - either intentionally or on accident - because it
Mike> could give false results.  These are sales guys machines which
Mike> (no offense to any sales people lurking on this list) means
Mike> anything can and probably will happen.  I realize that someone
Mike> could circumvent a CRC check just by changing the CRC check
Mike> number, but I'm not worried...  if they are that clever kudos to
Mike> them.

And are you also providing a way to set up those MD5s so that maintenance
can be performed by someone other than you if you get hit by a bus?

If not, then I'd not be paying you one dime if you were my vendor.

You make yourself irreplacable by providing a good product at a fair
price, not by holding your customer hostage so that they can only get
support through you.

This is the creed and core philosophy of open source.  Do not stand on
the shoulders of the giants who have gone before you and drool onto
their face.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


Re: mod_perl caching form data?

2003-05-31 Thread Randal L. Schwartz
>>>>> "Perrin" == Perrin Harkins <[EMAIL PROTECTED]> writes:

Perrin> On Thu, 2003-05-29 at 17:26, [EMAIL PROTECTED] wrote:
>> A simple $cgi->delete('ipaddress') to delete the value when I create
>> the field has done the trick.  Thanks very much to the both of you.

Perrin> I'm glad to hear that worked, but it's still worrisome that you were
Perrin> seeing data leak between different users.  The form widgets are only
Perrin> supposed to be sticky for values submitted on the current request.  It
Perrin> indicates either a bug in the way CGI.pm clears its variables under
Perrin> mod_perl or a bug in your script that could surface again later.


OK, throwing my hat into the ring here...

maybe *I* wasn't hallucinating then.  I just had a recent
fix to a longstanding bug in the picture section of my website...

I had been using CGI.pm (through Template::Plugin::CGI), and was
mystified because *occasionally* the wrong picture would show, but a
simple reload fixed it.

I fixed the bug by avoiding CGI.pm, and using Apache::Template's
"param" variable directly instead.

So maybe there is a CGI.pm bug with regarding to clearing out the
values in a mod_perl environment.  I wonder how simple of a test we
can concoct to determine that?

Lincoln, are you listening?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


Re: inline mod_perl - is this possible?

2003-03-19 Thread Randal L. Schwartz
>>>>> "www" == www ReadNotify com <[EMAIL PROTECTED]> writes:

www> 
www> I am running 
www> 
www> print $ENV{MOD_PERL};
www> print "process ID $$";
www> 
www> on Apache!!
www> 

www> What modules/config/etc do I need to set up?

Either Mason or Template Toolkit would probably do.  I prefer the latter.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


Re: Redirects: relative vs absolute

2003-02-24 Thread Randal L. Schwartz
>>>>> "Grant" == Grant McLean <[EMAIL PROTECTED]> writes:

Grant> I've seen a number of code examples for redirects which output a
Grant> root-relative URI in the Location header. Eg:

Grant>   Location: /images/item1.gif

If that's coming out from a CGI or Apache::Registry script, the
browser never sees it, because it's handled as an internal redirect.
That can be messy if it's an HTML page with relative links, as the
browser will fetch the links relative to the *old* URL, not the new
URL.  It's also messy if you meant to keep that URL private, but
something breaks as a result, and the URL gets publicized in an error
message.

Now, you may be talking about a response header that's not related to
CGI or Apache::Registry, in which case this doesn't apply.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


Re: Please wait Handler

2003-02-15 Thread Randal L. Schwartz
>>>>> "Perrin" == Perrin Harkins <[EMAIL PROTECTED]> writes:

Perrin> Andrew Ho wrote:
>> Make an HTML page which does a form submit to pleasewait.pl. pleasewait.pl
>> just displays an HTML page with an animated "please wait" image on it, and
>> its headers include the following header:
>> Refresh: 1; url=http://www.example.com/getresults.pl?args...

Perrin> That's what Randal does in the article that I posted (although his
Perrin> puts it in a META tag).  It's called client pull, and was introduced
Perrin> by Netscape at the same time as server push.

There's a later better example of that (self-cleaning, etc)
at <http://www.stonehenge.com/merlyn/LinuxMag/col39.html>.

I usually don't recycle ideas unless I can put a new slant on it.
Check out the new slant. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: handling of the trailing slash

2003-02-04 Thread Randal L. Schwartz
>>>>> "kris" == kris nelson <[EMAIL PROTECTED]> writes:

kris> I've noticed that Apache alone appears to differ from one of my
kris> modules running under mod_perl in its handling of trailing
kris> slashes. I'm wondering if this is expected behavior and, if so,
kris> why? (Maybe this is obvious...)

Yes, expected.  mod_core gets upset if there are characters in
PATH_INFO trailing the filename.  But mod_cgi doesn't care, nor does
mod_perl's Apache::Registry.  If you write your own handler, you can
return errors for data in PATH_INFO.  It's up to you.  You didn't say
what handler you were using (hint: "mod_perl" is never specific enough
:).

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: "do" as temp solution for "require" problem ?

2003-01-28 Thread Randal L. Schwartz
>>>>> "Justin" == Justin Luster <[EMAIL PROTECTED]> writes:

Justin> When a Perl script runs under Mod_Perl the current working directory is
Justin> no longer the location of the Perl script (I think it is where
Justin> Apache.exe is).  So when you require an additional file it does not look
Justin> in the same directory as your original script for the file.  One
Justin> alternative that has been mentioned is to place your included file in
Justin> one of the locations of the @INC array.  Another option that I have used
Justin> is to add the path of the original Perl file to the @INC array so that
Justin> included files will be looked for there too.

But that's not the problem here.

See the other postings in this thread.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: "do" as temp solution for "require" problem ?

2003-01-28 Thread Randal L. Schwartz
>>>>> "mail@adventureforum" == mail@adventureforum net <[EMAIL PROTECTED]> 
>writes:

mail@adventureforum> I am using: mod_perl/1.26

mail@adventureforum> Now I tried to include subroutines from an external .pl file with
mail@adventureforum> "require".

This smells a bit like you're using Apache::Registry (you haven't said
yet) and you've moved some subroutines into a separate file, but not a
separate package, and you either aren't aware or don't understand the
significance of the fact that every Apache::Registry script runs in a
different package.

Could that be the case?

If you're using Apache::Registry, and you're not properly using
packages, you'll get burned.  Turn your external code into a real
module, and things will work again.  Use "use", not "require", not
"do".

print "Just another (mod) Perl hacker,"

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: OSCON ideas - missing proceedings

2003-01-10 Thread Randal L. Schwartz
>>>>> "Nathan" == Nathan Torkington <[EMAIL PROTECTED]> writes:

Nathan> Not for two years at least (the duration of the contract with the
Nathan> Portland hotel).  The San Diego hotel was much more expensive and
Nathan> remote, compared to the Portland hotel.  I think people are really
Nathan> going to enjoy being in the middle of a city at this year's OSCON.

Yes... the number of things that are within walking distance of the
hotel is rather nice.  The waterfront park should be rather
spectacular, especially at night when the 14 bridges across the
Willamette are lit up in their own unique ways.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Shroud+ Perl obfuscator....

2002-12-20 Thread Randal L. Schwartz
>>>>> "Andrzej" == Andrzej Jan Taramina <[EMAIL PROTECTED]> writes:

Andrzej> I extended Robert Jones' Perl Obfuscator, Shroud into what I
Andrzej> am calling Shroud+. I needed it to protect some rather
Andrzej> extensive scripts I have developed for Inventory and Image
Andrzej> Gallery management on client web sites.

I just want to go on the record to say that I consider your action
personally offensive and ethically questionable.

A lot of people have worked very hard to bring you an open source
platform to stand on.

And now you spit in their face, by trying to pretend YOUR work is
worthy of more locking up than the source code you are using to create
your work.

Sir, on their behalf, and my own as a contributor to the open source
movement, and Perl in particular, you offend me.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Apache 2?

2002-11-26 Thread Randal L. Schwartz
>>>>> "Philip" == Philip Mak <[EMAIL PROTECTED]> writes:

Philip> Let's say you have a mod_perl page that returns a 100k document, and a
Philip> 28.8k modem downloads that document.

Philip> The mod_perl process that is serving that document will be tied up
Philip> until that modem finishes downloading the document, which is
Philip> inefficient since the mod_perl processes take up a lot of memory. A
Philip> lightweight front-end proxy that loads the data from the mod_perl
Philip> process all at once and then feeds it to the modem would save memory.

Yeah, I did this to stonehenge.com about five months ago, and am now handling
about 3-4 times the traffic for the same loadav.  All on one machine.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: [O] Re: Yahoo is moving to PHP ??

2002-11-04 Thread Randal L. Schwartz
>>>>> "Perrin" == Perrin Harkins <[EMAIL PROTECTED]> writes:

Perrin>   Someone else will eventually have to maintain them, so I
Perrin> write in a way that a novice with a copy of Learning Perl has a hope
Perrin> of understanding.

Perrin> When I work in an environment that is more Perl-centric, I expand the
Perrin> vocabulary of my code more.

This is the position we support during our code review services as
well.  You can use fancy stuff, but be sure to point to where you
learned it. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: [OT]: In my Farthers House there are many mansions

2002-11-03 Thread Randal L. Schwartz
>>>>> "Tony" == Tony Bowden <[EMAIL PROTECTED]> writes:

Tony> We're drifting further and further off topic here, but the trick to the 
Tony> Schwartzian Transform is the caching, not the maps. The maps are just a
Tony> convenient construct that allows the whole thing to be written in one
Tony> command, without lots of temporary variables. 

Exactly.  You're caching the complex sort-function so that it
doesn't need to be recomputed for the various pairings, leading
to either a slowdown or phase errors.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: [O] Re: Yahoo is moving to PHP ??

2002-10-31 Thread Randal L. Schwartz
>>>>> "Mike" == Mike Miller <[EMAIL PROTECTED]> writes:

>> Let's prey that those PHP geeks quickly discover the
>> true joy of working with functionnals (map and al.).
>> I have often wondered about the ratio of Perl programmers
>> still using the C-like  construct. I guess it's rather low.
>> 

Mike> But  is a lot easier to read and debug, IMHO   Is there a
Mike> significant performance difference in using map instead?

He said "C-like for".  Your "for" is probably a "foreach", if you're
comparing it with "map".

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: [OTish] Version Control?

2002-10-30 Thread Randal L. Schwartz
>>>>> "Jesse" == Jesse Erlbaum <[EMAIL PROTECTED]> writes:

Jesse> Hey Jim --
>> Also, Randal Schwartz wrote about cvs is a slightly more general setting:
>> 
>> http://www.linux-mag.com/2002-07/perl_01.html


Jesse> The system we use goes a bit beyond even what Randal describes
Jesse> (although, he is on a similar track).

Jesse> In a nutshell, the Apache "httpd.conf" file is "templatized" to
Jesse> replace elements such as the IP address, host name and path
Jesse> names with variables.

Actually, my real code does that.  I had to simplify it a bit
for the article.

Below the top dir, I have:

etc/ - for apache etc, some files are templatized
htddocs/ - for apache rootdir
perl-lib/ - @INC at run-time, for custom mod_perl modules and TT2 plugins
perl-tt2/ - TT2 templates
pod/ - 158(!) column source pods, processed into HTML and listing files
sbin/ - apache sbin, contains log-roller and apachectl
generate-navbars - process META info to make navbar database
run-template - described in article
GNUmakefile - "One File To Rule Them All"

And yes, I can check the puppy out, edit and test it at 30,000 feet,
then resync when I get to a landline again.  Very nice.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: [OTish] Version Control?

2002-10-30 Thread Randal L. Schwartz
>>>>> "Richard" == Richard Clarke <[EMAIL PROTECTED]> writes:

Richard> Does anyone in the list use any kind of version control (e.g. CVS) for
Richard> the perl/template codebase of their website?

Yup. Even wrote a column about it:

<http://www.stonehenge.com/merlyn/LinuxMag/col38.html>

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: [OT] Perl vs. PHP..... but where is mod_perl?

2002-10-18 Thread Randal L. Schwartz
>>>>> "jjore" == jjore  <[EMAIL PROTECTED]> writes:

jjore>  If you completely left CPAN out of the picture then just as a
jjore> language and syntax it isn't all that nice anyway.  *shrugs*
jjore> I've yet to understand what the appeal is.

PHP is just barely limited enough that an ISP can leave it enabled for
those free or cheap homepage sites, and so people can migrate from
static HTML web pages to "interactivity" without learning "a real
language".  (Unfortunately, the frequent security holes mean that
those ISPs usually get 0wn3d rather quickly.)

>From that perspective, it's a success.  I applaud that.

What confuses me is how anyone with a *programming* background admires
PHP over Perl, or can say that Perl "doesn't scale" or PHP is better
for "large web sites".  Obviously, they're comparing Perl-CGI with
PHP, not mod_perl/$templating_system with PHP, which would be a much
fairer comparison.

As I've said in this forum before:

PHP is "training wheels without the bicycle".

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: [OT] Perl vs. PHP..... but where is mod_perl?

2002-10-18 Thread Randal L. Schwartz
>>>>> "Dzuy" == Dzuy Nguyen <[EMAIL PROTECTED]> writes:

Dzuy> What do you expect from (PHP) amateurs?  Apparently Perl is too
Dzuy> complicated for them to comprehend,
Dzuy> never mind mod_perl.

And according to my thread at use.perl
<http://use.perl.org/~merlyn/journal/8445>, the article just got pulled!

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: [OT] Perl vs. PHP..... but where is mod_perl?

2002-10-18 Thread Randal L. Schwartz
>>>>> "allan" == allan juul <[EMAIL PROTECTED]> writes:

allan> odd yes, they are up to date it seems
allan> head('http://www.newsfactor.com/perl/story/19716.html')

allan> returns:
allan> Apache/1.3.26 (Unix) PHP/4.2.2 mod_perl/1.27

allan> bad article BTW IMHO
allan> ./allan


Heh.  They really *don't* understand even what they have.

Here's the source to part of the page I got during signup:


Thank you for registering, merlyn.

Your registration is now complete.  
 
You will now be taken back to the page you were on before the sign-up 
process.

Or you can click here to 
return quicker.

Regards,

NewsFactor team

Heh!  Apache::Cookie=SCALAR(0x....)  Even in the refresh header!

That's just too funny.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: [OT] Perl vs. PHP..... but where is mod_perl?

2002-10-18 Thread Randal L. Schwartz
>>>>> "Richard" == Richard Clarke <[EMAIL PROTECTED]> writes:

Richard> List,
Richard> http://www.newsfactor.com/perl/story/19716.html

Richard> ...sigh?

mod_perl is still in the bucket of clues that they didn't dip in to.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: ANNOUNCE: the new perl.apache.org is alive now!

2002-07-12 Thread Randal L. Schwartz

>>>>> "Matt" == Matt Sergeant <[EMAIL PROTECTED]> writes:

Matt> Are there that many sites any more that are running pure mod_perl? I would
Matt> expect most new sites to be running one of the framework modules -
Matt> EmbPerl, TT, Mason, AxKit, ASP, etc... Perhaps live sites is a more
Matt> framework specific thing (for example AxKit has its own list).

Oh, and add Template Toolkit (www.tt2.org) to that list.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: sections

2002-07-08 Thread Randal L. Schwartz

>>>>> "Randal" == Randal L Schwartz <[EMAIL PROTECTED]> writes:

Randal> using Template Toolkit.  Easy'nuff.  Lots of common stuff, plus unique
Randal> stuff.  You can use "tpage" and then there's not even any programming:

Randal> httpd.conf.pages: httpd.conf.tmpl
Randal> tpage --define server=pages < $< > $@
Randal> httpd.conf.proxy: httpd.conf.tmpl
Randal> tpage --define server=proxy < $< > $@

Randal> then check [% IF server = 'pages'; ... ; END %] in your templates.

Or duh, even simpler:

[%
  FOREACH server = ['pages', 'proxy'];
FILTER redirect("httpd.conf.$server");
-%]
... everything else ...
    [%
    END; # filter redirect
  END; # foreach
-%]

Then just "tpage" the file, and you've got a new version!

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: sections

2002-07-08 Thread Randal L. Schwartz

>>>>> "Mike" == Mike Blazer <[EMAIL PROTECTED]> writes:

Mike> Yeah, thanks. But the whole that site has nothing to do without the
Mike> database :) It almost has no static content.
Mike> But seems like you are both right. Template would be really safer. While
Mike> this also breaks the nice concept of starting each server with apachectl
Mike> -D  and having all confugurables (perl vars, hashes) together in
Mike> the same file.

Solution:

generate

httpd.conf.pages
httpd.conf.proxy

using Template Toolkit.  Easy'nuff.  Lots of common stuff, plus unique
stuff.  You can use "tpage" and then there's not even any programming:

httpd.conf.pages: httpd.conf.tmpl
tpage --define server=pages < $< > $@
httpd.conf.proxy: httpd.conf.tmpl
tpage --define server=proxy < $< > $@

then check [% IF server = 'pages'; ... ; END %] in your templates.

Make httpd.conf be simply:


Include httpd.conf.pages


Include httpd.conf.proxy
        
    

Include httpd.conf.other



Done. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Optional HTTP Authentication ?

2002-06-30 Thread Randal L. Schwartz

>>>>> "Jean-Michel" == Jean-Michel Hiver <[EMAIL PROTECTED]> writes:

Jean-Michel> * For political reasons and compliance with future european legislation
Jean-Michel>   I cannot use cookies,

What?  The EU is going to make cookies *illegal*?  I highly doubt
this.

Jean-Michel> * For usability reasons encoding session IDs on URIs would be really
Jean-Michel>   bad... users needs to be able to 'hack' the URIs without f***ing their
Jean-Michel>   sessions!

Why is a user "hacking" their URLs?

Jean-Michel> Therefore I have to use HTTP authentication...

Even though the user/password is transmitted *in the clear* on
*every single hit*, because you can't just use a session identifier?
This is so very wrong from a security perspective.


-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: when to mod_perl?

2002-06-25 Thread Randal L. Schwartz

>>>>> "Peter" == Peter Bi <[EMAIL PROTECTED]> writes:

Peter> I have a question regarding to the cached files. Although the
Peter> maximal period is set to be 24 hours in httpd.conf's proxy
Peter> settings, many of the files, which were cached from the backend
Peter> mod_perl dynamical program, are strangely modified every a few
Peter> minutes. For all the files I checked so far, they do look to be
Peter> modified because the hex strings on top of the files (such as
Peter> 3D189FC2) are different after each modifications.

If you're talking about www.stonehenge.com, I don't provide
last-modified for any of the HTML pages: they're all dynamic.  If the
proxy server is caching them, it's going to still punch through to the
back for each hit.

Similarly, if you are talking about your own site, and you *do*
provide a mostly useless "last modified" time, then the front end is
still going to go to the back end and say "I've got a version from
time $x, is that current?" and if you're not handling
"if-modified-since", then every hit will be cached, uselessly.

I avoid that on stonehenge by not providing last-modified for any of
my HTML pages.  mod_proxy thus has no idea about caching, so it's all
dynamic.  My images automatically have last-modified, and thus the
cache can check for updates with if-modified-since, using the cache
when needed.  If I was really smart, I'd use mod_expires to say "this
image is good for $N hours", and then the front end wouldn't even
touch the back end at all.

As I said, as long as my loadav is low enough for my current hits, I've
got better things to work on. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: when to mod_perl?

2002-06-25 Thread Randal L. Schwartz

>>>>> "Perrin" == Perrin Harkins <[EMAIL PROTECTED]> writes:

Perrin> Static content is easy; just don't serve it from mod_perl.  The proxy
Perrin> approach is good, and so is a separate image server (which you can
Perrin> host on the same machine).  I've found thttpd to be an amazingly
Perrin> efficient server for images, but a slimmed-down apache does very well
Perrin> too.

On the new www.stonehenge.com, I'm using a stripped down Apache (just
mod_proxy and mod_rewrite) for a reverse caching proxy, and it's about
1.5M RSS per process.  I divert requests for TT's /splash/images and
Apache's /icons, but otherwise, all content requests (including for
/merlyn/Pictures/ images) go to my heavyweight mod_perl backends,
which are running about 10M RSS.

Thanks to the caching, any of my images or other static content gets
pushed once a day to the front, and then doesn't tie up the back ever
again.  On a 500Mhz 256M box, I'm easily serving 50K requests a day
(about 10K of those are fully uncached dynamic pages touching about 20
to 50 TT includes), with loadaverages staying below 0.5.  If it ever
starts getting higher, I can cache the expensive menubar creation
(which is nearly completely static) using Perrin's device, but I've
not bothered yet.

It's been amazingly carefree.  I'm planning to move
www.geekcruises.com to be served on the same box, although they get
only about 1/10th the traffic.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: PerlTransHandler problem

2002-06-12 Thread Randal L. Schwartz

>>>>> "Rasoul" == Rasoul Hajikhani <[EMAIL PROTECTED]> writes:

Rasoul> I am trying to implement a simple PerlTransHandler to change:

Rasoul> http://myserver/

Rasoul> to 

Rasoul> http://myserver.rhythm.com/

Both of those are "/" as far as as $r->uri is concerned.

What are you *really* trying to do?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Porting to OS X

2002-06-04 Thread Randal L. Schwartz

>>>>> "David" == David Wheeler <[EMAIL PROTECTED]> writes:

>> I think it is relatively an easy move, IMHO.  Just beaware that the Mac OS
>> filesystem is NOT case-sensitive.  Which can cause problems with certain
>> applications. . .and we hope (Apple, you listening?) that they will fix this
>> gross over-sight.

David> I don't think that Apple is likely to change this. However, you
David> can install OS X on a case-sensitive partition (UFS?) if you
David> really want to.

My / has been UFS since day 1 of using OSX for me.
I have a separate HFS+ partition for Classic Apps.

The downside is that some of the files are not accessible to Classic
apps, but as more and more stuff gets at least Carbonized, I'm not
really that worried.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: How to proxy everything except selected urls?

2002-05-22 Thread Randal L. Schwartz

>>>>> "Ken" == Ken Miller <[EMAIL PROTECTED]> writes:


Ken> I initially thought something like this would work:

Ken> ---
Ken> ProxyPass  On
Ken> ProxyPass  /   http://other.server.com:1234/
Ken> ProxyPassReverse   /   http://other.server.com:1234/

Ken> alias /graphics /local/path
Ken> ---

Ken> However, /graphics also get's proxied to the app server.  This isn't what I
Ken> want.

Ken> I don't think mod_proxy can do this; at least it's not clear to me how to if
Ken> it does support this feature.

Ken> Would mod_rewrite be a better solution?  Match on the URL's that I want
Ken> processed locally (and stop), else map the url to the app server, and
Ken> forward the request?

Here's what the reverse-caching-proxy front end for www.stonehenge.com uses:

RewriteEngine On
## RewriteLog /web/stonehenge-proxy/var/log/rewrite_log
## RewriteLogLevel 3

## local services:
RewriteRule ^/icons/ - [last]
RewriteRule ^/tt2/images/ - [last]

## local redirect:
RewriteRule ^/cgi/go/(.*)$ $1 [redirect,last,noescape]

## passthrough:
RewriteMap escape int:escape
RewriteRule ^/(.*)$ http://localhost:8081/${escape:$1} [proxy,noescape]
ProxyPassReverse / http://localhost:8081/

## made a mistake! should never get here
RewriteRule .* - [forbidden]

By the way, without that RewriteMap, %3F in a URL incorrectly
becomes "?", thus ending the path-part and begins the query-part.
Bad.  Broken.  But this workaround works fine.  And the examples
in the mod_rewrite documentation are wrong.

I figured this out while rebuilding

  http://www.stonehenge.com/merlyn/Pictures/

to work with images that had spaces in the filenames as well
as question marks and ampersands. :)  Talk about escaping hell.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: [RFC] Dynamic image generator handler

2002-05-10 Thread Randal L. Schwartz

>>>>> "Michael" == Michael A Nachbaur <[EMAIL PROTECTED]> writes:

Michael> This is a mod_perl handler, not directly tied in with my
Michael> content management system, but is/will be used extensively by
Michael> it. The premise is to dynamically generate images, cache
Michael> them, and present them to browser clients. The URI, as well
Michael> as Apache configuration directives, is used to determine what
Michael> is to be generated.

Like <http://www.stonehenge.com/merlyn/LinuxMag/col33.html>
perhaps?  Been there, Done that.  Feel free to steal the code.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Using a 404 ErrorDocument to serve content

2002-05-06 Thread Randal L. Schwartz

>>>>> "Ken" == Ken Williams <[EMAIL PROTECTED]> writes:

Ken> I was thinking of writing yet-another-photo-album-server, and I had
Ken> the idea that I'd write a handler to serve resized versions of JPEGs
Ken> (very original, I know ;-).  The idea is that I'd put a bunch of JPEGs
Ken> on the server at locations like foo/123.jpg , and then if a request
Ken> came for foo/123-medium.jpg , I'd catch that with a 404 ErrorDocument
Ken> and generate the resized image using Imager.  If I wanted to, I could
Ken> also create the resized image on disk, so it wouldn't need to be
Ken> generated next time.

As usual, Been there, Did That For A Column.

1) Visit any page on the newly redesigned www.stonehenge.com.
2) Type "404 handler" into the bottom "search this site with google" box.
3) Check out the hits... should be the first or second one.

After 160 columns, I'm starting to really wonder what there is LEFT to
cover. :)
-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Throttling, once again

2002-04-25 Thread Randal L. Schwartz

>>>>> "Christian" == Christian Gilmore <[EMAIL PROTECTED]> writes:

Christian> Hi, Drew.
>> I came across the very problem you're having. I use mod_bandwidth, its
>> actively maintained, allows via IP, directory or any number of ways to
>> monitor bandwidth usage http://www.cohprog.com/mod_bandwidth.html

Christian> The size of the data sent through the pipe doesn't reflect the CPU spent to
Christian> produce that data. mod_bandwidth probably doesn't apply in the current
Christian> scenario being discussed.

 which is why I wrote Stonehenge::Throttle.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Permission conflict between mod_cgi and mod_perl

2002-03-25 Thread Randal L. Schwartz

>>>>> "Jim" == Jim Smith <[EMAIL PROTECTED]> writes:

Jim> Basically, mod_perl can run scripts in the same manner as any other
Jim> unix program.

Maybe we're getting hung up on details, but "mod_perl" is not a "unix
program".  It's a module for Apache.  Therefore, "in the same manner"
is no longer applicable.

mod_cgi forks to run processes.

mod_perl doesn't fork.

mod_perl can run Perl code via the embedded Perl interpreter, and this
interpreter can cause a fork.  But mod_perl doesn't inherently fork at
all.

And the distinction is important, especially in the context of
this discussion (setuid with "mod_perl").

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Permission conflict between mod_cgi and mod_perl

2002-03-25 Thread Randal L. Schwartz

>>>>> "Jim" == Jim Smith <[EMAIL PROTECTED]> writes:

Jim> On Mon, Mar 18, 2002 at 02:02:38PM -0800, James Lum wrote:
>> 1. use suid perl and set the owner as root ... but i do not know if you 
>> can run a suid perl program under modperl.  (anyone? will this work?)

Jim> Should be able to -- mod_perl can run other scripts.

"mod_perl" doesn't "run" "scripts".  mod_perl hooks handlers to
various stages of Apache processing using an embedded Perl interpreter.

One of the modules shipped with mod_perl is called Apache::Registry,
which can transform something that looks a lot like a CGI script using
CGI.pm into a giant subroutine that then gets hooked as the handler
for a particular URL.

This is never "run"ning the "script".  It's unfortunate that it's
*usually* so transparent, because when it doesn't work, it looks like
something is broken. :)

Thus, the answer is no - mod_perl cannot "run" a setuid perl program,
unless you mean by forking via fork or system or backticks, which
defeats the whole point of mod_perl handlers.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: mod_perl training companies?

2002-03-25 Thread Randal L. Schwartz

>>>>> "Stas" == Stas Bekman <[EMAIL PROTECTED]> writes:

Stas> Can you please add a page stating that and I'll link to it.

The bottom paragraph of http://www.stonehenge.com/perltraining/courses.html
is our "catch all".  I'm no wizard at marketing, however.  It probably
all needs rewriting. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: mod_perl training companies?

2002-03-25 Thread Randal L. Schwartz

>>>>> "Stas" == Stas Bekman <[EMAIL PROTECTED]> writes:

Stas> Steven Lembark wrote:
>> http://www.stonehenge.com/
>> http://www.stonehenge.com/perltraining/

Stas> Steven, They don't give mod_perl courses, at least I couldn't find any.

We don't have any courses off-the-rack.  But we custom build anything,
and have in the past.

The problem with on-site mod_perl training is that every customer will
be different. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: 0 being appended to non mod_perl scripts.

2002-03-21 Thread Randal L. Schwartz

>>>>> "Mike" == Mike Wille <[EMAIL PROTECTED]> writes:

Mike> I am encountering a wierd problem where perl scripts running under a normal
Mike> cgi-bin (ie no mod_perl) have a '0' appended to the output.

I've seen this happen when people mistakenly write:

print system "foo";

instead of

print `foo`;

but of course they should have written:

system "foo";

instead.

As to why it's not happening in an Apache::Registry script, I cannot
say.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: SUCCESS: libapreq working in Mac OS X

2002-02-22 Thread Randal L. Schwartz

>>>>> "Joe" == Joe Schaefer <[EMAIL PROTECTED]> writes:

Joe> OTOH, I'd like to solicit some feedback on yet another installation 
Joe> process- first making libapreq a shared library, and then linking
Joe> the Perl interfaces to *that* library (instead of libapreq.a).

Beware.  When I made mod_perl a .so, and then loaded that, I could not
load any other .so's from there, making all XS modules fail.  So
having an .so call an .so might not work.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: [OT] Really need Comments! very strange bug that happens only on Linux.

2002-02-19 Thread Randal L. Schwartz

>>>>> "Vlad" == Vlad Safronov <[EMAIL PROTECTED]> writes:

Vlad> "3238200"? The answer is NO! Try this example on your Linux box

Vlad> ResultSum = 1;
Vlad> Sum = 323.82;

Vlad> the Buffer value is very strange! I have no ideas how Buffer can be 3238199!
Vlad> FreeBSD (old 3.x) works well and Buffer=3238200 as it should be, but on
Vlad> Linux 6.2, 7.0 it is 3238199..

Vlad> Any ideas?

Yes.  Learn that 1/10 doesn't have a precise representation in binary,
so *all* floating point numbers are "approximate".

Perhaps you've just not gotten bitten before.  Welcome to adulthood. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: [WOT] Google Programming Contest.

2002-02-07 Thread Randal L. Schwartz

>>>>> "Dave" == Dave Rolsky <[EMAIL PROTECTED]> writes:

Dave> In the Slashdot discussion, there's a link to a usenet posting by a Google
Dave> employee which explicitly says only C++ or Java, no Perl or Lisp.

"A google employee" is perhaps only an opinion though.  Is it the
group running the contest?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: [WOT] Google Programming Contest.

2002-02-07 Thread Randal L. Schwartz

>>>>> "Bill" == Bill Moseley <[EMAIL PROTECTED]> writes:

Bill> Sorry for the Way Off Topic, and sorry if I missed this on the list already:
Bill> http://www.google.com/programming-contest/

Bill> They say C++ or Java.  What, no Perl?

No, they say "must use our C++ interface routines", and "no closed-source
solutions".  If you provide an open source package, you must
tell where and how to download and build.

Thus, Perl is fine.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: mod_perl Developer's Cookbook

2002-02-01 Thread Randal L. Schwartz

>>>>> "Paul" == Paul Lindner <[EMAIL PROTECTED]> writes:

Paul> Now you're talking!  I wonder if YAS would consider funding
Paul> perl-related projects like mod_perl?  Perhaps if we had a big name
Paul> (Ticketmaster?) we could get the ball rolling on such a thing..

YAS isn't a magic bullet.  YAS can certainly act as a tax-exempt
pipeline, but you're really asking "can the mod_perl community find it
amongst themselves to fund a developer or two similar to how Damian
was funded last year?"

Maybe.  Maybe not.

Until Damian and Dan and Larry get funded for this year, probably not. :)
-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Fast template system

2001-12-30 Thread Randal L. Schwartz

>>>>> "Ryan" == Ryan Thompson <[EMAIL PROTECTED]> writes:

Ryan> I've looked at TT (and have heard it's praises sung), but it requires
Ryan> Perl 5.6.0,

Wrong.  I'm running it on 5.5.3 just fine.  Where did you see it
requires 5.6.0?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: PerlEditor - Freeware or Trialware

2001-12-25 Thread Randal L. Schwartz

>>>>> "Anand" == Anand Ratnasabapathy <[EMAIL PROTECTED]> writes:

Anand> Can any one help me with a Nice Editor for 
Anand> working on Perl-cgi,
Anand> Must be trial or freeware for me to test.

GNU Emacs is free.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: mixing cgi-bin & mod_perl

2001-12-20 Thread Randal L. Schwartz

>>>>> "Luciano" == Luciano Miguel Ferreira Rocha <[EMAIL PROTECTED]> writes:

Luciano> I would just use:

Luciano> find . -type f -print0 | xargs -0 perl -spi -e 
's/cgi-bin\/some_scr.pl/mod-perl\/some_scr.pl/g;'

Ewww.  Why two processes?

use File::Find;
@ARGV = ();
find sub { push @ARGV, $File::Find::name if -f }, ".";
$^I = ""; # or ".bak"
while (<>) {
  s/cgi-bin(\/some_scr.pl)/mod-perl$1/g;
  print;
}

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: A request's Origins

2001-11-21 Thread Randal L. Schwartz

>>>>> "Andy" == Andy Sharp <[EMAIL PROTECTED]> writes:

Andy> If you're simply looking for which link they clicked on to bring them to
Andy> this particular page/screen; it should be stored in $ENV{HTTP_REFERER}

Unless that value is wrong (sometimes), faked (possibly), or stripped
(by a security-conscious user, browser, or gateway).

REFERER is just a hint.  Trust it about as far as you can throw
your computer.  Laptops don't count. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Doing Authorization using mod_perl from a programmers perspective

2001-11-19 Thread Randal L. Schwartz

>>>>> "Jon" == Jon Robison <[EMAIL PROTECTED]> writes:

Jon> Randall, you want to expound upon that?

Barely ignoring the spelling of my name, I'll simply claim

"it's not unique".

Neither is IP address.  Or anything that you haven't specifically
round-tripped to the browser.  And that doesn't stop someone from
making another browser respond in the same way, or that browser
respond in a different way.

But this is obvious.  I'm confused about why I'd have to explain it. :(

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Doing Authorization using mod_perl from a programmers perspective

2001-11-19 Thread Randal L. Schwartz

>>>>> "fliptop" == fliptop  <[EMAIL PROTECTED]> writes:

fliptop> i have found that using the HTTP_USER_AGENT environment
fliptop> variable instead of ip address solves the problem with proxy
fliptop> servers and the md5 hash.  anyone ever tried this as a simple
fliptop> workaround?

Nobody with any sense.  It's flawed.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Mac OSX 10.1 - mod_perl build instructions

2001-11-08 Thread Randal L. Schwartz


Apparently, mod_perl wants to be built static into Apache on OSX, and
yet wants to use mod_so to load any additional thingies like
Apache::Request or Apache::Template.  So after many hours of trying
different combinations of things, I finally yelled out "Yippee Skippee"
(a phrase my dad firmly installed in my brain) when I stumbled
across this combination of things:

So, here's the current, verynicelyworking config.status for
Apache, and the build instructions for mod_perl with Apache:

1) unpack mod_perl from the CPAN, and execute

 sudo perl Makefile.PL \ 
 APACHE_SRC=/opt/apache/1.3.22/src/apache_1.3.22/src \
 NO_HTTPD=1 \ 
 USE_APACI=1 \ 
 PREP_HTTPD=1 \ 
 EVERYTHING=1 
 # hit return a bunch of times
 sudo make all install

2) then go to your apache installation, and execute

 sudo ./configure \ 
  "--with-layout=GNU" \ 
  "--prefix=/opt/apache/1.3.22" \ 
  "--activate-module=src/modules/perl/libperl.a" \ 
  "--enable-module=most" \ 
  "--enable-shared=max" \ 
  "--disable-shared=perl"
 sudo make all install

fixing "prefix" to be wherever you want.  I'm sticking all local
installs under /opt/PACKAGE/VERSION/* so I can quickly see what I've
added.  I usually ln -s /opt/PACKAGE/VERSION/bin/* to /usr/local/bin
so that I can invoke the commands, though.

And there it is... so nobody else has to tweak the same way I did.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Shared memory caching revisited (was "it's supposed to SHARE it, not make more!")

2001-09-04 Thread Randal L. Schwartz

>>>>> "Christian" == Christian Jaeger <[EMAIL PROTECTED]> writes:

Christian> I haven't announced it on other forums (yet). (I think it's
Christian> more of a working version yet that needs feedback and some
Christian> work to make it generally useable (i.e. under
Christian> mod_perl). Which forum should I post on?)

If you put it on the CPAN with a version number below 1, that's
usually a clue that it's still alpha or beta.  Then you can announce
it through the normal module announcement structures.

If you hide it, I'm sure not installing it.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Shared memory caching revisited (was "it's supposed to SHARE it, not make more!")

2001-09-04 Thread Randal L. Schwartz

>>>>> "Perrin" == Perrin Harkins <[EMAIL PROTECTED]> writes:

>> Uhh... good point, except that I don't trust the Cache code.  The
>> AUTHOR isn't ready to put his stamp of approval on the
>> locking/updating.

Perrin> That sort of hesitancy is typical of CPAN.  I wouldn't worry
Perrin> about it.  I think I remember Randal saying he helped a bit
Perrin> with that part.

I helped with the code that ensures that *file* writes are atomic
updates.  I taught DeWitt the trick of writing to a temp file, then
renaming when ready, so that any readers see only the old file or the
new file, but never a partially written file.

I don't think Cache::Cache has enough logic for an "atomic
read-modify-write" in any of its modes to implement (for example) a
web hit counter.  It has only "atomic write".  The "last write wins"
strategy is fine for caching, but not for transacting, so I can see
why Rob is a bit puzzled.

It'd be nice if we could build a generic "atomic read-modify-write",
but now we're back to Apache::Session, which in spite of its name
works fine away from Apache. :)

Caching.  An area of interest of mine, but I still don't seem to get
around to really writing the framework I want, so all I can do is keep
lobbing grenades into the parts I don't want. :) :) Sorry guys. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: OT: Re: ApacheCon Dublin Cancelled?

2001-07-16 Thread Randal L. Schwartz

>>>>> "Bill" == Bill Moseley <[EMAIL PROTECTED]> writes:

Bill> Well, this is more along the "price" issue that you don't want
Bill> to hear about, but I much prefer a single fee for everything
Bill> instead of separate tutorial and conference fees.

So you'd rather the overall price be increased, based on the average
cost of attending a decent number of the tutorials?  Wouldn't that be
unfair to those that are attending *just* the conference?

Bill> I understand the scheduling hell, but I like the flexibility to
Bill> decide what to attend during the conference.  What I attend in
Bill> the morning may influence what I attend in the afternoon.

The problem is materials.  Since the tutorials hand out some
significant paper, it's hard to decide how much repro to do in
advance, unless you know in advance.  Also, without enough advance
signups, the tutorial speakers themselves need to get cancelled, since
they (we :) are an actual hard cost with cutoff deadlines for
cancellation.  And, how big of a room should you have, if people can
just wander in and out?

A conference with casual tutorial signup or walk-in is a logistical
nightmare for the organizers.  Don't expect it to happen anytime soon
on any professional conference *I* present at. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Requests using If-Modified-Since cause response Set-Cookie to be discarded

2001-06-21 Thread Randal L. Schwartz

>>>>> "Doug" == Doug MacEachern <[EMAIL PROTECTED]> writes:

Doug> i passed it along the same day:
Doug> http://hypermail.linklord.com/new-httpd/2001/Jun/0507.html

Doug> still awaiting response on my interpretation of the rfc, seems perfectly
Doug> valid to include the set-cookie header with a 304 response.

Uh, it seems a bit fishy to me.  "nothing's changed, but by the way,
set this cookie please".  Why change a cookie if nothing else has
changed?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: mod_perl bof Oreilly Conference TShirts

2001-06-18 Thread Randal L. Schwartz

>>>>> "Gunther" == Gunther Birznieks <[EMAIL PROTECTED]> writes:

Gunther> A month ago I posed a question about TShirts for mod_perl BOF.
Gunther> One group of people did volunteer to do the design and posted interest
Gunther> on here. So if they are still up for it, it would be awesome to start
Gunther> discussing ideas/proof of concept.

Gunther> However, before such a thing can be discussed, unfortunately no one
Gunther> has come up to be able to sponsor the cost for the T-Shirts. So I
Gunther> figure I would raise the question again in case someone has a company
Gunther> that would be willing to corporate sponsor such a thing.

I'm already pumping out about 750 T's at TPC, so I don't think I can
be Yet Another Sponsor.  However, I've got a producer that can make
shirts at Very Reasonable Prices, or I wouldn't be doing this in the
first place, and would be happy to set you up with them (it's a mom
and pop shop here near my neck of the woods, and we have a nice
relationship with them).

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: IP based instant throttle?

2001-06-08 Thread Randal L. Schwartz

>>>>> "Ken" == Ken Williams <[EMAIL PROTECTED]> writes:

Ken> [EMAIL PROTECTED] (Randal L. Schwartz) wrote:
>> It would be pretty simple, basing it on my CPU-limiting throttle that
>> I've published in Linux Magazine
>> <http://www.stonehenge.com/merlyn/LinuxMag/col17.html>.  Just grab a
>> flock on the CPU-logging file in the post-read-request phase instead
>> of writing to it.  If you can't get the flock, reject the request.
>> Release the flock by closing the file in the log phase.
>> 
>> But this'd sure mess up my ordinary visit to you, since my browser
>> makes 4 connections in parallel to fetch images, and I believe most
>> browsers do that these days.

Ken> I was thinking about that too, and concluded that you'd only want to
Ken> throttle the back-end server in a 2-server setup.  That would usually
Ken> (save for subrequests) only be 1 request throttled per page-load.  I
Ken> tend not to care about the front-end, because overload is rarely a
Ken> problem there.

Well, if the reason you're throttling is to block excessive usage of
the machine, the full monty of CPU limiting will do that just fine,
since images are delivered quickly, but anything that eats CPU starts
pushing the counter up to the max.  That's why I have my CPU
throttler, and it worked fine to prevent me from being "slashdotted"
that one day I was mentioned there.  I'm told that my CPU throttler
was used at etoys.com for a similar purpose, and permitted them to
keep from losing millions of dollars of revenue due to people
spidering their catalog.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: IP based instant throttle?

2001-06-07 Thread Randal L. Schwartz

>>>>> "Justin" == Justin  <[EMAIL PROTECTED]> writes:

Justin> Does anyone see the value in a Throttle module that looked at
Justin> the apache parent status block and rejected any request where
Justin> another child was already busy servicing *that same IP* ?
Justin> (note: the real IP is in the header in a backend setup so it
Justin>  is not possible to dig it out across children without
Justin>  creating another bit of shared memory or using the filesystem?).

Justin> I'm still finding existing throttle modules do not pickup and
Justin> block parallel or fast request streams fast enough .. ok there are
Justin> no massive outages but 10 seconds of delay for everyone because
Justin> all demons are busy servicing the same guy before we can conclude
Justin> we're being flooded is not really great.. modperl driven forums
Justin> (or PHP ones even) can be killed this way since there are so
Justin> many links on one page, all active.. 

It would be pretty simple, basing it on my CPU-limiting throttle that
I've published in Linux Magazine
<http://www.stonehenge.com/merlyn/LinuxMag/col17.html>.  Just grab a
flock on the CPU-logging file in the post-read-request phase instead
of writing to it.  If you can't get the flock, reject the request.
Release the flock by closing the file in the log phase.

But this'd sure mess up my ordinary visit to you, since my browser
makes 4 connections in parallel to fetch images, and I believe most
browsers do that these days.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: [OT] mod_mime_magic in perl?

2001-05-31 Thread Randal L. Schwartz

>>>>> "Issac" == Issac Goldstand <[EMAIL PROTECTED]> writes:

Issac> Well, it looks great except that most of the types are just
Issac> different flavors of text/plain...  If you do implement real
Issac> magic files (look at the files the Apache uses for good example
Issac> magic files), or even get a bigger list in your module, PLEASE
Issac> let me know.  Aside from that lack, it's perfect for me.

There's File::MMagic in the CPAN, extracted from the file(1) PPT
command, which uses standard magic-format files.  You could certainly
hook that up to do your equivalent of mod_mime_magic.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: modify Server header via a handler

2001-05-01 Thread Randal L. Schwartz

>>>>> "newsreader" == newsreader  <[EMAIL PROTECTED]> writes:

newsreader> randal s. posted a way to do that
newsreader> sometime back.  search for it in
newsreader> the archive.  his stonehenge
newsreader> website apparently uses the same trick.

If he's already doing it in the fixup phase, that's where I'm doing it
too, so that's probably not going to work.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: from the "quick hacks" department... x-bit controls mod_cgi

2001-04-12 Thread Randal L. Schwartz

>>>>> "Tim" == Tim Bunce <[EMAIL PROTECTED]> writes:

Tim> On Wed, Apr 11, 2001 at 08:22:38PM -0700, Randal L. Schwartz wrote:
>> 
>> In an .htaccess, I place:
>> 
>> Options +ExecCGI
>> PerlFixupHandler "sub { -f $_[0]->filename and -x _ and 
>$_[0]->handler(q{cgi-script}) }"
>> 
>> Now any executable file in this directory (or below) is processed with
>> mod_cgi.  Any non-executable file is processed with whatever the MIME
>> engine came up with before.
>> 
>> OK, too cool to not pass on. :)

Tim> Except that I think you'll find that string is being recompiled for
Tim> each request - slow and leaks memory. The principle is good though :)

Well, then, untested:

.htaccess:

PerlFixupHandler Stonehenge::XBitCGI
Options +ExecCGI

$INC/Stonehenge/XBitCGI.pm

sub Stonehenge::XBitCGI::handler {
  -f $_[0]->filename and -x _ and $_[0]->handler(q{cgi-script});
  return -1;
}

Better? :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



from the "quick hacks" department... x-bit controls mod_cgi

2001-04-11 Thread Randal L. Schwartz


In an .htaccess, I place:

Options +ExecCGI
PerlFixupHandler "sub { -f $_[0]->filename and -x _ and 
$_[0]->handler(q{cgi-script}) }"

Now any executable file in this directory (or below) is processed with
mod_cgi.  Any non-executable file is processed with whatever the MIME
engine came up with before.

OK, too cool to not pass on. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: mod_perl BOF

2001-03-29 Thread Randal L. Schwartz

>>>>> "Pierre" == Pierre Phaneuf <[EMAIL PROTECTED]> writes:

Pierre> Stas Bekman wrote:
>> Last week I was presenting mod_perl at the Linux World Show in Singapore
>> and we had a really nice social event with a babe belly dancer... hey,
>> Gunther was dancing with her... just look at his happy face :)

Pierre> Man, when I see stuff like that, I know I'm in the right business.

/me jots down notes for Stonehenge TPC5 party

:-)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: [OT] ApacheCon BOF

2001-03-28 Thread Randal L. Schwartz

>>>>> "Geoffrey" == Geoffrey Young <[EMAIL PROTECTED]> writes:

>> Might this be a good time to consider Cafe Press, then?

Geoffrey> as it turns out, the graphics house was actually the sponsor

Geoffrey> them bailing means that we don't even get a design...

If it's designs you want, I could probably get Stonehenge's graphic
house to contribute the design.  Same guy that did the new Stonehenge
logo and the "knife" brochure last year.  He's very good.

Especially if it's my "mod_perl: over 42 billion served" idea. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: [OT] ApacheCon BOF

2001-03-23 Thread Randal L. Schwartz

>>>>> "Tim" == Tim Sweetman <[EMAIL PROTECTED]> writes:

Tim> (But Trademark Difficulties(tm) probably take out this idea; there are
Tim> better legal fights to be had).

But in the US, we have safe harbor because of the 2 live crew supreme
court case.  This is a parody, remember!?

Of course, you're own your own if you export the shirt to
international waters... :)

If you just stick with the original idea, there's not a helluva lot
they can claim about TM dilution or confusion of services offered.  I
actually thought about both of those issues when I came up with the
idea.  That's why it was a serious idea.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Fw: Re: [OT] ApacheCon BOF

2001-03-22 Thread Randal L. Schwartz

>>>>> "Bakki" == Bakki Kudva <[EMAIL PROTECTED]> writes:

Bakki> It is Tux the Linux Penguin acting like that character from the
Bakki> movie "the Predator" with a Gatling gun strapped across his
Bakki> chest with perl bullets (on the ammo belt and shooting out of
Bakki> the muzzle) and when they hit the target they splash into web
Bakki> pages. If this appeals to the list some one with a better
Bakki> "artistic license" than I can do a better job of rendering
Bakki> it. :) I did it in a couple of minutes with Gimp.

But mod_perl is not just Linux.  mod_perl runs just fine on those
redmond-based so-called "operating systems", as well as BSD (little
devil, anyone?) and Unix, and starting saturday, MacOS X!

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: [OT] ApacheCon BOF shirts

2001-03-20 Thread Randal L. Schwartz

>>>>> "Dave" == Dave Rolsky <[EMAIL PROTECTED]> writes:

Dave> So as not to be a total spoilsport, I would like to point out that I
Dave> thought Randal's idea (Mcmod_perl?) was rather clever and I think it'd be
Dave> cool (though I don't know if there are trademark issues).

Remember.  It's a Parody.  Safe harbor.  2 Live Crew bought us that (or
was it some other rap-ish group... I can't recall).

And it wouldn't be "mc".  Just the golden m.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: [OT] ApacheCon BOF

2001-03-20 Thread Randal L. Schwartz

>>>>> "Geoffrey" == Geoffrey Young <[EMAIL PROTECTED]> writes:

Geoffrey> sorry Randal - I guess I just found it so funny that I
Geoffrey> didn't think you were really serious about it (I saw the big
Geoffrey> glowing M and nearly snarfed my coffee :)

As a professional comedian, I *demand* that my name may or may not be
Randal.  No, no, I demand that my jokes be treated with RESPECT!


:-)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: [OT] ApacheCon BOF

2001-03-20 Thread Randal L. Schwartz

>>>>> "Geoffrey" == Geoffrey Young <[EMAIL PROTECTED]> writes:

>> > still need more suggestions for a theme that aren't tongue-in-cheek,
>> 
>> lol! Why, I thought that was the idea!!!

Geoffrey> well, of course - but much folly leaves the list innundated with (albeit
Geoffrey> funny) postings but not much for me to work with...

Geoffrey> (it's all Randall's fault ;)

I actually was seriously suggesting mine.  You didn't specify any
design criterion that would rule mine out.  What was wrong with mine?

/me feels hurt that his idea wasn't taken seriously...

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: [OT] ApacheCon BOF

2001-03-19 Thread Randal L. Schwartz

>>>>> "Sean" == Sean C Brady <[EMAIL PROTECTED]> writes:

Sean> 42,539,693,877 to be exact...  sorry Nick!  :)

42 billion has the right sound to it.  It's "the answer", after all,
a billion times over. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: [OT] ApacheCon BOF

2001-03-19 Thread Randal L. Schwartz

[ugh - next time, don't be a top-quoter - bleh]

>>>>> "Nick" == Nick Tonkin <[EMAIL PROTECTED]> writes:

>> "mod_perl: 20 billion hits served"
>> And turn the "m" into a stylized arch. :)

Nick> er, maybe 20 trillion ... ? seeing as how ValueClick alone has done a bit
Nick> over 42 billion since 6/98 ... :)

yeah, I was hoping valueclick would jump out and give me a better number.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: [OT] ApacheCon BOF

2001-03-19 Thread Randal L. Schwartz

>>>>> "Geoffrey" == Geoffrey Young <[EMAIL PROTECTED]> writes:

Geoffrey>   What I don't have are any ideas for a shirt theme.  The
Geoffrey> sponsor will be taking care of all the graphics work
Geoffrey> required - just your mental capital is needed.

"mod_perl: 20 billion hits served"
And turn the "m" into a stylized arch. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: List your software with new feature-based search engine

2001-03-15 Thread Randal L. Schwartz

>>>>> "BigSofte" == BigSofte Vendor Services <[EMAIL PROTECTED]> writes:

BigSofte> Dear Software Manufacturer:

I didn't know people still "manufacture" software.  I thought
only marketing "manufactured" things.

BigSofte> We can help you make it much easier to promote your software
BigSofte> on the Internet.

Yeah, that's already so terribly difficult.  I'm glad you're here to
help me!  Otherwise, I'd be limited to putting up a website, or maybe
starting a mailing list, or maybe having papers presented at
conferences, or submitting entries to Freshmeat, or maybe writing
books or columns, or possibly even word-of-mouth, or making sure my
website is parseable by Google, because that's where all my friends
use for searching.  Boy, I'm glad there's YET ANOTHER PROMOTION
MECHANISM!  Lemme guess... it consists of spamming unrelated mailing
lists!  Did I get it right?

"List your software with new feature-based search engine"

I think I'd rather list with a bug-based search engine, thank you.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: [OT] UNIX timestamp hits 1,000,000,000 this year!

2001-03-09 Thread Randal L. Schwartz

>>>>> "Bill" == Bill Desjardins <[EMAIL PROTECTED]> writes:

Bill> Just as a FYI about something that caught my attention recently. This year
Bill> on Saturday September 8, 2001, the unix time stamp flips to 1 billion and
Bill> gets another digit going from 9 to 10 digits. Not sure if anyone else but
Bill> me is using the timestamp in ways that were set to 9 digits, such as DB
Bill> column int length or in strings of fixed lengths, but these possibilities
Bill> should be looked at just in case they could fail when the time changes to
Bill> the longer int.

Bill> Just a heads up, hope it helps someone.

I've been showing it on my homepage for the past 6 months.
For an RSS file with the timestamp, invoke

http://www.stonehenge.com/u1e9.html

And yes, I've written programs that will definitely break on that
time.  So if I've done it, I bet others have done it as well.

The sad thing is that unlike Y2K, this thing cuts in all at the same
time all over the world.  Fun fun fun.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: [H/OT] time to vote

2001-03-03 Thread Randal L. Schwartz

>>>>> "Stas" == Stas Bekman <[EMAIL PROTECTED]> writes:

Stas> I guess I've missed Paul, sorry Paul. Anyway the voting is
Stas> compulsory :)

Vote early, vote often.

http://www.stonehenge.com/merlyn/WebTechniques/col43.html

:-)

THE PRECEDING INFORMATION IS INTENDED FOR HUMOR PURPOSES ONLY.
NO ACTUAL BALLOT STUFFING SHOULD OCCUR. THAT WOULD BE UNFAIR.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: [OT] re:advocacy at perl.com

2001-02-16 Thread Randal L. Schwartz

>>>>> "Gunther" == Gunther Birznieks <[EMAIL PROTECTED]> writes:

Gunther> Too tired to think of clever plugs for myself or I would be doing so.

you know I'd never (see my .sig) plug anything (see my .sig) like
that in the body (see my .sig) of a message.  That'd be
(see my .sig) crass commercialism.

:-)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: bug repository???

2001-02-14 Thread Randal L. Schwartz

>>>>> "Joseph" == Joseph Crotty <[EMAIL PROTECTED]> writes:

Joseph> Is there any sort of mod_perl bug repository??

You mean where the bugs live?  I think that's called "the source code".

:-)

"bug reports" would be a different matter.  I presume Doug is keeping
track of those.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Redirection Location MUST be absolute (was Re: Send a cookie, AND a redirect ?)

2001-02-08 Thread Randal L. Schwartz

>>>>> "Robert" == Robert Landrum <[EMAIL PROTECTED]> writes:

Robert> That's what the RFC says... But that's not the way that a browser
Robert> handles it.  I don't know why browsers don't support the "standards,"
Robert> but that's not exactly the topic.

Robert> Every browser I've ever tested with, including LWP, lynx and AOL, have
Robert> supported relative Location headers.

No... they've never seen one in their life.  See below.

Robert> If the W3 wants to document it incorrectly or change the unofficial
Robert> standard, then they are wasting their time.

Wait... let's start getting some terminology straight.  Let's stop
talking about "relative" and "absolute" URLs with respect to the
Location: CGI response.  That's just gonna confuse terminology.

If a CGI script sends out a Location: header that doesn't begin with a
protocol (like http: or ftp:), then it's an *internal* redirect.

For an internal redirect, the browser never sees the transaction.  The
web server just does a "goto", picking up the new resource, delivering
the content to the browser AS IF IT WAS THE OLD URL.  The browser
doesn't even know it happened (thus the problem I said earlier about
relative URLs in the delivered document being broken).

If there was a Set-Cookie header on this internal redirect, THE
BROWSER NEVER SEES IT.

If the CGI script instead sends a protocol first in the Location,
(like http://perltraining.stonehenge.com), that's an *external*
redirect, and turns into one of the headers sent to the browser, along
with a Set-Cookie if present.  The *browser* then fetches the new URL
as a separate transaction.

Nearly always, what you want is an *external* redirect.  The relative
URLs in the new document are correct, and cookies get set as needed.

If you are using an *internal* redirect, BE VERY VERY CAREFUL THAT
THIS IS WHAT YOU WANT.  Nearly always... *never*.

Does that help?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Redirection Location MUST be absolute (was Re: Send a cookie, AND a redirect ?)

2001-02-08 Thread Randal L. Schwartz

>>>>> "Robert" == Robert Landrum <[EMAIL PROTECTED]> writes:

Robert> By using relative *URLs* such as /some/location, you avoid changing
Robert> the location field in the browser window, which is often desired.  If
Robert> you use an absolute *URL*, the location field changes to the absolute
Robert> URL.

Actually, I'll disagree with that.  NEVER use internal redirects
(which you call "relative URLs" but that's another story) unless you
are fully understanding about WHY *I* say *NEVER*, in my strongest
language.

As a hint... are you willing to be responsible for how all the
relative URLs in the resulting document are treated, including all
documents called from there?

The problem is that the browser still thinks it got
"/foo/bar/fred.html", so if an internal redirect was performed to
"/abc/def/ghi.html" and it had a relative link to "../xyz.html", the
browser will fetch "/foo/xyz.html", not to the correct
"/abc/xyz.html", since the browser had no visibility to the /abc part
of that equation.

NEVER use internal redirects.

At least not until you understand why I say "NEVER".

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: How to recognize server shutdown?

2001-01-10 Thread Randal L. Schwartz

>>>>> "Stas" == Stas Bekman <[EMAIL PROTECTED]> writes:

Stas> On Wed, 10 Jan 2001, Perrin Harkins wrote:
>> On Wed, 10 Jan 2001, Dave Rolsky wrote:
>> > Is there any way to distinguish between a child being shutdown (say
>> > maxrequests has been exceeded) versus all of Apache going down (kill
>> > signal sent to the original process or something).
>> 
>> Register an END block in your startup.pl, and have it check it's PID to
>> see if it's the parent.

Stas> It doesn't work. I've tested:

Here's an idea... in the startup code, create a pipe and fork.
block the kid on a read.  ni-night, kid.

when the parent quits, the kid will get EOF, and can go off and clean
things up.

in fact, it won't get the EOF until *all* the processes sharing the
write-end have quit, so it would seem to be exactly what is needed.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Javascript - just say no(t required)

2001-01-05 Thread Randal L. Schwartz

>>>>> "Les" == Les Mikesell <[EMAIL PROTECTED]> writes:

Les> I think it is also very reasonable to store user-selected preferences
Les> in cookies, especially for things likes sizes, colors, fonts for
Les> certain pages.  Why should the server side have to store millions
Les> of things like that?  Even if it does, the choices may be different
Les> for the same user running a different browser.   Normally you
Les> would have some default that would work for the cookie-challenged
Les> folks anyway.

Please remember that the cookie space is spec'ed to be limited. So
your cookie may get pushed out for others. So there'd better be a way
to trivially reload all that stuff, or your customers will be angry.
Might as well be nice, store the info server side, and treat it
like a login.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Javascript - just say no(t required)

2001-01-05 Thread Randal L. Schwartz

>>>>> "Gunther" == Gunther Birznieks <[EMAIL PROTECTED]> writes:

Gunther> There's a lot of similar FUD about using cookies (not accepted on
Gunther> PDAs, people scared of them, etc). Personally, I don't like to program
Gunther> using cookies and I have my browser explicitly warn me of the cookie
Gunther> before accepting (which does slow down my browsing experience but is
Gunther> most interesting),, but the reality is that shedloads of sites use
Gunther> them to enhance the user experience but don't make it a problem if
Gunther> they don't go and use them.

I'm fine with requiring and using cookies for short-term session
management, but for long term authentication, they presume "one user
== one browser", and that's patently false.

If you must use them for long term identification, make it very clear
that I'm "logged in", and give me a quick way to "log out", and let me
"log in" from a different browser, and automatically "log me out"
after 4 hours or so in case I forget. :) And don't do that merely by
browser cookie expiration... make the server distrust any cookie after
that time, which means you have to generate a unique cookie on each
login.

Gunther> Speaking of which, I guess the non-use of Cookies and
Gunther> JavaScript would make a great NY Resolution...

What does New York have to do with it? :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Javascript - just say no(t required)

2001-01-04 Thread Randal L. Schwartz

>>>>> "Gunther" == Gunther Birznieks <[EMAIL PROTECTED]> writes:

Gunther> But I've also seen a lot of people use javascript to accomplish the
Gunther> same thing as a quick fix. Few browsers don't support javascript. Of
Gunther> the small amount that don't, the venn diagram merge of browsers that
Gunther> don't do javascript and users with an itchy trigger finger is very
Gunther> small. The advantage is that it's faster than mungling your own
Gunther> server-side code with extra logic to prevent double posting.

My browser "supports" Javascript, but has it turned off whenever I'm going
to an unknown web page.

Presuming that the CERT notices are being posted widely enough, there
are demonstratably *more* people with Javascript turned off today than
ever before.

That means you can use Javascript to enhance the experience, but I'll
come over and rip your throat out (if I knew your address) if you make
it required for basic services.

And don't forget the corporate firewalls that strip Javascript for
security reasons.  And the hundreds of new "net devices" showing up
that understand HTTP and XHTML, but nothing about Javascript.

Javascript.  Just say no(t required).

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: getting rid of multiple identical http requests (bad users double-clicking)

2001-01-04 Thread Randal L. Schwartz

>>>>> "Ed" == Ed Park <[EMAIL PROTECTED]> writes:

Ed> Has anyone else thought about this?

If you're generating the form on the fly (and who isn't, these days?),
just spit a serial number into a hidden field.  Then lock out two or
more submissions with the same serial number, with a 24-hour retention
of numbers you've generated.  That'll keep 'em from hitting "back" and
resubmitting too.

To keep DOS attacks at a minimum, it should be a cryptographically
secure MD5, to prevent others from lojacking your session.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: vars vs fqdn vs our benchmark

2000-12-26 Thread Randal L. Schwartz

>>>>> "Stas" == Stas Bekman <[EMAIL PROTECTED]> writes:

Stas> Note that Perl 5.6.0 introduced a new our() pragma which works like
Stas> my() scope-wise, but declares global variables.

Stas>   package MyPackage3;
Stas>   use strict;
Stas>   our @ISA = qw(CGI);
Stas>   our $VERSION = "1.00";
Stas>   1;

Stas> which uses the same amount of memory as a fully qualified global
Stas> variable:

Stas>   % perl -MGTop -MMyPackage3 -le 'print GTop->new->proc_mem($$)->size'
Stas>   1908736

You still need a note there that says that 5.6.0 is considered unusable
by conservative sysadmins, and until 5.6.1 has reached gold, you
should avoid using "our".

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: experience on modperl-killing "vacuum bots"

2000-12-20 Thread Randal L. Schwartz

>>>>> "Justin" == Justin  <[EMAIL PROTECTED]> writes:

Justin> So I also simply outright ban these user agents:

Justin> (EmailSiphon)|(LinkWalker)|(WebCapture)|(w3mir)|
Justin> (WebZIP)|(Teleport Pro)|(PortalBSpider)|(Extractor)|
Justin> (Offline Explorer)|(WebCopier)|(NetAttache)|(iSiloWeb)|
Justin> (eCatch)|(ecila)|(WebStripper)|(Oxxbot)|(MuscatFerret)|
Justin> (AVSearch)|(MSIECrawler)|(SuperBot 2.4)

Here's my list, after running Stonehenge::Throttle for probably
longer than you have... :)

or m{Offline Explorer/} # bad robot!
or m{www\.gozilla\.com} # bad robot!
or m{pavuk-}# bad robot!
or m{ExtractorPro}  # bad robot!
or m{WebCopier} # bad robot!
or m{MSIECrawler}   # bad robot!
or m{WebZIP}# bad robot!
or m{Teleport Pro}  # bad robot!
or m{NetAttache/}   # bad robot!
or m{gazz/} # bad robot!
or m{geckobot}  # bad robot!
or m{nttdirectory}  # bad robot!
or m{Mister PiX}# bad robot!
or m{ia_archiver}   # bad robot!
or m{DIIbot/}   # bad robot!
or m{WhizBang!} # bad robot!
or m{WebCopy/}  # bad robot!
or m{WebStripper/}  # bad robot!
or m{EmailSiphon}   # bad robot!
or m{AlkalineBOT}   # bad robot! (in Perl!)

That last one is nasty.  A Perl bot that basically sucks full speed.
Evil.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: mod_perl training

2000-12-20 Thread Randal L. Schwartz

>>>>> "Gunther" == Gunther Birznieks <[EMAIL PROTECTED]> writes:

Gunther> Anyway, I know this topic has been very quiet since last
Gunther> week. But I just wanted to say that I don't want to let it
Gunther> die (for those that expressed interest), and I am definitely
Gunther> still interested even if I am going to shutup for the next
Gunther> week (which many of you may be happy about). :)

We at Stonehenge have also taken very seriously all the comments
spoken here so far, and have been having direction-setting
conversations amongst our development team based in part on the what
I've heard recently.  We can't make any announcements just yet, but I
hope you'll be pleased when we do.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Mod_perl tutorials

2000-12-14 Thread Randal L. Schwartz

>>>>> "Gunther" == Gunther Birznieks <[EMAIL PROTECTED]> writes:

Gunther> OK. One thing I was considering is that instead of being a monolithic
Gunther> mod_perl class that it should be broken into modules with recommended
Gunther> ways of piecing together the modules based on the amount of time
Gunther> people had.

Gunther> Eventually then each module can having stats on it like how long it
Gunther> takes to teach that module. If a module is a good module but takes an
Gunther> awkward amount of time to teach (eg 4 hours) then maybe some material
Gunther> in that module can moved to another one.

Gunther> So if someone wanted to teach mod_perl at Perl Mongers in two 3-hour
Gunther> sessions, we could recommend a certain set of modules. And then if
Gunther> someone had 2-days to teach someone at work, then XYZ set of modules
Gunther> would be recommended, and if someone has a week, we have some advanced
Gunther> modules at the end.

For Stonehenge classes, we usually design an ifdef'ed slide set 4
ways: "short" "short with exercises" "long" "long with exercises".
Maybe we could do something like that here.

META COMMENT...

Maybe it's time we spun off a mailing list for this discussion,
    unless it's still interesting to the rest of the onlookers.
Anyone care to host it or take that on?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: [OT]: Open Source ... was Re: Advocacy idea ...

2000-12-14 Thread Randal L. Schwartz

>>>>> "Stas" == Stas Bekman <[EMAIL PROTECTED]> writes:

Stas> Personally I've found that it's much easier to find a few coders that you
Stas> believe that their style is good and learn from their code. In my early
Stas> days I've learned a great deal of idiomatic Perl coding from Randal's
Stas> columns: 

(blush)

Stas> http://www.stonehenge.com/merlyn/WebTechniques/
Stas> http://www.stonehenge.com/merlyn/UnixReview/

And don't forget the newest member of the family:

http://www.stonehenge.com/merlyn/LinuxMag/

Yeah, 2.5 column ideas a month.  Please, if you have ideas, let me know!
Get your name in print in a 100K+ circulation magazine!

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Mod_perl tutorials

2000-12-14 Thread Randal L. Schwartz

>>>>> "Stas" == Stas Bekman <[EMAIL PROTECTED]> writes:

>> It will always be take23, that I can assure you of. I'm a geek, and its a
>> geeky name, and I'm very happy with it. The other domain names pointing at
>> it or redirecting to it would be most welcome, but I'm not yet considering
>> another rename.

Stas> Hmm, doesn't look like most of the folks here agree with you. But since it
Stas> was your initiative you are the king. 

I saw myself as the only one who *didn't* like it.  I just posted so
often that maybe you thought I was multiple people. :)

But I'm cool with the name as long as there's a prominent link of "why
'take23'?" somewhere up front, so that others can learn why as well.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Mod_perl tutorials

2000-12-13 Thread Randal L. Schwartz

>>>>> "Gunther" == Gunther Birznieks <[EMAIL PROTECTED]> writes:

Gunther> I would be against PPT if StarOffice couldn't read and write those
Gunther> files. But since there is a Linux alternative, I would prefer a slide
Gunther> format stored in the format that slides are made for.

Gunther> Unless of course, anyone has experience with StarOffice being
Gunther> particularly bad at this. In which case, maybe we do have to start
Gunther> with POD or XML for everytthing including the slides.

Well, StarOffice doesn't run on my Mac. :) But when Darwin finalizes,
that'll probably be a moot point, presuming someone compiles
StarOffice for Darwin.

However, a better format for interchange would almost certainly be
something like XML or (horrors) POD.  A text-ish format would make
diffs from CVS make more sense anyway.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Mod_perl tutorials

2000-12-13 Thread Randal L. Schwartz

>>>>> "Matt" == Matt Sergeant <[EMAIL PROTECTED]> writes:

Matt> Suggestions for ways to help that would be most appreciated.

Make a link on the left on the home page "why the name take23?".
Then clever people like me can read it, and remember the name
much better.

/me scuffles off to register no-args.org now... :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Mod_perl tutorials

2000-12-13 Thread Randal L. Schwartz

>>>>> "Matt" == Matt Sergeant <[EMAIL PROTECTED]> writes:

Matt> On 13 Dec 2000, (Randal L. Schwartz) wrote:
>> They really also belong on perl.apache.org, unless take23 is supposed
>> to be taking over that responsibility, or unless take23 will have a
>> VERY PROMINENT link on perl.apache.org.

Matt> I wouldn't say "taken over" but I can say you'll see more frequent updates
Matt> on take23, and it'll always be prettier :-)

Well, then, I'd ask for the perl.apache.org folks to "bless" the
take23.org site by linking to it prominently, along with a context
so that visitors know why some things are on perl.apache.org and
others are on take23.org.

And admittedly, the perl.org/pm.org/perl.com split is never clear to
most visitors (or even to the people who maintain it).  I'm just
afraid of another arbitrary demarcation like this.

Matt> It will always be at modperl.sergeant.org too, but there's no secret
Matt> mnemonic. Well there is a connection to mod_perl (I wouldn't have just
Matt> plucked a name out of mid air), but I'm not going to just reveal it, even
Matt> though someone has already figured it out. Maybe one day it will become an
Matt> FAQ.

Matt> For now, try a bookmark.

That doesn't help me remember it when I'm on a strange browser, or
trying to tell some people in front of a room.  But now that I know
the secret mnemonic, it'll help.

If you want traffic on your site, pick a way for people to remember it
when they walk into an internet cafe or when they are talking to
others in the hall.  Clever secret names suck, until you're the first
hit in google. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



  1   2   3   >