Re: [RFC] Apache-GeoIP module

2002-10-27 Thread T.J. Mather
Hi,

The database that is included with Apache-GeoIP is from March 2002.
The latest database (October 2002) is more accurate, and may correctly 
locate your IP address.  We have an online demo here:
http://www.maxmind.com/app/lookup

Note that we offer a free subscription to database updates for Open Source 
projects and for people/companies who have made significant Open Source 
contributions.  Please let me know if you are interested.

-TJ

On Fri, 25 Oct 2002, Richard Clarke wrote:

> My IP is from the netherlands apparently :(
> Can't even get quality british IP's these days... sheesh
> 
> Ric(England).
> 




Re: [RFC] Apache-GeoIP module

2002-10-27 Thread T.J. Mather
Hi,

Thanks for your patch - you brought up a good point.  We are actually 
fixing the C library so that it returns NULL instead of '--' - so the Perl 
XS should automatically return undef now instead of '--'.

-TJ

On Fri, 25 Oct 2002, Michael Schout wrote:

> One thing I'd add if you do decide to use the Geo::IP module, it does 
> not behave as documented if it does not find a match. The docs say it 
> returns "undef", but in fact it returns the string "--".  The attached 
> patch fixes that problem.  I've sent the patch to the GeoIP folks, and 
> got no reply.  I'll try sending it to [EMAIL PROTECTED] and see if 
> someone gets it that way :).
> 
> Mike




Re: IP based instant throttle?

2001-06-07 Thread T.J. Mather

Hi Justin,

What about the case where you would have several people accessing
the site from behind a firewall at the same time?  They would appear to be
coming from the same IP Address.

> On Friday, June 8, 2001, at 01:50  am, Justin wrote:
> 
> > Does anyone see the value in a Throttle module that looked at
> > the apache parent status block and rejected any request where
> > another child was already busy servicing *that same IP* ?




Re: comparison of templating methods?

2001-06-06 Thread T.J. Mather

On Thu, 7 Jun 2001, Steve Smith wrote:

> > HTML::Embperl
> 
> For me, this has one major win over the other toolkits: auto form
> population from a hash.  The online mortgage application system I

You may also fill in HTML forms with Apache::ASP and
Apache::PageKit.  With PageKit it automatically gets the data from the
request parameters, but you may also set it using the fillinform method
from the Model.  Both of these applications use HTML::FillInForm to fill
in the HTML Forms.




ANNOUNCE: PageKit 1.00

2001-05-17 Thread T.J. Mather

PageKit 1.00 has been released.  PageKit is a mod_perl based web
application framework that uses HTML::Template and XML to separate
the Model, View, Content and Controller. Provides elegant solutions to
many difficult web programming problems, including session management,
language localization, authentication, form validation, and
co-branding. 

For more information, see
http://pagekit.org

For downloads, see
http://cpan2.org/Asset/display?dist=Apache-PageKit

Comments and suggestions welcome.

-TJ




Re: modperl/ASP and MVC design pattern

2001-04-20 Thread T.J. Mather

> But are there in the mod_perl architecture some guidelines and/or frameworks
> that encourages the  MVC design patern ?

Apache::PageKit is a MVC based framework.  You can find it on CPAN here:

http://cpan2.org/Asset/display?dist=Apache-PageKit

I wrote an article on it for take23:

http://take23.org/articles/2001/01/04/pagekit.xml




[OT] Re: Search Engine Theory

2001-02-27 Thread T.J. Mather

You might want to look at DBIx::FullTextSearch, a perl module for indexing
documents using MySQL as a backend.  It supports different frontends and
backends, and has a nice modular design (IMHO).

http://cpan2.org/Asset/display?dist=DBIx-FullTextSearch

On Tue, 27 Feb 2001, Jamie Krasnoo wrote:

> Can anyone point me to any documents on search engine theory and programming
> search engines with perl?
> 
> Jamie Krasnoo
> www.MyEBoard.com
> [EMAIL PROTECTED]
> 
> 

_________
T.J. Mather http://tjmather.com
http://cpan2.org/   New CPAN Search Engine
http://www.anidea.com/  Digital Asset Management
http://www.theinnkeeper.com/Bed and Breakfast Directory




