Re: Trying to find correct format for PerlSetVar's -- or get Apache::AuthNetLDAP working.

2001-05-30 Thread Thomas Eibner

On Wed, May 30, 2001 at 10:30:50PM -0500, Steven Lembark wrote:
> problem seems to be that i'm not getting the PerlSetVar's 
> across to it via perly config:
[Snip]
> is there any better doc for this than the eagle book?

You have to use $r->dir_config('Var') to get the values from the configuration file.
Example:
my $BindDN = $r->dir_config('BindDN'); 

See:


-- 
  Thomas Eibner  - DnsZone 
  mod_pointer  




Trying to find correct format for PerlSetVar's -- or get Apache::AuthNetLDAP working.

2001-05-30 Thread Steven Lembark

Eagle gives number of examples, none of which is a PerlSetVar.
guessing it would be a hash of var's to set with values.
Not having much luck -- Apache::AuthNetLDAP fails with:

[Wed May 30 23:33:21 2001] [notice] Apache/1.3.19 (Unix) mod_perl/1.25
configured -- resuming normal operations
[Wed May 30 23:33:21 2001] [info] Server built: May  4 2001 18:38:57
[Wed May 30 23:33:31 2001] [error] Can't call method "bind" on an
undefined value at
/usr/local/perl5/lib/site_perl/5.6.1/Apache/AuthNetLDAP.pm line 57.

which is running:

47 my $ldap = new Net::LDAP($ldapserver, port => $ldapport);
48
49 my $mesg;
50 #initial bind as user in Apache config
51 if ($bindpwd ne "")
52 {
53 $mesg = $ldap->bind($binddn, password=>$bindpwd);
54 }
55 else
56 {
57 $mesg = $ldap->bind();
58 }
59
60 #each error message has an LDAP error code
61 if (my $error = $mesg->code())
62 {
63  $r->note_basic_auth_failure;
64  $r->log_reason("user $username: LDAP Connection Failed:
$error",$r->uri);
65  return AUTH_REQUIRED;
66 }


problem seems to be that i'm not getting the PerlSetVar's 
across to it via perly config:

   164  $Location{'/blah'} = 
   163  {
   164  SetHandler  => 'perl-script',
   165
   166  PerlAuthenHandler   => 'Apache::AuthNetLDAP',
   167   
   168  PerlSetVar  =>
   169  {
   170  BindDN  => 'employeenumber=123456 ou=people
o=foo.bar',
   171  BindPWD => 'password',
   172  BaseDN  => 'ou=people o=foo.bar',
   173  LDAPServer  => 'ldap.alltel.com',
   174  LDAPPort=> '389',
   175  UIDAttr => 'sn',
   176  },
   177
   178  AuthName=> '/tdrdw',
   179  AuthType=> 'Basic',
   180
   181  require => 'valid-user',
   182
   183  PerlSetEnv  => "BASEURL http://$host:$Port/tdrdw";,
   184  PerlHandler => 'Tdrdw::Welcome',
   185  },


is there any better doc for this than the eagle book?

-- 
 Steven Lembark   2930 W. Palmer St.
 Chicago, IL  60647
 [EMAIL PROTECTED]   800-762-1582



RE: Can't locate object method "parse" via package "Apache::Cookie"

2001-05-30 Thread Geoffrey Young

your syntax is wrong...

try
   
  my %cookiejar = Apache::Cookie->new($r)->parse;

and I assume that you know Apache::Cookie is part of libapreq and not part
of the mod_perl distribution...

HTH

--Geoff




-Original Message-
From: David Boone
To: [EMAIL PROTECTED]
Sent: 5/30/01 4:44 PM
Subject: Can't locate object method "parse" via package "Apache::Cookie"

Using Mason and mod_perl w/ Apache, all the latest versions, I'm getting
a weird error

I've reinstalled them all, but I can't figure out this error... the
debug/anon/13 file is a mason debug file.  test.pl is a quick file I
whipped up to test if it occured outside of mason, which it indeed did. 
Obviously test.pl wouldn't ever work, but I think it illustrates the
error.

I'm afraid I'm doing something very foolish, hopefully someone can set
me straight.

Thanks,
- Dave

---

[dave@powerbook dave]$ perl /home/dave/www/mason/debug/anon/13
Can't locate object method "parse" via package "Apache::Cookie" (perhaps
you forgot to load "Apache::Cookie"?) at /apache/conf/handler.pl line
75.
[dave@powerbook dave]$ cat test.pl
use Apache::Cookie;

