RE: Can't get a mod_perl.so...

2003-09-04 Thread Garrett Goebel
Title: RE: Can't get a mod_perl.so...





Rich Kosiba wrote:
> 
> I've read the documentation several times and searched
> the web, but can't find an answer to my problem. I
> can't get a mod_perl.so.


I believe you are looking for libperl.so


--
Garrett Goebel
IS Development Specialist


ScriptPro   Direct: 913.403.5261
5828 Reeds Road   Main: 913.384.1008
Mission, KS 66202  Fax: 913.384.2180
www.scriptpro.com  garrett at scriptpro dot com





RE: FW: $r->headers_out Location and Set-Cookie

2003-09-04 Thread Garrett Goebel
Title: RE: FW: $r->headers_out Location and Set-Cookie





Geoffrey Young wrote:
> Garrett Goebel wrote:
> > [Note: reposting, the original post appears to have dropped 
> > through the cracks]
> 
> not only did I get two of these already, but I also posted a reply :)


My bad. It was an old thread and I didn't scan far enough through the list archives.


Problem must be at the company mail server. I've been getting infrequent diagnostic messages from various mailing list daemons.

Apologies...


--
Garrett Goebel
IS Development Specialist


ScriptPro   Direct: 913.403.5261
5828 Reeds Road   Main: 913.384.1008
Mission, KS 66202  Fax: 913.384.2180
www.scriptpro.com  garrett at scriptpro dot com





FW: $r->headers_out Location and Set-Cookie

2003-09-04 Thread Garrett Goebel
Title: FW: $r->headers_out Location and Set-Cookie





[Note: reposting, the original post appears to have dropped through the cracks]


Geoffrey Young wrote:
> > That's when you use Apache::compat, doing the mp1 syntax. 
> > In mp2-speak that would be:
> > 
> >   $r->err_headers_out->add('Set-Cookie' => $packed_cookie);
> >   $r->headers_out->set('Location' => $url);
> >   $r->status(REDIRECT);
> > 
> > notice that you don't need to call $r->send_http_header, it
> > doesn't exist in mp2.
> 
> not to mention it's entirely unnecessary (and undesirable) to 
> send headers on error responses such as redirects.


Why?


Appendix A.7 from the Stas' Practical mod_perl book states:


> You should use err_headers_out( ), not headers_out( ),
> when you want to send cookies in a REDIRECT response or
> in any other non-2XX response


And gives the following recipe:


  Example A-3. redirect_cookie.pl
  use Apache::Constants qw(REDIRECT OK);
  my $r = shift;
  # prepare the cookie in $cookie
  $r->err_headers_out->add('Set-Cookie' => $cookie);
  $r->headers_out->set(Location => $location);
  $r->status(REDIRECT);
  $r->send_http_header;
  return OK;


How would you have written it? 


 
> and you should never set $r->status from a handler - for 
> Registry scripts it's ok, since we use it as a hack to get
> around some things, but handlers should never manipulate the
> value of $r->status.


Why is that?



--
Garrett Goebel
IS Development Specialist


ScriptPro   Direct: 913.403.5261
5828 Reeds Road   Main: 913.384.1008
Mission, KS 66202  Fax: 913.384.2180
www.scriptpro.com  garrett at scriptpro dot com





RE: collecting unique client (computer) specific info? [OT] [x-adr][x-bayes]

2003-09-03 Thread Garrett Goebel
Title: RE: collecting unique client (computer) specific info? [OT] [x-adr][x-bayes]





Ged Haywood wrote:
> 
> On Wed, 3 Sep 2003, kfr wrote:
> 
> > the hardware address is really what I'm after.
> 
> What hardware?


He's looking for a MAC address, cpu id, etc. something to fix the identity of the remote host.


Nobody's up and told him that it just isn't possible. Which from the mod_perl books and documentation I've read... appears to be the case.

--
Garrett Goebel
IS Development Specialist


ScriptPro   Direct: 913.403.5261
5828 Reeds Road   Main: 913.384.1008
Mission, KS 66202  Fax: 913.384.2180
www.scriptpro.com  garrett at scriptpro dot com





RE: $r->headers_out Location and Set-Cookie

2003-09-03 Thread Garrett Goebel
Title: RE: $r->headers_out Location and Set-Cookie





Geoffrey Young wrote:
> > That's when you use Apache::compat, doing the mp1 syntax. 
> > In mp2-speak that would be:
> > 
> >   $r->err_headers_out->add('Set-Cookie' => $packed_cookie);
> >   $r->headers_out->set('Location' => $url);
> >   $r->status(REDIRECT);
> > 
> > notice that you don't need to call $r->send_http_header, it
> > doesn't exist in mp2.
> 
> not to mention it's entirely unnecessary (and undesirable) to 
> send headers on error responses such as redirects.