RFC: mod_proxy_add_uri.c Apache module

2001-02-25 Thread T.J. Mather

I have written a module for Apache which sets the X-Original-URI field
to the original URI when doing a ProxyPass, similar to what
mod_proxy_add_forward.c does for the remote IP address.
 
The code is available at http://tjmather.com/mod_proxy_add_uri.c

Any comments or suggestions welcome.

_
T.J. Mather http://tjmather.com
http://cpan2.org/   New CPAN Search Engine
http://www.anidea.com/  Digital Asset Management
http://www.theinnkeeper.com/Bed and Breakfast Directory




Re: SQL log analyzer for Apache::DBILogger

2001-02-06 Thread T.J. Mather

On Mon, 5 Feb 2001 [EMAIL PROTECTED] wrote:

> Sometime in the next month I need to embark on a log analyzer for the logs
> we've been accumulating for many moons via Apache::DBILogger.  Has anyone
> made any effort to do such a thing already?  I've dug around the web for a
> while and come up with zilch.

I have a script that reads the logs from the database and dumps it out to
a flat file in the standard format Apache uses when writing access_log,
then I run a program called webalizer on it.  I actually don't use
Apache::DBILogger, but the database table is similar to the table
generated by Apache::DBILogger.
_____________
T.J. Mather http://tjmather.com
http://cpan2.org/   New CPAN Search Engine
http://www.anidea.com/  Digital Asset Management
http://www.theinnkeeper.com/Bed and Breakfast Directory




INIT Blocks under mod_perl

2001-02-02 Thread T.J. Mather

Does anybody know if INIT blocks work under mod_perl?  I was trying to get
Geography::States to work under mod_perl and it doesn't seem to run the
code in the INIT block.  When I removed "INIT {" and the corresponding
"}" line from the Geography/States.pm file, the code ran fine.

I'm running mod_perl 1.24_01, Apache 1.3.14.

Thanks, TJ
_________
T.J. Mather http://tjmather.com
http://cpan2.org/   New CPAN Search Engine
http://www.anidea.com/  Digital Asset Management
http://www.theinnkeeper.com/Bed and Breakfast Directory




Re: Text::Template and passing in variables; going bug nuts!

2001-01-26 Thread T.J. Mather

Maybe I'm missing something here, but can't you just use

use strict;
use vars qw(%config %session);

or better yet, fully qualify your variables

%MyApp::Framework::config;
%MyApp::Framework::session;

The mod_perl guide has excellent sections on this:
http://perl.apache.org/guide/perl.html#Using_Global_Variables_and_Shari
http://perl.apache.org/guide/performance.html#Global_vs_Fully_Qualified_Varia

Also, there are a couple of useful modules on CPAN for inheriting class
data, not sure if they will apply in your case:

http://cpan2.org/Asset/display?dist=Class-Data-Inheritable
http://cpan2.org/Asset/display?dist=foundation

> Where I'm getting hosed is that %config and %session have data 
> I need visible to the Text::Template objects themselves.  I've
> RTFM'ed until my eyes are pink, and I see no options short of
> copying variables wholesale into another Package, but then I 
> still can't get at them and "use strict" can I?

_____________
T.J. Mather http://tjmather.com
http://cpan2.org/   New CPAN Search Engine
http://www.anidea.com/  Digital Asset Management
http://www.theinnkeeper.com/Bed and Breakfast Directory





[JOB NYC] WhenU.com seeks Perl developer

2001-01-22 Thread T.J. Mather

I'm just the messenger, contact Avi Naider directly:

-- Forwarded message --
Date: Fri, 19 Jan 2001 08:19:26 -0500
From: Avi Naider <[EMAIL PROTECTED]>
To: Princeton Career Network E-list <[EMAIL PROTECTED]>
Subject: WhenU.com seeks Perl developer

WhenU.com is looking for a strong Perl developer willing to start as a paid
consultant in the immediate future with potential transition to full time
employment within 1-2 months.   Work hard.  Have fun.  Be part of an NYC
company that’s revolutionizing the way people use the Internet and that has
recently been featured on CNN and in Time Magazine.  Our  WhenUShop software
product has grown from 3K to 120K users in 2 months and been named a “pick”
by CNET and “Head of the Herd” by Tucows.