$lkj = parse Apache::Cookie;
[dave@powerbook dave]$ perl test.pl
Can't locate object method "parse" via package "Apache::Cookie" (perhaps
you forgot to load "Apache::Cookie"?) at test.pl line 3.
[dave@powerbook dave]$



problem with Apache::Request, multipart/form-data, and large TEXTAREAs?

2001-05-30 Thread peter


Hello-

I've noticed a problem when i try to POST large
TEXTAREA fields with ENCTYPE=multipart/form-data and
read it with Apache::Request.

It seems like when the data is between roughly
5K-10Kbytes, i get extra garbage at the end. When it's
greater than 10K, it gets chopped between ~5K-10K
bytes. Sounds like some 5K buffer somewhere getting
mangled. (Note, file uploads work fine, and I don't
have these problems with TEXTAREAs without the
ENCTYPE)

I have my test code below for illustration. Also,
CGI.pm works fine-- parseFormCGI instead of
parseFormApache below. (BTW, I'm running mod_perl 1.25
w/ Apache 1.3.20 and perl 5.6.1 on linux 2.4.2-2.)

Has anyone encountered this before? Any help is greatly
appreciated.

TIA,
peter
[EMAIL PROTECTED]



--- form:




0.1.2.3.4.5.6.7.8.9.
0.1.2.3.4.5.6.7.8.9.
   [...repeat ~100 times...]
0.1.2.3.4.5.6.7.8.9.



--- handler:

package Test::TestMod;

use Apache ();
use Apache::Request ();
use CGI ();
use strict;

sub handler {

my $r = shift;
my $form = &parseFormApache($r);

$r->print("Content-type: text/html\n\n");

$r->print("\n");
$r->print("ARGS\n");
foreach my $key (sort keys %$form) {
my $count = 0;
$$form{$key} =~ s/\n/'line'.++$count.':'/ge;
$r->print("$key$$form{$key}\n");
}
$r->print("\n");

return 200;

}

sub parseFormApache {

my ($r) = @_;
my $apr = Apache::Request->new($r);

my $form;
my @params = $apr->param;

foreach my $param (@params) {
$$form{$param} = join("\0", $apr->param($param));
}

return $form;

}

sub parseFormCGI {

my ($r) = @_;
my $cgi = new CGI;

my $form;
my @params = $cgi->param;

foreach my $param (@params) {
$$form{$param} = join("\0", $cgi->param($param));
}

return $form;
}

1;









[Fwd: Help with parameters.]

2001-05-30 Thread Nimmagadda Rajeev SRK

I did not get any responses. So I am reposting.

thanks
Rajeev


 Original Message 
Subject: Help with parameters.
Date: Tue, 29 May 2001 11:12:46 -0500
From: Nimmagadda Rajeev SRK <[EMAIL PROTECTED]>
Organization: IBM Corporation.
To: [EMAIL PROTECTED]


Hi,

I have built modperl 1.25.

I could run perl scripts fine.

How can I send parameters to a perl scripts?

Using  http://mydomain.com/perl/foreach.pl?200+300 does not seem to work.

I can run the same script from a command line with "perl foreach.pl 200 300"
with good results.

But I cannot call it from a web page.


thanks
Rajeev.



Can't locate object method "parse" via package "Apache::Cookie"

2001-05-30 Thread David Boone

Using Mason and mod_perl w/ Apache, all the latest versions, I'm getting
a weird error

I've reinstalled them all, but I can't figure out this error... the
debug/anon/13 file is a mason debug file.  test.pl is a quick file I
whipped up to test if it occured outside of mason, which it indeed did. 
Obviously test.pl wouldn't ever work, but I think it illustrates the
error.

I'm afraid I'm doing something very foolish, hopefully someone can set
me straight.

Thanks,
- Dave

---