Why?


Appendix A.7 from the Stas' Practical mod_perl book states:


> You should use err_headers_out( ), not headers_out( ),
> when you want to send cookies in a REDIRECT response or
> in any other non-2XX response


And gives the following recipe:


  Example A-3. redirect_cookie.pl
  use Apache::Constants qw(REDIRECT OK);
  my $r = shift;
  # prepare the cookie in $cookie
  $r->err_headers_out->add('Set-Cookie' => $cookie);
  $r->headers_out->set(Location => $location);
  $r->status(REDIRECT);
  $r->send_http_header;
  return OK;


How would you have written it? 


 
> and you should never set $r->status from a handler - for 
> Registry scripts it's ok, since we use it as a hack to get
> around some things, but handlers should never manipulate the
> value of $r->status.


Why is that?



--
Garrett Goebel
IS Development Specialist


ScriptPro   Direct: 913.403.5261
5828 Reeds Road   Main: 913.384.1008
Mission, KS 66202  Fax: 913.384.2180
www.scriptpro.com  garrett at scriptpro dot com





Source for Apache::Test documentation on perl.apache.org

2003-08-28 Thread Garrett Goebel
Title: Source for Apache::Test documentation on perl.apache.org





As I stated in a previous post, I'm coming up to speed on Apache::Test by working from Stas's documentation at http://perl.apache.org/docs/general/testing/testing.html.

I remember seeing a few typos on my first pass through the documentation. Now that I've got a simple


  perl Makefile.PL
  make
  make test
  make install


Working with Apache::Test support, I thought I'd go back through the docs with more of an eye to detail. When I run past those typos again, I'd like to be able to submit patches and ask questions. So... Is the source for that document publically available? and What would be most appropriate: post patches and questions here, to Stas directly, or somewhere else?

 
-- 
Garrett Goebel 
IS Development Specialist 
ScriptPro   Direct: 913.403.5261 
5828 Reeds Road   Main: 913.384.1008 
Mission, KS 66202  Fax: 913.384.2180 
www.scriptpro.com  garrett at scriptpro dot com 
 





Apache::Test unable to locate libperl.so?

2003-08-28 Thread Garrett Goebel
Title: Apache::Test unable to locate libperl.so?





I'm trying to come up to speed on Apache::Test. I'm working from Stas's documentation at http://perl.apache.org/docs/general/testing/testing.html. My system is roughly:

gentoo linux 1.4
perl 5.8.0 useithreads=undef useperlio=define
apache 1.3.28
mod_perl 1.3.28
Apache::Test 1.04 (2003/08/28 cvs snapshot)


I ended up having to patch TestConfig.pm so that it could locate libperl.so. TestConfig.pm's find_apache_module method doesn't try the /usr/lib/apache-extramodules directory... Which is where Gentoo linux likes to put it. A few searches on google suggest Mandrake may put things there as well.

I don't know the story on "extramodules"... If anyone is familiar with it please point me to any documentation or rational on why it exists and what advantage it offers. I hate finding customizations without a clue as to why they're there.

Anyways what follows is my best guess on a reasonable way to locate it when trying to find modules.


--- /home/ggoebel/src/mp2/modperl-2.0/Apache-Test/lib/Apache/TestConfig.pm
2003-08-13 17:15:38.0 -0500
+++ TestConfig.pm   2003-08-28 15:17:52.0 -0500
@@ -637,6 +637,7 @@
 my @trys = grep { $_ }
   ($vars->{src_dir},
    $self->apxs('LIBEXECDIR'),
+   $self->apxs('LIBEXECDIR').'-extramodules',
    catfile($sroot, 'modules'),
    catfile($sroot, 'libexec'));


--
Garrett Goebel
IS Development Specialist


ScriptPro   Direct: 913.403.5261
5828 Reeds Road   Main: 913.384.1008
Mission, KS 66202  Fax: 913.384.2180
www.scriptpro.com  garrett at scriptpro dot com


 




testconfig.pm.patch
Description: Binary data

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

Re: Application design patterns

2003-07-24 Thread Garrett Goebel
Title: Re: Application design patterns





Perrin Harkins wrote:
> 
> The biggest thing the article didn't cover is the ideas
> used by the guys coding the more interactive parts of the
> application to express the state machine implemented by
> each of their modules in a declarative data structure.
> This was largely invented by Adam Sussman, who is at
> TicketMaster now.  It was similar to what you see in
> CGI::Application and some of the other frameworks.


Has anyone written an article on it?


Or is this still in the domain of: go read the CGI::Application code and sort it out for yourself?


This is a topic I've been wondering about recently. I don't have a background in CS. So, I always wonder when tempted to head off into the books... whether or not the return-on-investment will justify the time I could have spent kludging something together that's good enough.