WhenU has  a fast-paced, exciting and focused environment.  WhenU engineers
solve tough, complex technical and business challenges using leading
technologies.  WhenU’s products and services reside on the desktop and give
you the information you need at the moment you need it (see below for more
detail).

WhenU offers competitive salaries, full benefits and and pre-IPO equity to
all full time employees.  You will be an integral part of our small 20
person team, working in a collegial office environment in a small brownstone
in midtown Manhattan.

Job Responsibilities
o   “Overall” internet and intranet development for rapidly growing internet
software company
o   Server side web development and operations
o   Database design, development and operations
o   Internet client-server software design and development (server side)
o   Close collaboration with business development, html/designers and
Windows/C++ client engineers

Job Qualifications:
o   At least 2-3 years experience in web development using Perl, ModPerl and
Apache web server including demonstrated expertise with specific Perl-driven
development projects
o   Very strong UNIX background including knowledge of Linux administration
o   At least 2-3 years of relational database experience including schema
design, SQL coding and operations. Specific experience with MySQL is a plus.
o   Experience managing the operational issues of a highly active web site
while continuing with new product development
o   Undergraduate or advanced degree in computer science with strong academic
achievement
o   Excellent communication and collaboration skills
o   “Startup” mentality with the ability to thrive in hectic, challenging, and
fast-paced environment
o   Must be willing to work onsite (53d street and 2nd Avenue)

Interested candidates should contact [EMAIL PROTECTED] as soon as possible and
send resume and contact information.  Interviews will be conducted starting
this weekend.
We look forward to hearing from you!

Thanks
Avi Naider P '94

Detailed Company Description:
WhenU.com simplifies web browsing.  The company’s software resides on the
desktop, recognizes the web site visited by a user, and delivers
site-specific and category-specific content and services through a thin
vertical window adjacent to the browser.  For online activities such as
shopping, travel, searching, research, investing, etc., WhenU.com captures
the best of the web and packages, formats and delivers it straight to the
user in a manner that requires no user effort.  With its technology,
proprietary content and resonant brand identity, WhenU.com will become the
standard navigation enabler relied upon by Internet users as they undertake
common online activities.

WhenUShop, the first product launched by WhenU.com, simplifies the online
shopping experience dramatically.  Whenever a user visits a major retail
shopping site, WhenUShop recognizes the site and launches as a thin vertical
window on the left side of the browser.  Highly relevant -- yet often hard
to find -- information about the site is presented in a standardized format:
Contact information and response times, shipping rates, tax charges, return
policies, gift wrapping, site-specific rebates and coupons, credit card
security, privacy policy and more.   Users are introduced to price
comparison engines, online currencies, and other services and educated about
how to use them. WhenUShop streamlines the online shopping experience in a
quick, efficient, non-intrusive and convenient manner, saving consumers
money and time.

WhenU.com’s unique approach combines three powerful concepts to create a
very compelling product for users:
(1) Information Delivered When The User Needs It
WhenU.com delivers information to users precisely when they need it, instead
of requiring users to seek information.  WhenU.com leverages the work of a
full time staff of expert researchers over its entire user base, and ensures
that the relevant set of facts is right at the user’s fingertips -- without
requiring the user to do anything.
(2) Standardized Formats
Lack of standardization on the Internet creates considerable stress for
users.   WhenU.com standardizes

Re: [OT] All of Perldocs to HTML files

2001-01-16 Thread T.J. Mather

have you looked at Pod::Html ?

You can use that together with File::Find to convert a directory of pods.




Form Fillin with Apache::ASP

2001-01-10 Thread T.J. Mather

There is an easy way of doing auto form fillin with Apache::ASP using
HTML::FillInForm - for details see (credit goes to Paul Lindner)

http://search.cpan.org/doc/TJMATHER/HTML-FillInForm-0.07/lib/HTML/FillInForm.pm#Apache_ASP

and

http://forum.swarthmore.edu/epigone/modperl/malskalko