[dave@powerbook dave]$ perl /home/dave/www/mason/debug/anon/13
Can't locate object method "parse" via package "Apache::Cookie" (perhaps
you forgot to load "Apache::Cookie"?) at /apache/conf/handler.pl line
75.
[dave@powerbook dave]$ cat test.pl
use Apache::Cookie;

$lkj = parse Apache::Cookie;
[dave@powerbook dave]$ perl test.pl
Can't locate object method "parse" via package "Apache::Cookie" (perhaps
you forgot to load "Apache::Cookie"?) at test.pl line 3.
[dave@powerbook dave]$



[ANNOUNCE] Apache::ASP v2.11

2001-05-30 Thread Joshua Chamas

Hey,

Apache::ASP v2.11 is out in your local CPAN and also
  http://www.perl.com/CPAN-local/modules/by-module/Apache/

The changes are below.

Apache::ASP provides an Active Server Pages port to the
Apache Web Server with Perl scripting only, and enables
developing of dynamic web applications with session
management and embedded perl code.  There are also many
powerful extensions, including XML taglibs, XSLT rendering, 
and new events not originally part of the ASP API!

The Apache::ASP web site is at http://www.apache-asp.org

-- Josh


$MODULE=Apache::ASP; $VERSION = 2.11; $DATE="05/29/2001";

Please see README for changes for past versions.

 + = improvement; - = bug fix
 
 +Parser optimization from Dariusz Pietrzak

 -work around for global destruction error message for perl 5.6
  during install

 +$Response->{IsClientConnected} now will be set
  correctly with ! $r->connection->aborted after each
  $Response->Flush()

 +New XSLTParser config which can be set to XML::XSLT or
  XML::Sablotron.  XML::Sablotron renders 10 times faster, 
  but differently.  XML::XSLT is pure perl, so has wider
  platform support than XML::Sablotron.  This config affects
  both the XSLT config and the $Server->XSLT() method.

 +New $Server->XSLT(\$xsl_data, \$xml_data) API which 
  allows runtime XSLT on components instead of having to process
  the entire ASP output as XSLT.  

 -XSLT support for XML::XSL 0.32.  Things broke after .24.

 -XSLTCacheSize config no longer supported.  Was a bad 
  Tie::Cache implementation.  Should be file based cache
  to greatly increases cache hit ratio.

 ++$Response->Include(), $Response->TrapInclude(),
  and $Server->Execute() will all take a scalar ref
  or \'asdfdsafa' type code as their first argument to execute 
  a raw script instead of a script file name.  At this time, 
  compilation of such a script, will not be cached.  It is 
  compiled/executed as an anonymous subroutine and will be freed
  when it goes out of scope.

 + -p argument to cgi/asp script to set GlobalPackage
  config for static site builds

 -pod commenting fix where windows clients are used for 
  ASP script generation.

 +Some nice performance enhancements, thank to submissions from
  Ime Smits.  Added some 1-2% per request execution speed.

 +Added StateDB MLDBM::Sync::SDBM_File support for faster
  $Session + $Application than DB_File, yet still overcomes
  SDBM_File's 1024 bytes value limitation.  Documented in 
  StateDB config, and added Makefile.PL entry.

 +Removed deprecated MD5 use and replace with Digest::MD5 calls

 +PerlSetVar InodeNames 1 config which will compile scripts hashed by 
  their device & inode identifiers, from a stat($file)[0,1] call.
  This allows for script directories, the Global directory,
  and IncludesDir directories to be symlinked to without
  recompiling identical scripts.  Likely only works on Unix
  systems.  Thanks to Ime Smits for this one.

 +Streamlined code internally so that includes & scripts were
  compiled by same code.  This is a baby step toward fusing
  include & script code compilation models, leading to being
  able to compile bits of scripts on the fly as ASP subs, 
  and being able to garbage collect ASP code subroutines.

 -removed @_ = () in script compilation which would trigger warnings 
  under PerlWarn being set, thanks for Carl Lipo for reporting this.

 -StatINC/StatINCMatch fix for not undeffing compiled includes
  and pages in the GlobalPackage namespace

 -Create new HTML::FillInForm object for each FormFill
  done, to avoid potential bug with multiple forms filled
  by same object.  Thanks to Jim Pavlick for the tip.

 +Added PREREQ_PM to Makefile.PL, so CPAN installation will
  pick up the necessary modules correctly, without having
  to use Bundle::Apache::ASP, thanks to Michael Davis. 

 + > mode for opening lock files, not >>, since its faster

 +$Response->Flush() fixed, by giving $| = 1 perl hint
  to $r->print() and the rest of the perl sub.

 +$Response->{Cookies}{cookie_name}{Expires} = -86400 * 300;
  works so negative relative time may be used to expire cookies.

 +Count() + Key() Collection class API implementations

 +Added editors/aasp.vim VIM syntax file for Apache::ASP,
  courtesy of Jon Topper.

 ++Better line numbering with #line perl pragma.  Especially
  helps with inline includes.  Lots of work here, & integrated
  with Debug 2 runtime pretty print debugging.

 +$Response->{Debug} member toggles on/off whether 
  $Response->Debug() is active, overriding the Debug setting
  for this purpose.  Documented.

 -When Filter is on, Content-Length won't be set and compression
  won't be used.  These things would not work with a filtering
  handler after Apache::ASP