I've noted a few FSM modules on CPAN:


DFA::Command
DFA::Simple
DFA::Kleene
POE::NFA
Bio::Tools::StateMachine::AbstractStateMachine


After sifting through google searches I turned up the following article:


Essay on Web State Machines by Charles Stross
http://www.antipope.org/charlie/attic/webbook/essays/statemach.html


Interactive Web Applications Based on Finite State Machines
http://www.math.luc.edu/~laufer/papers/isas95.pdf


--
Garrett Goebel
IS Development Specialist


ScriptPro  Direct: 913.403.5261
5828 Reeds Road    Main:   913.384.1008
Mission, KS 66202  Fax:    913.384.2180
www.scriptpro.com  garrett at scriptpro dot com





reverse proxy in depth tutorial?

2003-07-24 Thread Garrett Goebel
Title: reverse proxy in depth tutorial?





This is slightly off-topic, but as it hits on Mason, optimizing mod_perl for performance, and is covered in passing in the practical and mod_perl cookbook books, I figured I'd ask here first.

Can anyone point me toward a good in depth article or documentation on using reverse proxying with apache? And no, I'm sorry but the apache reference docs on modules and directives is too spartan. I'm looking to minimize memory utilization and maximize performance, and am slowly working through the tips from the books and available online documentation. 

Most everything I'm stumbled upon has been short on detail and examples. For instance, I never found an example of how to just reverse proxy everything for a given backend server. All the examples I saw showed how to proxy something like http://foo/bar but not http://foo. Eventually I came up with the following:

[Reverse Proxy]
...
Listen 192.168.1.1:80
RewriteEngine on
RewriteRule ^/?(.*) http://127.0.0.1:80/$1 [P]
ProxyPassReverse / http://127.0.0.1:80/
...


[Backend Server]
...
Listen 127.0.0.1:80
...


Is this kosher? 


Is there a better way to do this? 


A way to do it without mod_rewrite using only mod_proxy directives?


Are there any strong arguments against using a mod_proxy/mod_rewrite httpd accelerator? Or preferred alternatives?


Using the loopback for the backend has the security advantage of completely isolating the backend from any direct communication with external hosts. How do I keep the backend on 127.0.0.1 _and_ handle name based virtual hosts?

What are the issues with regard to virtual hosting and ssl?


Any tips on keeping the config files maintainable?


For instance if I'm doing a mason site with co-branding through multiple component roots... What would minimal configurations for proxy and backend servers look like in order to redirect an externally exposed ip address on the proxy to a backend on 127.0.0.1 and still preserve the name based virtual hosts? It that possible? What are the variations, tradeoffs, and issues scaling it out to multiple physical servers? etc.

--
Garrett Goebel
IS Development Specialist


ScriptPro  Direct: 913.403.5261
5828 Reeds Road    Main:   913.384.1008
Mission, KS 66202  Fax:    913.384.2180
www.scriptpro.com  garrett at scriptpro dot com





RE: MS SQL Server [x-adr]

2003-06-18 Thread Garrett Goebel
Title: RE: MS SQL Server [x-adr]





Matt Sergeant wrote:
> On Wed, 18 Jun 2003, Cosimo Streppone wrote:
> > 1) lack of placeholders support with DBD::Sybase + Freetds layer.
> >    I used freetds 0.53, but 0.61 had the same problem for me.
> 
> Ah, that explains why people are using unixODBC with the TDS driver
> instead. I assume that supports placeholders (?).


Yep. 0.61 has support for placeholders and odbc call sytax. There are a couple syntax issues which are resolved in CVS. But if you check the mailing list archives you should be able to get things working.

 
--
Garrett Goebel
IS Development Specialist


ScriptPro  Direct: 913.403.5261
5828 Reeds Road    Main:   913.384.1008
Mission, KS 66202  Fax:    913.384.2180
www.scriptpro.com  garrett at scriptpro dot com





RE: Very[OT]:Technical query re: scratchpad lookups for my() vars

2001-03-15 Thread Garrett Goebel
Title: RE: Very[OT]:Technical query re: scratchpad lookups for my() vars





From: Paul [mailto:[EMAIL PROTECTED]]
> 
> Anybody know offhand *why* my() lexicals are supposedly faster?


Because a dynamic variable allocates a "new" value at runtime which occludes the global value until it's scope expires. In contrast, a lexical variable is unique to its code value's (CV) context which was determined at parse time. However, if you recursively call that CV, then Perl has to allocate a new value for the lexical.

Urban legend says that lexicals are on average 10% faster than dynamic variables. I wonder if that is true... and what difference recursion makes. I wonder how you'd write a script to benchmark that and actually benchmark the right thing...