> > - No auto form fillin.  I know this has been discussed, I have even made
> > crude code that allows it.
> 
> I would like to develop this too.  Thanks for your feedback.
> So I take it you're not particularly interested in the
> compile time feature additions? :)




prob with dir_config at server startup

2000-12-27 Thread T.J. Mather

I'm having a problem accessing PerlSetVar variables with
Apache->server->dir_config at server startup.  I'm using the lastest
versions of mod_perl 1.24_01 and apache (1.3.14).

The problem occurs when I use PerlSetVar inside a Directory, Location or
Files section:

in httpd.conf:

PerlSetVar PKIT_ROOT /home/tjmather/Apache-PageKit/eg


perl startup code:
my $pkit_root = Apache->server->dir_config('PKIT_ROOT');
# $pkit_root = undef

But if I remove the Location directive, then it works fine:

in httpd.conf:
PerlSetVar PKIT_ROOT /home/tjmather/Apache-PageKit/eg

perl startup code:
my $pkit_root = Apache->server->dir_config('PKIT_ROOT');
# $pkit_root = '/home/tjmather/Apache-PageKit/eg'

Any ideas?




ANNOUNCEMENT: Apache::PageKit 0.91

2000-12-26 Thread T.J. Mather

There is a new version of PageKit available for download from CPAN.  For
more information, please go to

http://search.cpan.org/search?dist=Apache-PageKit

There has been a major API cleanup and rewrite of code base that makes it
faster and much easier to set up and use.  PageKit is still in alpha
stage, but it should move into beta as the version approaches 1.0.  

Description
---
PageKit is a web applications framework that is based on mod_perl.
This framework is distinguished from others such as Embperl and Mason
by providing a clear separation of programming, content and
presentation.

It does this by implementing a Model/View/Content/Controller paradigm:
- Model is user supplied Perl classes
- View is set of HTML::Templates
- Content is set of XML Files
- Controller is PageKit

This allows your programmers, designers and content editors to work
independently with clean well-defined interfaces.

PageKit provides the following features:
- Component-based architecture
- Language Localization
- Session Management
- Input Validation
- Sticky HTML Forms
- Authentication
- Co-branding
- Automatic Dispatching of URIs
- Easy Error Handling





[PATCH] Apache::test docs

2000-12-21 Thread T.J. Mather

Hi,

There is an error in the POD for Apache::test under the fetch method.  It
states that the return value of the fetch method is dependent on whether
it is called under a scalar or list context, when it is actually dependent
on whether it is called as a function or method.  I have attached the
patch for the POD.

Happy holidays,
T.J.


--- test.pm Thu Dec 21 23:03:13 2000
+++ test.pm.new Thu Dec 21 23:35:30 2000
@@ -625,8 +625,8 @@
 submission and we add a 'Content_Type' header with a value of
 'application/x-www-form-urlencoded'.

-In a scalar context, fetch() returns the content of the web server's
-response.  In a list context, fetch() returns the content and the
+If called as a function, fetch() returns the content of the web server's
+response.  If called as a method, fetch() returns the
 HTTP::Response object itself.  This can be handy if you need to check
 the response headers, or the HTTP return code, or whatever.



Re: [OT]umm...WTFM? [Re: advocacy]

2000-12-12 Thread T.J. Mather

> Anybody point me to one? 

online docs for Apache.pm :

http://search.cpan.org/doc/DOUGM/mod_perl-1.24_01/Apache/Apache.pm




RFC: Apache::Carp - Error Handling under mod_perl

2000-11-29 Thread T.J. Mather

I've done a lot of programming under mod_perl and I got tired of
examining the error logs for errors.  So I wrote a module that displays
to the broswer the error (with a complete call stack) for any fatals or
warnings that occur on a development server (similar to using CGI::Carp
qw(fatalsToBrowser);), or emails the site administrator for errors on a
production server.

This has been released on CPAN as Apache::PageKit::Error, but since it
doesn't depend on Apache::PageKit at all, I'm thinking of releasing it as
a seperate module.  Do you think this is worth doing?  What should it be
called?  Is Apache::Carp a good name?