Re: modify url in web log via PerlLogHandler

2001-05-30 Thread Richard Chen

I did not get any responses so I consulted the sources
of both apache and mod_perl. It turned out that apache uses 
the_request method to get data for the log entries. 
The eagle book documented this the_request as
a read-only method. Fortunately in the recent versions of mod_perl
this is not the case any more and one can set a new value
via this method.

So modifying url in web log via PerlLogHandler is indeed possible.
Just modify the_request value instead of the uri value.

HTH for other people.

Thanks

Richard

On Sat, May 26, 2001 at 09:23:17AM -0400, Richard Chen wrote:
> Is it possible to modify the logged url in the usual
> modperl weblog via PerlLogHandler? I have tried this and
> it does not seem to work:
> 
> $ cat Apache/MyLog.pm
> package Apache::MyLog;
> use Apache::Constants qw(:common);
> sub handler {
> my $r = shift;
> my $uri=$r->uri;
>   return DECLINED if ($r->filename !~ /foobar/);
> print STDERR "in MyLog handler, \$uri=$uri, modify it now\n";
> $r->uri('/foobar_changed');
> return OK;
> }
> 1;
> 
> When this is installed like this:
> 
> 
> PerlLogHandler Apache::MyLog
> 
> 
> I can see the debugging message in error_log but the url logged 
> in the weblog is still the same as before.
> 
> Thanks for any info.
> 
> Richard



Re: Real Widgets and Template Languages

2001-05-30 Thread Matt Sergeant

On Tue, 29 May 2001, Stephen Adkins wrote:

> I completely understand what all three of you are saying, and I think the
> needs of the Gunther and Jay are being accommodated in the new design.
>
> However, a note on XML and Storable ...
>
> The XML::Simple class allows you a "cache" option (which I am using)
> where it caches the perl data structure in a Storable.
> The XML::Simple class reads the XML file into a perl data structure,
> then stores it as a Storable.  On subsequent reads, it checks the
> timestamps of the .xml file and the .stor file and only rereads the
> XML file if it is newer than the .stor file.  Otherwise, it just
> reads the .stor file.  This appears to be about 3x faster.

Not really worth it... XML::LibXML is about 10 times faster anyway.
Although the syntax to access bits of the XML is XPath, rather than a perl
hash, but you get used to that pretty quickly.

-- 


/||** Founder and CTO  **  **   http://axkit.com/ **
   //||**  AxKit.com Ltd   **  ** XML Application Serving **
  // ||** http://axkit.org **  ** XSLT, XPathScript, XSP  **
 // \\| // ** mod_perl news and resources: http://take23.org  **
 \\//
 //\\
//  \\




RE: [OT] Content-Disposition to change type and action?

2001-05-30 Thread Wilt, Paul