Documentation can be found here (with the old Apache::PageKit::Error name)
http://search.cpan.org/doc/TJMATHER/Apache-PageKit-0.05/lib/Apache/PageKit/Error.pm


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Rapid prototyping and mirroring

2000-10-26 Thread T.J. Mather

> Also - I am sure I have read posts about text-search
> capabilities.  However when I visited the apache/modperl modules page, I
> was unable to find any modules to assist in text-searches.

DBIx::FullTextSearch

http://search.cpan.org/search?dist=DBIx-FullTextSearch

Perl module uses MySQL database backend to index files, web documents
and database fields. Supports must include, can include, and cannot
include words and phrases. Support for stop words and stemming.




Re: indexing and searching documents on your web server

2000-09-25 Thread T.J. Mather

> If you want something controllable via mod_perl then there are a couple of
> things in the CPAN, under the DBIx hierarchy. If you're not bothered about
> direct control, then you should check out htDig.

one of these is DBIx::FullTextSearch - it does require a MySQL database
though.  it offers must include, can include, cannot include words,
phrases, stop words and stemming.

for more information, check out
http://sourceforge.net/projects/fulltextsearch/




[ANNOUNCE] Apache::PageKit 0.04

2000-08-29 Thread T.J. Mather

PageKit is a new application framework that is based on mod_perl.
It is similar to HTML::Embperl, but separates the Perl from HTML by using
HTML::Template and can use XML to separate the content from presentation.

It is based on the Model/View/Content/Controller approach to design, and
includes session management, authentication, form validation, sticky html
forms, multiple views/co-branding, modules and includes, and a simple
content management system.

To view the docs, visit
http://search.cpan.org/search?dist=Apache-PageKit

To download,
http://www.cpan.org/authors/id/T/TJ/TJMATHER/Apache-PageKit-0.04.tar.gz

To join a general mailing list for discussion, visit
http://lists.sourceforge.net/mailman/listinfo/pagekit-users

If you are interested in joining the development effort, email me or sign
up for the developers list at
http://lists.sourceforge.net/mailman/listinfo/pagekit-devel

The best way to develop a site using PageKit is to start with the source
for http://www.pagekit.org/ which is located in the eg/ directory of the
distribution.

Any questions, comments or suggestions are welcome.  This module is in
early alpha stage and the API may change.

Have fun,
T.J. Mather




Re: [OT]starting a long running script

2000-08-29 Thread T.J. Mather

The easiest way to do this (IMHO) is to use the register_cleanup method in
mod_perl.  This gets executed at the very end of the request cycle after
the TCP connection gets closed.  See page 367 of the Eagle book for
details...

Basically you want to do this:

$r = Apache->request;
$r->register_cleanup( sub { system("/path/to/your/script.pl"); } );

-T.J. Mather

On Tue, 29 Aug 2000, martin langhoff wrote:

>   i need to start a long-running script from either mod_perl or mod_cgi,
> and I'm facing all the well-known issues: the apache child waits, until
> it waits no longer (maybe because the browser itself chose to close the
> TCP connection, maybe because of an internal timeout), and then the
> script gets killed. 
> 
>   there is no useful information to echo back to the user, besides
> teloing him the script started ok.
>   
>   the problem is: while I'm familiar with the problems, but not with the
> solutions. I've read that one possible solution is to use fork(), but I
> have no experience with it, and not much understanding of its
> implications, and after reading perlfunc I'm more confused than before. 




Re: Advice on migrating modperl from NT to Linux ?

2000-08-26 Thread T.J. Mather

> Also, another piece of advice for what it's worth.  If your going to 
> add SSL, build and test apache with mod-perl first, and then go back 
> and add SSL.  There may well be a work-around that I'm not aware of, 
> but basically the problem is that mod-ssl is looking for an encryption 
> key on startup, and mod-perl doesn't know anything about that.  The 
> result is that the server won't start and the mod-perl tests won't run. 

Better yet, don't put mod_perl and mod_ssl on the same server.  The
mod_perl guide has an excellent section on running seperate 'light' and
'heavy' servers.  Basically you want to have a front end mod_ssl 'light'
server for images and HTML, and 'heavy' server backend for mod_perl.  All
requests get tunneled through the 'light' server by using
mod_proxy so as long as the traffic between your 'light' and 'heavy'
servers is secure, you'll be fine.

See
http://perl.apache.org/guide/strategy.html#Do_Not_Put_mod_ssl_into_a_mod_pe




Re: Args and Params.

2000-08-25 Thread T.J. Mather

I'm not sure about this but the problem might be that CGI is attempting to
read the POST data first, and since POST data can only be read from the
socket once, $r->content hangs.

You might want to look into either

1. caching POSTed Data:
http://perl.apache.org/guide/snippets.html#Caching_POSTed_Data

2. using Apache::Request, a module that implements the
CGI::param method, but does it in mod_perl and is a lot faster




Re: expiring pages with mod_perl

2000-08-20 Thread T.J. Mather

use

my $headers = $r->headers_out;
$headers->{'Pragma'} = $headers->{'Cache-control'} = 'no-cache';
$r->no_cache(1);

for more information see
http://perl.apache.org/guide/correct_headers.html#2_1_3_Expires_and_Cache_Control

On Sun, 20 Aug 2000, Jamie Krasnoo wrote:

> Sorry for the newbie question but could anyone tell me how to expire pages
> so a user can't use the back button to get back to that page?
> 
> 
> Thanks,
> Jamie
> 




Re: Centralized Caching

2000-08-20 Thread T.J. Mather

You might want to look into IPC::SharedCache or IPC::Shareable.  These
modules cache variables in shared memory.




Re: [new module] Apache::PageKit

2000-08-16 Thread T.J. Mather

> > Here is a brief description of the module:
> > PageKit is a set of Perl modules that provides an application
> > framework based on mod_perl and HTML::Template. It is based on the
> > Model/View/Controller approach to design, with complete seperation
> > of Perl from HTML. It includes session management, authentication, form
> > validation, sticky html forms, multiple views, modules and includes, and a
> > content management system.
> 
> Can you expand on the functionality of the CMS part?

For now, the CMS part is really simple.  There are links on every page to
edit the HTML template components, if the user has permission to edit.
These links link to an edit page which edits the HTML template using one
big textarea box.

What would be much cooler would be to use XML and a content editor that
would translate an XML file into HTML form elements for places in the XML
document that the user can edit.  There is an interesting chapter (7) in
Open Source Linux Web Programming on this.

I am moving this discussion to [EMAIL PROTECTED], which
is a newly created list for discussing Apache::PageKit. To subscribe, go to
http://lists.sourceforge.net/mailman/listinfo/pagekit-users

-TJ




Re: [new module] Apache::PageKit

2000-08-16 Thread T.J. Mather

I got a couple of e-mails asking where this module could be found.  I plan
to release the module in a few days on CPAN.  I will make an announcement
on this list when I do. 

-TJ Mather




[new module] Apache::PageKit

2000-08-16 Thread T.J. Mather

I have an addition for the Apache/Perl Module List, under PerlHandler's

PageKit cmpOApplication framework w/ HTML::Template TJMATHER

Here is a brief description of the module:
PageKit is a set of Perl modules that provides an application
framework based on mod_perl and HTML::Template. It is based on the
Model/View/Controller approach to design, with complete seperation
of Perl from HTML. It includes session management, authentication, form
validation, sticky html forms, multiple views, modules and includes, and a
content management system.




[BUG FIX] Apache.xs write_client

2000-08-09 Thread T.J. Mather

There are differences in the variable after a non-global substitution vs.
a global substitution.  After a non-global substitution, a reference to
the scalar value is of type SVt_PVIV, as opposed to SVt_PV for global
substituion.

So I changed write_client() Apache.xs to also check if the reference is of
type SVt_PVIV, and it now works.

Doug, could you apply this patch to Apache.xs?  Thanks.
Also, thanks to Ken Williams for the useful pointers.