On Wed, 30 May 2001, Ged Haywood wrote:
>On Wed, 30 May 2001, Issac Goldstand wrote:
>
> > Ged wrote:
> > > IE is particularly fond of ignoring Content-type.  If the file is
called
> > > something.html or something.htm I've found IE will treat it as html
even
> > > if you say it's text/plain in Content-type.  Ugh.
> > 
> > no - that only happens when you supply text/* (and possibly image/*).
I've
> > had reasons to force internet explorer to do what I want (down, boy! :-)
)
> > and after a bit of hassle, I usually can just by setting the
content-type in
> > a way it likes (which is uslally compatible with the other browsers,
too).
>
> Sorry, I have to disagree.  I was so surprised when it happened I verified
> it by snooping the network.  I'm not saying it's all versions, I think it
> was 5.0 but I can't remember I'm afraid.  Was only a couple of months ago.

I have to agree with Ged.  IE3 browsers seemed to ignore the Content-Type
header
for PDF files.  Our system dynamically creates PDF files on request and
unless we
added a fake parameter of like "&ie=x.pdf" to the end of the URL IE3 would
refuse
to load the file.  Most IE4 builds correctly interpreted the Content-Type
... and
then as soon as we began testing IE5 we noticed that the Microsoft ignorance
had
returned.  I have a friend who is a field engineer for Microsoft.  I sent a
bug
report through him to the Microsoft people and he basically ended up saying
(not
in these exact words) that they told him they had bigger fish to fry than to
correct this problem.

What a bummer!

Paul E Wilt 
Principal Software Engineer

XanEdu, Inc. ( a division of Bell+Howell Information&Learning)
http://www.XanEdu.com
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
300 North Zeeb Rd   Phone: (734) 975-6021  (800)
521-0600 x6021
Ann Arbor, MI 48106 Fax:(734) 973-0737





Cookies ....

2001-05-30 Thread Sumit Babu

Hi,

I am facing some wired problems with cookies. If I set
a cookie and later try to retrieve it using the
$r->header_in('Cookie') method, all i am getting is :

Apache::Cookie=SCALAR(0x83e1960);
Apache::Cookie=SCALAR(0x86645dc)

line. The ref. is not blessed and I cannot get the
cookies value.

I am also getting the same result even if I try with
Apache::Cookie/CGI::Cookie's fetch method.

Thanks a lot in advance for your advices.

Regards,

Sumit.

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/



Re: Apache::FakeRequest et.al. ?

2001-05-30 Thread Ged Haywood

Hi there,

On Wed, 30 May 2001 [EMAIL PROTECTED] wrote:

> I am trying to run a rather big and complex mod_perl module from 
> the prompt, but I cannot get it running.

http://perl.apache.org/guide

73,
Ged.





Re: [OT] Content-Disposition to change type and action?

2001-05-30 Thread Ged Haywood

Hi there,

On Wed, 30 May 2001, Issac Goldstand wrote:

> Ged wrote:
> > IE is particularly fond of ignoring Content-type.  If the file is called
> > something.html or something.htm I've found IE will treat it as html even
> > if you say it's text/plain in Content-type.  Ugh.
> 
> no - that only happens when you supply text/* (and possibly image/*).  I've
> had reasons to force internet explorer to do what I want (down, boy! :-) )
> and after a bit of hassle, I usually can just by setting the content-type in
> a way it likes (which is uslally compatible with the other browsers, too).

Sorry, I have to disagree.  I was so surprised when it happened I verified
it by snooping the network.  I'm not saying it's all versions, I think it
was 5.0 but I can't remember I'm afraid.  Was only a couple of months ago.

73,
Ged.





Apache::FakeRequest et.al. ?

2001-05-30 Thread a9403692

Hi!

I am trying to run a rather big and complex mod_perl module from 
the prompt, but I cannot get it running.

The problem is that the module needs to access some variables 
that are stored in the Apache Config File, but neither 
Apache::FakeRequest nore apr.pl (posted here by Andrew Ho 
([EMAIL PROTECTED]) some time ago) seem to a) parse the 
Apache Config Files or b) implement some fake $r->dir_config call.

Before I start to write a Apache Config File parser or manually 
copy&paste a lot of dir_config values from the Apache Config File 
into a script, I would like to ask the assembled mod_perl-ers if 
somebody allready did something like this, or point me to the part 
in the various documentations that covers this but that I wasn't able to
find.

TIA!

--
Thomas Klausner
http://domm.zsi.at