PATCH:
--- Apache.xs.old   Wed Aug  9 10:23:31 2000
+++ Apache.xs   Wed Aug  9 10:23:13 2000
@@ -1076,7 +1076,7 @@

 for(i = 1; i <= items - 1; i++) {
int sent = 0;
-SV *sv = SvROK(ST(i)) && (SvTYPE(SvRV(ST(i))) == SVt_PV) ?
+SV *sv = SvROK(ST(i)) && (SvTYPE(SvRV(ST(i))) == SVt_PV || 
+SvTYPE(SvRV(ST(i))) == SVt_PVIV) ?
  (SV*)SvRV(ST(i)) : ST(i);
buffer = SvPV(sv, len);
 #ifdef APACHE_SSL

TEST CODE:
#!/usr/bin/perl
use Devel::Peek;
$text1 = "hello";
$text2 = "hello";
$text3 = "hello";
$text2 =~ s/hello/hi/;
$text3 =~ s/hello/hi/g;
print "reference to variable without any substitution\n";
Dump \$text1;
print "\nreference to variable after non-global substitution\n";
Dump \$text2;
print "\nreference to variable after global substitution\n";
Dump \$text3;

TEST OUTPUT:
reference to variable without any substitution
SV = RV(0x8100370) at 0x80ea8f8
  REFCNT = 1
  FLAGS = (TEMP,ROK)
  RV = 0x80f8ca8
  SV = PV(0x80eabc4) at 0x80f8ca8
REFCNT = 2
FLAGS = (POK,pPOK)
PV = 0x80f7868 "hello"\0
CUR = 5
LEN = 6

reference to variable after non-global substitution
SV = RV(0x8100370) at 0x80ea8f8
  REFCNT = 1
  FLAGS = (TEMP,ROK)
  RV = 0x80f8c54
  SV = PVIV(0x80eb010) at 0x80f8c54
REFCNT = 2
FLAGS = (POK,OOK,pPOK)
IV = 3  (OFFSET)
PV = 0x80efa1b ( "hel" . ) "hi"\0
CUR = 2
LEN = 3

reference to variable after global substitution
SV = RV(0x8100370) at 0x80ea8f8
  REFCNT = 1
  FLAGS = (TEMP,ROK)
  RV = 0x80fd160
  SV = PV(0x80eabac) at 0x80fd160
REFCNT = 2
FLAGS = (POK,pPOK)
PV = 0x80f75a0 "hi"\0
CUR = 2
LEN = 6

Ken Williams wrote:
> T.J., if you grok XS you might have a look at this part of
> write_client() in Apache.xs:
> 
> for(i = 1; i <= items - 1; i++) {
> int sent = 0;
> SV *sv = SvROK(ST(i)) && (SvTYPE(SvRV(ST(i))) == SVt_PV) ?
>  (SV*)SvRV(ST(i)) : ST(i);
> buffer = SvPV(sv, len);
> 
> 
> Try looking at your $text with Devel::Peek to see whether there are any
> differences in what it contains in the two cases.




weird print bug?

2000-08-08 Thread T.J. Mather

Hi,

I'm running into some very strange behaviour with Apache::print.  print() 
is supposed to dereference any arguments that are scalar references.

However it doesn't work if you apply a non-greedy substitution operator on
the scalar.

The following code outputs in my browser:

CODE:
sub handler {
  my $r = shift;
  my $text = "hello world";
  $text =~ s/hello/hi/;
  $r->print(\$text);
}

OUTPUT:
SCALAR(0x89bd084)

What's really weird is that it works if i change the
substitution operator to greedy:

CODE:
sub handler {
  my $r = shift;
  my $text = "hello world";
  $text =~ s/hello/hi/g;# <--- changed to /g
  $r->print(\$text);
}

OUTPUT:
hi world

Any ideas?  I'm running Perl 5.6.0/mod_perl 1.24/Apache 1.3.12 on Linux
2.2.12 (red hat 6.1) on i686.

Thanks,
T.J. Mather




Re: YAM (Yet Another Module) - an IPC shared cache thing - anyoneinterested ?

2000-07-22 Thread T.J. Mather

Have you considered using HTML::Template?  It is a simple yet powerful way
to seperate HTML from Perl code.  It can do loops (good for HTML 
tables), includes, and if/unless/else statements.  Furthermore, it has
shared memory for templates built in.

http://theoryx5.uwinnipeg.ca/mod_perl/cpan-search?dist=HTML-Template-1.8