Bugs 5.6.0 modperl use?

2000-05-24 Thread John M Vinopal


Apache 1.3.12
modperl 1.24
perl 5.6.0

CGI::Carp preloaded.
DBI preloaded.

[Wed May 24 19:58:28 2000] [error] PerlRun: `Bizarre copy of HASH in aassign
at /usr5/perl/lib/5.6.0/Carp/Heavy.pm line 79.

Prototype mismatch: sub Apache::ROOT::cgi_2dbin::adtaker::get_username::SQL_INTEGER vs 
() at /usr5/perl/lib/5.6.0/Exporter.pm line 57.
 at /usr5/caps_prod/scripts/adtaker/get_username line 6

where SQL_INTEGER is imported via
use DBI qw(SQL_INTEGER);

Anyone else seen these?

-j



Re: XHTML_DTD redefined?

2000-05-24 Thread Perrin Harkins

"Randal L. Schwartz" wrote:
> 
> I'm getting this on every startup:
> 
> Constant subroutine XHTML_DTD redefined at /usr/lib/perl5/5.00503/constant.pm 
>line 175.
> 
> what's this about?

That would be the mandatory warning for redefined inlined subroutines. 
That particular one looks like it comes from CGI.pm.  You can make this
stop by using Apache::Symbol.

- Perrin



Need help in compiling the mod-perl

2000-05-24 Thread Seshagiri Rao Maddirala

Hi,

I am tryong to compile modperl with gcc2.8.1 on solaris 7.
Even before make finishes I get out with error:

mod_perl.c at line 278 'aptestconfigonly' - Unresolved symbol.
I picked it up today afternoon from ftp site of perl.apache.org.

I have this if condition line and next line continued with my
compilation, I am not sure whether that is correct way.

How do I get out and also configuration on this 1.24 is very
little. How do I include modperl in httpd.conf. By default it
does by adding line Load_module= mod_perl etc., ( some thing
similar to that) and log file shows up that apache 1.3.6 with
mod_perl 1.24 is loaded and started. But how do I check a perl
file whether it is executing. Because the ToDo file says, eg
directory absolete that means all the config details given
in test.pl is not correct. When I include in httpd.conf, the
httpd does not start. Comes out with segmentation file and core
file generated.

Can I have your comments on these please?

Thanks for your time. I am still doing my home work looking
in for any similar problems in mailing lists. If I overlooked
some of these and I am stupid in asking this question , please
excuse me.

Thanks,
Sesh

Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com




Re: XHTML_DTD redefined?

2000-05-24 Thread Robin Berjon

At 16:44 24/05/2000 -0700, Randal L. Schwartz wrote:
>I'm getting this on every startup:
>
>Constant subroutine XHTML_DTD redefined at 
>/usr/lib/perl5/5.00503/constant.pm line 175.
>what's this about?

This is what happens when you 'use constant FOO => "bar";' more than once.
It's a problem in one of the Perl modules, it might help to know what you
have in @INC (and to grep whatever's in it for use constant XHTML_DTD).

Maybe contant.pm should try to give more context as to where the
redefinition occured...



.Robin
The computer can't tell you the emotional story.  It can give you the exact
mathematical design, but what's missing is the eyebrows. -- Frank Zappa




Re: Apache::ASP

2000-05-24 Thread Joshua Chamas

> sridhar wrote:
> 
> I am trying Apache ASP under Solaris 7 with Apache 1.3.12 mod_perl enabled.
> I have successfully Apache JServ and mod_perl, both are working fine. Before 
>installing Apache::ASP I have installed all the required modules like
> Apache-Filter, Apache-SSI, HTML Parser etc. The Apache ASP module installation 
>doesn't throw any errors, and after installation I've done all that's
> said in the README like editing the httpd.conf - I 've copied the eg directory to my 
>htdocs directory and also set the Directory settings in the
> httpd.conf file. When I call the sample asp files from my web server the ASP tags 
>don't seem to work, I just get the HTML output.
> 

You can start out with the ./site/eg, and the .htaccess will be
used with AllowOverride All set.  See

  http://www.nodeworks.com/asp/install.html

-- Joshua
_
Joshua Chamas   Chamas Enterprises Inc.
NodeWorks >> free web link monitoring   Huntington Beach, CA  USA 
http://www.nodeworks.com1-714-625-4051



Re: Apache::ASP - POST variable limit?

2000-05-24 Thread Joshua Chamas

Anthony Cinelli wrote:
> 
> Hello all,
>Great work on the Apache::ASP module.  We're using it to port an
> entire website from VBScript->IIS Web Server->Windows NT to a much more
> stable/powerful Perl->Apache->Linux.  Without it, we'd be in for a long

I love it.

> haul.  We are currently working on a content editor and have run into a
> problem.  Some input textfields push 2K and it seems when they do, all
> input variables get dropped.  For example, I have a hidden
> username/password.  When the script is called without, a login page is
> displayed.  Everything works fine when submitting via POST content <
> 2K.  When > 2K, the username/password gets dropped, along with the
> content in the input fields, and reverts to the login page.  I've tried
> to set the FileUploadSize, but to no avail.  Please assist.
> 

This problem shouldn't be happening.  Make sure that your 
form has the POST method clearly hardcoded so that your 
browser doesn't send this via GET which could have a 2K limit.

If you are still having troubles, post your script and the 
relevant part of your config.  Make sure that your Apache
doesn't have any post limit set.

Note that the FileUpload* configs only kick in when you are
doing file uploads which take a special kind of form.

-- Joshua
_
Joshua Chamas   Chamas Enterprises Inc.
NodeWorks >> free web link monitoring   Huntington Beach, CA  USA 
http://www.nodeworks.com1-714-625-4051



Re: global variables and reparsing (short reproducible example)

2000-05-24 Thread Marc Lehmann

On Wed, May 24, 2000 at 11:55:09AM -0700, Perrin Harkins <[EMAIL PROTECTED]> wrote:
> > I was under the impression that you cannot configure Apache from a
> > PerlRequire. If that is not the case (and somehow works) I'd really like
> > to get away from perlsections.
> 
> You can only configure Apache from  sections, but you can load all
> your modules, shared data, etc. from a file pulled in with PerlRequire.

However, that makes no difference. So the easiest solution is to not
support PerlFreshRestart :)

> > You cannot redefine closures as well.
> 
> Closures are a confusing aspect of perl, and I could easily be mistaken
> about them, but Randal and Doug seem to agree that this is a closure:

Then the perl documentation is in error (but does not need to be fixed ;)

> When this code gets parsed, the $x goes out of scope at the end of the
> block, but &show_x keeps a copy of it.
> 
> I think that this is the source of the behavior you saw where it looked
> like there were multiple versions of subs and variables being created.

Yepp.

> Anyway, I was just trying to help you solve your problem.  There's no need
> to get defensive.

Sorry, it's just that I was accused as being a microsoft troll, accused of
being too dumb to understand that you have to use my with mod_perl and worse,
by three people in private who thought I fell into the old trap of reusing
globals with Apache::Registry.

So I guess yes, I was being over-defensive. I'm sorry.

-- 
  -==- |
  ==-- _   |
  ---==---(_)__  __   __   Marc Lehmann  +--
  --==---/ / _ \/ // /\ \/ /   [EMAIL PROTECTED] |e|
  -=/_/_//_/\_,_/ /_/\_\   XX11-RIPE --+
The choice of a GNU generation   |
 |



Re: global variables and reparsing (short reproducible example)

2000-05-24 Thread Marc Lehmann

On Wed, May 24, 2000 at 11:30:40AM -0700, Perrin Harkins <[EMAIL PROTECTED]> wrote:
> > example did something similar, indeed, but it had to be embedded into the
> > module source, which is somewhat inconvinient.
> 
> If you don't have PerlFreshRestart turned on (it is not recommended on
> production servers), only the stuff in your config file ( sections
> and PerlModule/PerlRequire) gets called twice.  You can block things out
> like this:

Actually, and to my surprise, PerlModule/PerlRequire is not done twice,
at leats not with respect to reparsing. They simply don't reparse the
modules, so mod_perl works *perfectly* without PerlFreshRestart, and
without special measures.

> SUGUSR1.  Personally, I always do cold stop and start on my production
> servers, in order to maximize shared memory, but this is difficult when
> you don't have a load-balanced cluster at your disposal...

*) It's also more disruptive ;)

-- 
  -==- |
  ==-- _   |
  ---==---(_)__  __   __   Marc Lehmann  +--
  --==---/ / _ \/ // /\ \/ /   [EMAIL PROTECTED] |e|
  -=/_/_//_/\_,_/ /_/\_\   XX11-RIPE --+
The choice of a GNU generation   |
 |



XHTML_DTD redefined?

2000-05-24 Thread Randal L. Schwartz


I'm getting this on every startup:

Constant subroutine XHTML_DTD redefined at /usr/lib/perl5/5.00503/constant.pm line 
175.

what's this about?

I just upgraded to the latest mod_perl, Apache, and HTML::Mason all at
the same time.  I'm a masochist. :-)  My Perl is still 5.5.3 though. :)

Here's my Apache config...

Server version: Apache/1.3.12 (Unix)
Server built:   May 24 2000 15:07:25
Server's Module Magic Number: 19990320:7
Server compiled with
 -D HAVE_MMAP
 -D HAVE_SHMGET
 -D USE_SHMGET_SCOREBOARD
 -D USE_MMAP_FILES
 -D USE_FCNTL_SERIALIZED_ACCEPT
 -D HTTPD_ROOT="/merlyn/web/httpd"
 -D SUEXEC_BIN="/merlyn/web/httpd/bin/suexec"
 -D DEFAULT_PIDLOG="logs/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/httpd.scoreboard"
 -D DEFAULT_LOCKFILE="logs/httpd.lock"
 -D DEFAULT_XFERLOG="logs/access_log"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"
 -D ACCESS_CONFIG_FILE="conf/access.conf"
 -D RESOURCE_CONFIG_FILE="conf/srm.conf"

Compiled-in modules:
  http_core.c
  mod_env.c
  mod_log_config.c
  mod_mime_magic.c
  mod_mime.c
  mod_negotiation.c
  mod_status.c
  mod_info.c
  mod_include.c
  mod_autoindex.c
  mod_dir.c
  mod_cgi.c
  mod_asis.c
  mod_imap.c
  mod_actions.c
  mod_speling.c
  mod_userdir.c
  mod_alias.c
  mod_rewrite.c
  mod_access.c
  mod_auth.c
  mod_auth_anon.c
  mod_digest.c
  mod_proxy.c
  mod_headers.c
  mod_unique_id.c
  mod_setenvif.c
  mod_perl.c
suexec: disabled; invalid wrapper /merlyn/web/httpd/bin/suexec



-- 
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!



Problems with POSIX.

2000-05-24 Thread Frank Wiles

 This isn't a big issue, but I'm curious if anyone else has seen this.  
 I had 'use POSIX;' in one of my modules which was supposedly being
 reloaded with Apache::StatINC. 

 If while editing my code I had a syntax error, and the module would
 either return "Internal Server Error" or "Document Contains No Data".  

 However when I fixed it those server children that had attempted to
 process the module while it was broken, could never recover. I would
 have to completely restart apache. 

 Is this a POSIX problem? A mod_perl problem? Like I said, I've fixed it
 by not using POSIX ( which is probably the more correct way to do it
 anyway ), but I'm still interested in seeing if anyone else has
 experienced this. 

 ---
  Frank Wiles <[EMAIL PROTECTED]>
  http://frank.wiles.org
 ---




modperl and mason in the news

2000-05-24 Thread ___cliff rayman___

http://www.linuxtoday.com.au/article.jsp?sid=622284

--
___cliff [EMAIL PROTECTED]





Re: 10 digit timestamp

2000-05-24 Thread Vivek Khera

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

P> It's a signed 4-byte integer.
P> Not an issue of horrendous urgency yet, 
P> but maybe we should think about it before 2037? =o)


Errr...  Are you new to Unix?  This is a very well known issue... and
really has nothing to do with mod_perl.

The only thing this will really affect is people who are silly enough
to write dates to persistent storage using time_t values.




10 digit timestamp

2000-05-24 Thread Paul

I saw a post recently (possibly elsewhere, if so I'm sorry for the
spam) stating that on Sep 8 next year timestamps (the number of seconds
since 00:00:01 1/1/70, the UNIX epoch) will hit 10 digits for the first
time.  The comment was that it might be something like the Y2K problem.

I tried a few quick tests, and got this:
perl -e 'print scalar localtime(2147483647),"\n",
   scalar localtime(2147483648),"\n";'
Mon Jan 18 21:14:07 2038
Fri Dec 13 14:45:52 1901

It's a signed 4-byte integer.
Not an issue of horrendous urgency yet, 
but maybe we should think about it before 2037? =o)

Paul

A plaque on Eistein's wall (in paraphrase) --
"Not everything that can be counted counts;
 Not everything that counts can be counted."

__
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.com/



Re: Problem compiling mod_perl 1.24 on Solaris 2.6

2000-05-24 Thread Fred Miller

Fred Miller wrote:
> 
> Doug MacEachern wrote: 
> >looking at the line number, i would try replacing any occurance of:
> >
> > perl_eval_sv -> eval_sv
> > perl_call_sv -> call_sv
> > perl_call_pv -> call_pv
> 
> I wish I was experienced enough to know what this means.


Now I think I'm starting to get confused.

I tried building Apache and mod_perl by hand, loosely following some
instructions I found on the web labeled "mod_perl installation".

This part worked
perl Makefile.PL APACHE_SRC=../apache_1.3.12/src NO_HTTPD=1 EVERYTHING=1
make
make install

All looked good

I added to apache_1.3.12/src/Configuration
addModule module/perl/libperl.a

and the following EXTRA_LIBS and EXTRA_CFLAGS
EXTRA_LIBS=`perl -MExtUtils::Embed -l ldopts`
EXTRA_CFLAGS='perl -MExtUtils::Embed -e ccopts`

I checked apache_1.3.12/src/modules/perl and a bunch of stuff had been
put in there from my mod_perl build

I then ran ./Configure form within apache_1.3.12/src - no problem
but when I ran make, I received familiar errors:

gcc -c -I../.. -I/usr/local/lib/perl5/5.6.0/sun4-solaris/CORE
-I../../os/unix -I../../include   -DSOLARIS2=260 -DMOD_PERL
-DUSE_PERL_SSI -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -DUSE_EXPAT -I../../lib/expat-lite -DNO_DL_NEEDED
`perl -MExtUtils::Embed -e ccopts` mod_auth.c
gcc -c -I../.. -I/usr/local/lib/perl5/5.6.0/sun4-solaris/CORE
-I../../os/unix -I../../include   -DSOLARIS2=260 -DMOD_PERL
-DUSE_PERL_SSI -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -DUSE_EXPAT -I../../lib/expat-lite -DNO_DL_NEEDED
`perl -MExtUtils::Embed -e ccopts` mod_setenvif.c
rm -f libstandard.a
ar cr libstandard.a mod_env.o mod_log_config.o mod_mime.o
mod_negotiation.o mod_status.o mod_include.o mod_autoindex.o mod_dir.o
mod_cgi.o mod_asis.o mod_imap.o mod_actions.o mod_userdir.o mod_alias.o
mod_access.o mod_auth.o mod_setenvif.o 
ranlib libstandard.a
<=== modules/standard
===> modules/perl
cc -O -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-I/usr/local/lib/perl5/5.6.0/sun4-solaris/CORE
-DMOD_PERL_VERSION=\"1.24\" -DMOD_PERL_STRING_VERSION=\"mod_perl/1.24\"
-I../.. -I/usr/local/lib/perl5/5.6.0/sun4-solaris/CORE -I../../os/unix
-I../../include   -DSOLARIS2=260 -DMOD_PERL -DUSE_PERL_SSI
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-DUSE_EXPAT -I../../lib/expat-lite -DNO_DL_NEEDED `perl
-MExtUtils::Embed -e ccopts` -c mod_perl.c
"/usr/local/lib/perl5/5.6.0/sun4-solaris/CORE/perl.h", line 1929:
warning: operand treated as unsigned: 0x87654321
"./mod_perl.h", line 584: warning: macro replacement within a string
literal
"./mod_perl.h", line 587: warning: macro replacement within a string
literal
"./mod_perl.h", line 590: warning: macro replacement within a string
literal
"./mod_perl.h", line 593: warning: macro replacement within a string
literal
"mod_perl.c", line 347: fatal: macro recursion
cc: acomp failed for mod_perl.c
make[2]: *** [mod_perl.o] Error 2
make[1]: *** [all] Error 1
make: *** [subdirs] Error 1

Recommendations for how best to proceed?
I find this quite curious, as I have Apache-1.3.12 working without
mod_perl, and mod_perl seemed to build just fine separate from Apache.

Thanks,
Fred

-- 
[EMAIL PROTECTED]
http://titan.iwu.edu/~fmiller/



Re: CORE::exit and Apache:Registry

2000-05-24 Thread Ged Haywood

Hi there,

On Wed, 24 May 2000, Mark Hewis wrote:

> What am am really after is an exit which just restarts the child process (it
> is called in) resetting all module globals any suggestions?

die() ?

> END{} is called at the end of each processed request

They are only processed for each request under Apache::Registry,
PerlRun and friends.  Otherwise they are not processed until the
Apache parent exits.

See perl.apache.org/guide - "Controlling and Monitoring the Server".

73,
Ged.




httpd exits with apache-1.3.12 and mod_perl-1.21 on Redhat 6.2

2000-05-24 Thread Roberto Bourgonjen

Hi all,

I am encountering strange problems on redhat 6.2 installations with
rpm's apache-1.3.12-2 and mod_perl-1.21-10 (the latest available
versions from redhat. I _have_ to use rpm's). I've tried two machines.

As soon as load certain modules the server exits immediately, without 
producing the slightest error message.

Example:

in my conf/httpd.conf:

PerlRequire startup.pl

in startup.pl:

use Text::Wrapper;

All works fine.

in startup.pl:

use DBI;

Apache exits immediately. I've also tried other various other modules,
some make apache exit, others not.

Is this a known problem with these versions?
(I could not find anything about this in the archives).

Regards, Roberto

-- 
Roberto Bourgonjen




difference between ...

2000-05-24 Thread David Hajoglou

Would there ever be any difference between the output of the following:

(looking on the mod_perl quick reference card)

>From Apache::URI
$str = $uri->query()


>From Request object
$str = $r->args();

As far as what they hold about the request, would these ever differ, or
do they access the same data (in different ways)?


Thanks 
David




Apache::ASP - POST variable limit?

2000-05-24 Thread Anthony Cinelli

Hello all,
   Great work on the Apache::ASP module.  We're using it to port an
entire website from VBScript->IIS Web Server->Windows NT to a much more
stable/powerful Perl->Apache->Linux.  Without it, we'd be in for a long
haul.  We are currently working on a content editor and have run into a
problem.  Some input textfields push 2K and it seems when they do, all
input variables get dropped.  For example, I have a hidden
username/password.  When the script is called without, a login page is
displayed.  Everything works fine when submitting via POST content <
2K.  When > 2K, the username/password gets dropped, along with the
content in the input fields, and reverts to the login page.  I've tried
to set the FileUploadSize, but to no avail.  Please assist.

I'm currently running perl 5.6, modperl 1.23, apache 1.3.12, Win NT 4.0
(SP3).

Thanks,
Anthony Cinelli



Apache::Registry script problem

2000-05-24 Thread Drew Taylor

Hi all,

I'm having a serious, but intermittent, problem with my Apache::Registry
scripts. I have 2 (soon to be more!) site running on the same physical
server. Each site is driven by a set of short perl-script scripts. The
scripts execute code in OO modules that are shared among all servers.
The scripts are identical between all sites except for the following:

(index.pl)
my $SITENAME = 'cloudstock';
my $SITEID = 1;
OR
my $SITENAME = 'wiredstock';
my $SITEID = 2;

(all others in /cgi-bin)
my $search = eLogix::Search->new($CGI, 'cloudstock', 1);
$search->blah
OR
my $search = eLogix::Search->new($CGI, 'wiredstock', 2);
$search->blah
ETC

The part that changes is the 'cloudstock' and '1'. However, I
occasionally (and not reliably) get a page from cloudstock.com using the
wiredstock.com scripts! On some debugging, I can verify that when this
happens the script has the wrong values. It seems that apache is
confused and sometimes serves the wrong script for the given domain!

Is there any known problems with this sort of thing happening? Is it a
bug w/ my code or with mod_perl? I'm tearing my hair out trying to
figure this out.

Here's the server info:

bash-2.03$ perl -v

This is perl, version 5.005_03 built for sun4-solaris

(from /perl-status)
This is running on stronghold w/ mod_perl.
Embedded Perl version 5.00503 for Stronghold/2.4.2 Apache/1.3.6
C2NetEU/2412 (Unix) mod_perl/1.21 process 16288, running since Wed May
24 11:54:01 2000

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
osname=solaris, osvers=2.6, archname=sun4-solaris
uname='sunos tsweb01.interpath.net 5.6 generic_105181-17 sun4u sparc
sunw,ultra-250 '
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
cc='cc', optimize='-O', gccversion=
cppflags='-I/usr/local/include'
ccflags ='-I/usr/local/include'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -ldb -ldl -lm -lc -lcrypt
libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-KPIC', lddlflags='-G -L/usr/local/lib'

If anyone has ideas, I'd love to hear them. And of course, I can go into
much greater detail if necessary.

-- 
Drew Taylor
Vialogix Communications, Inc.
501 N. College Street
Charlotte, NC 28202
704 370 0550
http://www.vialogix.com/



Re: Form generation libraries

2000-05-24 Thread Jeffrey W. Baker

On Wed, 24 May 2000, Peter Haworth wrote:

> Jeffrey W. Baker wrote:
> > On Wed, 24 May 2000, Peter Haworth wrote:
> > > Jeffrey W. Baker wrote:
> > > > myInput = hfTextInputNew();
> > > > myInput->addAttr(myInput, "name", "first_name");
> > > > myInput->addAttr(myInput, "value", "Jeffrey");
> > > > printf("%s\n", myInput->render(myInput));
> > > > myInput->destroy(myInput);
> > > > 
> > > > I would expect a similar interface with more methods for a select box,
> > > > e.g. mySelect->addOption(mySelect, myOption), and myOption->select.
> 
> Is this C or C++? If C, do you have a member for each function in the struct,
> and if it's C++, why are you passing myInput twice? Or maybe you just got
> carried away with your example.

It's C with function pointers as struct members.

> 
> > > Where do you store those attributes before you do the rendering? If you
> > > tie yourself to Apache, you could use tables. If you tie yourself to perl,
> > > you can use hashes. Otherwise you have to do your own hashes. Blech,
> > > especially if you then use the library with Apache and/or perl - wasted
> > > effort.
> > 
> > Actually, there is another way, and that is to simply build a linked list
> > of attributes.  It doesn't matter what order you put the attributes in, so
> > I just add them to the head of the list for performance.  Adding to the
> > head of a list is faster than hashing anyway.  If you use the
> > setAttr(self *, char *, char *) method, the list has to be scanned, but is
> > is likely to be so short as to not matter.
> 
> OK, that seems sensible. There's no reason to go overboard to get more
> hash-like semantics, when you'll generally just be stuffing things in, then
> reading them all out.

Exactly.  The mainstream use case is to add things and then render.  The
capability to remove and change things exists, but doesn't need to be as
streamlined.

> > The other advantage here is storage space.  An attribute in this
> > implementation takes up only 4*sizeof(void *) + strlen(name) +
> > strlen(value) + 2.
> 
> Is it a doubly linked list, or are you storing something other than name,
> value, next?

Doubly-linked.  You aren't sweating those extra 32 bits are you? ;)

> 
> > > Bear in mind that it's nice to be able to support arbitrary attributes for
> > > things like onMouseClick and the like, horrible though they are. This
> > > means that you can't just define structs with members dedicated to
> > > specific attributes.
> > 
> > Done.  The same approach is also used for adding options to a select box,
> > although a select box will have an additional sort() method.
> 
> Well, personally, I'd have sorted my options before setting them up. Otherwise
> you need unnecessarily complicated comparison functions to keep your "Please
> select something" option at the top. ALthough, if it works that way, adding
> options to a select has to add to the tail of the list, or you'd have to add
> your options in reverse order.

If the options are sorted before adding, then you just wouldn't call the
sort() method.  Or maybe it would be sortByValue() and
sortByLabel().  That sounds more flexible.

-jwb




Re: global variables and reparsing (short reproducible example)

2000-05-24 Thread Perrin Harkins

On Wed, 24 May 2000, Marc Lehmann wrote:
> I was under the impression that you cannot configure Apache from a
> PerlRequire. If that is not the case (and somehow works) I'd really like
> to get away from perlsections.

You can only configure Apache from  sections, but you can load all
your modules, shared data, etc. from a file pulled in with PerlRequire.

> > Your sub &x is a closure.  That's why it returns the previous value of
> > $x.  When it gets re-defined, it should start looking at the value of the
> > new $x.
> 
> You cannot redefine closures as well.

Closures are a confusing aspect of perl, and I could easily be mistaken
about them, but Randal and Doug seem to agree that this is a closure:

my $x;

sub show_x {
  print $x;
}

The easiest definition I've found is the one that Damian Conway has in his
OO Perl book:

"In Perl, a closure is just a subroutine that refers to one or more
lexical variables declared outside the subroutine itself."

When this code gets parsed, the $x goes out of scope at the end of the
block, but &show_x keeps a copy of it.

I think that this is the source of the behavior you saw where it looked
like there were multiple versions of subs and variables being created.

Anyway, I was just trying to help you solve your problem.  There's no need
to get defensive.

- Perrin




Re: Cookies (domains now working!)

2000-05-24 Thread Paul

--Geoff--
> > Also, as I mentioned earlier, I couldn't get "domain=...;" to work.
> make sure that the domain has a dot in front of it and that it
> matches the hostname of the box (RFC 2109):
> $headers_out->add('Set-Cookie', "name=$val; domain=.foo.com;");

Ah-HA! I *don't* think I used a dotThat was it!
multas gratias tibi do!
Thanks, lots. =o)  

Paul

Printed across the top of Folger's Gourmet Coffee Singles packets:
"100% COFFEE WITH ADDED FLAVORS"

=
"Seize the wildness of the moment, Feel the movement of the moon -- Swans fly with 
wings wide open to the sky." -- B-52's 
-
Real friends are those whom, when you inconvenience them, it bothers you more than 
them. -- me. =o) 
-
"There are trivial truths and there are great Truths. The opposite of a trival truth 
is obviously false. The opposite of a great Truth is also true."  -- Neils Bohr 
-
TEMPVS PECVDEM COLLARE EST - It's time to thin the herd.
-
[http://www.catfishforbreakfast.com/letgod.html]
-


__
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.com/



Re: Form generation libraries

2000-05-24 Thread Peter Haworth

Jeffrey W. Baker wrote:
> On Wed, 24 May 2000, Peter Haworth wrote:
> > Jeffrey W. Baker wrote:
> > > myInput = hfTextInputNew();
> > > myInput->addAttr(myInput, "name", "first_name");
> > > myInput->addAttr(myInput, "value", "Jeffrey");
> > > printf("%s\n", myInput->render(myInput));
> > > myInput->destroy(myInput);
> > > 
> > > I would expect a similar interface with more methods for a select box,
> > > e.g. mySelect->addOption(mySelect, myOption), and myOption->select.

Is this C or C++? If C, do you have a member for each function in the struct,
and if it's C++, why are you passing myInput twice? Or maybe you just got
carried away with your example.


> > Where do you store those attributes before you do the rendering? If you
> > tie yourself to Apache, you could use tables. If you tie yourself to perl,
> > you can use hashes. Otherwise you have to do your own hashes. Blech,
> > especially if you then use the library with Apache and/or perl - wasted
> > effort.
> 
> Actually, there is another way, and that is to simply build a linked list
> of attributes.  It doesn't matter what order you put the attributes in, so
> I just add them to the head of the list for performance.  Adding to the
> head of a list is faster than hashing anyway.  If you use the
> setAttr(self *, char *, char *) method, the list has to be scanned, but is
> is likely to be so short as to not matter.

OK, that seems sensible. There's no reason to go overboard to get more
hash-like semantics, when you'll generally just be stuffing things in, then
reading them all out.


> The other advantage here is storage space.  An attribute in this
> implementation takes up only 4*sizeof(void *) + strlen(name) +
> strlen(value) + 2.

Is it a doubly linked list, or are you storing something other than name,
value, next?

> > Bear in mind that it's nice to be able to support arbitrary attributes for
> > things like onMouseClick and the like, horrible though they are. This
> > means that you can't just define structs with members dedicated to
> > specific attributes.
> 
> Done.  The same approach is also used for adding options to a select box,
> although a select box will have an additional sort() method.

Well, personally, I'd have sorted my options before setting them up. Otherwise
you need unnecessarily complicated comparison functions to keep your "Please
select something" option at the top. ALthough, if it works that way, adding
options to a select has to add to the tail of the list, or you'd have to add
your options in reverse order.

-- 
Peter Haworth   [EMAIL PROTECTED]
"Well, let's just say, 'if your VCR is still blinking 12:00, you don't
 want Linux'". --Bruce Perens, Debian's Fearless Leader




Re: global variables and reparsing (short reproducible example)

2000-05-24 Thread Perrin Harkins

On Wed, 24 May 2000, Marc Lehmann wrote:

> On Wed, May 24, 2000 at 12:52:37AM +0300, Stas Bekman <[EMAIL PROTECTED]> wrote:
> >You can control what's being reloaded and what's not:
> >http://perl.apache.org/guide/config.html#Apache_Restarts_Twice_On_Start 
> 
> 
> Not really. This would require intimate knowledge of some module's
> implementation (which files it requires and which it doesn't). My hackish
> example did something similar, indeed, but it had to be embedded into the
> module source, which is somewhat inconvinient.

If you don't have PerlFreshRestart turned on (it is not recommended on
production servers), only the stuff in your config file ( sections
and PerlModule/PerlRequire) gets called twice.  You can block things out
like this:


unless ($Apache::Server::ReStarting) {
  ...
}


> BTW, what is the connection between that part of config.html and
> PerlFreshRestart? Can it happen that modules get reparsed even when
> PerlFreshRestart is off?

Only the stuff in your config file should get reparsed.

> Should I abstain from trying to restart apache when using any modules
> requiring full perl semantics? And is SIGUSR1 safe?

People have reported some growth in memory consumption when using
SUGUSR1.  Personally, I always do cold stop and start on my production
servers, in order to maximize shared memory, but this is difficult when
you don't have a load-balanced cluster at your disposal...

- Perrin




Limiting Resources

2000-05-24 Thread Suresh

Hi all,

I am trying to limit the execution of a mod_perl script by setting the limit of 
RLimitCPU. But
this does not seem to work. I am using apache 1.3.12 , mod_perl. I tired using the 
module
Apache::Resource but even that did not work.

Does any body know why this is or am i missing something.

suresh

__
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.com/



Re: Apache overhead using mod_perl IPC

2000-05-24 Thread Naren Dasu

Hi,
I had to deal in a similar situation,  Since the process that I wanted to
talk was on the same machine, I ended up using UDP sockets ( the other
process already spoke UDP),  I was blocking on the select for a couple of
milliseconds, and this did not affect performance much ( 30 millisecs on
the select blocking Vs 2 seconds for the HTML to be actually rendered on
the browser).   

In my case the response was smaller than the default UDP packet size (1 K).
 If your response from the server is fragmented, this may not be optimal,
you may have to increase the deafult UDP packet size or deal with packet
re-assembly.

hope this helps.

naren


At 10:47 AM 5/24/00 +0100, Reilly, Thomas wrote:
>Hi,
>   I'm new to all this and forgive me if my questions are basic
>My question is how scaleable is Apache in terms of performance when i use
>IPC from a mod_perl script? I basically want to have the Apache child
>process handling the request to communicate with another process (using
>mod_perl) and wait to get a response before continuing handling the request.
>I know this isn't recommended but i have to talk to legacy code and retrieve
>some data to send back to the client that made the request.
>   What is the best form of IPC to use and what are the implications on
>Apaches performance? i.e is it ok to have the child handling the response
>sit there waiting for its child to return something? Is this dangerous when
>multiple requests are involved?
>
>Thomas Reilly
>Software Consultant,
>
>Distributed Software Consultancy Ltd.,
>Ballybrit Business Park,Galway,Ireland.
>Tel: +353 (91) 760541 Fax: +353 (91) 760542
>e-mail: [EMAIL PROTECTED]
>web: http://www.dscie.com
>
>
>



Re: Form generation libraries

2000-05-24 Thread David Hodgkinson


I'm coming to this discussion quite late since I only just
resubscribed having changed jobs. Well, quit a job and gone
freelance.

As it happens, I've just written a form generation library, but one
that's driven by being mapped directly on top of a database table. It
can deduce the various field types by looking at the table metadata,
and you can tweak the appearance of the form with
->{table}->{field}->[ATTRIBUTE] settings.

Is this in the ballpark or have I totally missed something here?!

-- 
Dave Hodgkinson, http://www.hodgkinson.org
Editor-in-chief, The Highway Star   http://www.deep-purple.com
  Apache, mod_perl, MySQL, Sybase hired gun for, well, hire
  -



Re: Form generation libraries

2000-05-24 Thread Jeffrey W. Baker

On Wed, 24 May 2000, Peter Haworth wrote:

> Jeffrey W. Baker wrote:
> > I have read all of the messages in regarding the zygotic
> > HTML::Forms/FormGen project, and I like the idea.  However, I hope that
> > the inplementation of such a beast isn't in Perl.  To ensure that a
> > quality product results, I propose that this library be written in C, and
> > also in an object-oriented fashion.
> > 
> > What I propose is an object interface to the various form input types, as
> > well as some higher level functionality that encapsulated what people
> > frequently do with HTML forms.  For example, I would expect the C
> > interface to look something like this:
> > 
> > myInput = hfTextInputNew();
> > myInput->addAttr(myInput, "name", "first_name");
> > myInput->addAttr(myInput, "value", "Jeffrey");
> > printf("%s\n", myInput->render(myInput));
> > myInput->destroy(myInput);
> > 
> > I would expect a similar interface with more methods for a select box,
> > e.g. mySelect->addOption(mySelect, myOption), and myOption->select.
> 
> Where do you store those attributes before you do the rendering? If you tie
> yourself to Apache, you could use tables. If you tie yourself to perl, you can
> use hashes. Otherwise you have to do your own hashes. Blech, especially if you
> then use the library with Apache and/or perl - wasted effort.

Actually, there is another way, and that is to simply build a linked list
of attributes.  It doesn't matter what order you put the attributes in, so
I just add them to the head of the list for performance.  Adding to the
head of a list is faster than hashing anyway.  If you use the
setAttr(self *, char *, char *) method, the list has to be scanned, but is
is likely to be so short as to not matter.

The other advantage here is storage space.  An attribute in this
implementation takes up only 4*sizeof(void *) + strlen(name) +
strlen(value) + 2.  On 32-bit architectures, the attribute
name="myfield" only requires 29 bytes.  Only 45 bytes are required on
64-bit architectures.  Compare with Perl, where $hash{name} = 'myfield' is
costing several kilobytes at runtime.

> Bear in mind that it's nice to be able to support arbitrary attributes for
> things like onMouseClick and the like, horrible though they are. This means
> that you can't just define structs with members dedicated to specific
> attributes.

Done.  The same approach is also used for adding options to a select box,
although a select box will have an additional sort() method.

-jwb




CORE::exit and Apache:Registry

2000-05-24 Thread Mark Hewis

As far as I have tested under Apache::Registry the following commands have
the following effect

1) CORE::exit -> restart all child processes for that server ( a little too
drastic for me)
2) exit -> exit code but leave state of all modules the same

What am am really after is an exit which just restarts the child process (it
is called in) resetting all module globals any suggestions?

On a related topic in a given module

BEGIN{} seems to be called only on child initialisation while
END{} is called at the end of each processed request

This seems a little inconsistant why is this? Can this behaviour be changed?

Because of this

close_everything() in END{} in BerkeleyDB.pm is called after each request
destroying any ties or environments open which for me is not good.

Thanks for any help

Mark Hewis




Versions/Settings
#
Apache:1.3.12
Mod_perl:1.21
perl:5.00503
Makefile command for modperl:
perl Makefile.PL \
APACHE_SRC=../apache_1.3.12/src \
DO_HTTPD=1 \
USE_APACI=1 \
PERL_MARK_WHERE=1 \
PERL_STACKED_HANDLERS=1 \
PERL_CHILD_INIT=1 \
ALL_HOOKS=1 \
APACI_ARGS=--enable-module=rewrite,--enable-module=proxy
Platform:SunOS ops-dev6 5.6 Generic_105181-19 sun4u sparc
SUNW,UltraSPARC-IIi-cEngine
Passed all tests


This e-mail, and any attachment, is confidential. If you have received it in error, 
please delete it from your system, do not use or disclose the information in any way, 
and notify me immediately. The contents of this message may contain personal views 
which are not the views of the BBC, unless specifically stated.



Re: Cookies

2000-05-24 Thread Vivek Khera

> "JS" == Jim Serio <[EMAIL PROTECTED]> writes:


JS> This brings up a not-so-mod_perl question. Is there a way to telnet
JS> to name-based virtual hosts? Can I spoof the GET request?

No need to spoof anything, the protocol is entirely ASCII so you can
just type the proper commands in your telnet window.  Or do it the
easy way and use the LWP modules for perl.






Re: global variables and reparsing (short reproducible example)

2000-05-24 Thread Randal L. Schwartz

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

tayers> Given the above more complete descriptions I would say the usage in
tayers> L is confusing. 

I agree with that, and with your general observation.  From my hanging
out on P5P, a subroutine is only a closure when it sees lexical
variables and must therefore create a distinct clone of the
environment on the way out.

And both named subroutines and anonymous subroutines can be closures.

Here's how to tell if a subroutine is a closure or not:

for (1..5) {
  push @a, sub { "hi there" };
}
for (1..5) {
  {
my $b;
push @b, sub { $b."hi there" };
  }
}
print "anon normal: @a\n";
print "anon closure: @b\n";

which generates

anon normal: CODE(0x80ce9d4) CODE(0x80ce9d4) CODE(0x80ce9d4) CODE(0x80ce9d4) 
CODE(0x80ce9d4)
anon closure: CODE(0x80c83ac) CODE(0x80d2440) CODE(0x80d24a0) CODE(0x80d2500) 
CODE(0x80d2560)

Note how each coderef from the non-closure is identical, but the
closure form must generate distinct coderefs to point at the distinct
instances of the closure.

This is the underpinnings of that famous "won't stay shared" message.
A "my" variable in a named subroutine context is generating distinct
coderefs.

So, in summary, "closure" vs "non-closure", and "named subroutine" vs
"anonymous subroutine" are orthogonal concepts.  Pick one from each
column. :) And it's too bad that we have people mixing the terms up,
because cargo-cult meme virus items spread fast in the Perl extended
community.

-- 
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!



[Mason]ANNOUNCE: HTML::Mason 0.87

2000-05-24 Thread Jonathan Swartz

The URL

http://www.masonhq.com/download/HTML-Mason-0.87.tar.gz

has entered CPAN as

  file: $CPAN/authors/id/J/JS/JSWARTZ/HTML-Mason-0.87.tar.gz
  size: 258934 bytes
   md5: d5cffa74a749b2530daaca6a4ab7caf6

This fixes a multiple GET/POST argument glitch introduced in 0.86,
reported by Matt Hoskins. This should finally provide the first
stable release of Mason with object-oriented primitives (I hope!)





Re: Problem compiling mod_perl 1.24 on Solaris 2.6

2000-05-24 Thread Fred Miller

Doug MacEachern wrote:
> 
> On Tue, 23 May 2000, Fred Miller wrote:
> > I am experiencing what appears to be a very similar problem, but with
> > more recent modules and OS. I am running mod_perl 1.24, Perl 5.6.0,
> > Apache 1.3.12, Solaris 2.6
> 
> perl -V would help.  is your cc gcc or sun's?

# perl -V
Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
osname=solaris, osvers=2.6, archname=sun4-solaris
uname='sunos dmci 5.6 generic_105181-03 sun4u sparc sunw,ultra-1 '
config_args=''
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=define 
use64bitint=undef use64bitall=undef uselongdouble=undef
usesocks=undef
  Compiler:
cc='cc', optimize='-O', gccversion=
cppflags='-I/usr/local/include'
ccflags ='-I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib -L/opt/gnu/lib '
libpth=/usr/local/lib /opt/gnu/lib /lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -ldl -lm -lc -lcrypt -lsec
libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-KPIC', lddlflags='-G -L/usr/local/lib -L/opt/gnu/lib'


Characteristics of this binary (from libperl): 
  Compile-time options: USE_LARGE_FILES
  Built under solaris
  Compiled at May 16 2000 16:01:12
  @INC:
/usr/local/lib/perl5/5.6.0/sun4-solaris
/usr/local/lib/perl5/5.6.0
/usr/local/lib/perl5/site_perl/5.6.0/sun4-solaris
/usr/local/lib/perl5/site_perl/5.6.0
/usr/local/lib/perl5/site_perl
.

Like I said, I'm a bit naive in these matters. I didn't specify using
gcc or cc. I used the same path to compile Perl, Apache, and Mod_Perl.
When I aaksed which gcc and which cc, my machine does report gcc
appearing in my path ahead of cc. Could that be the problem?

>looking at the line number, i would try replacing any occurance of:
>
> perl_eval_sv -> eval_sv
> perl_call_sv -> call_sv
> perl_call_pv -> call_pv

I wish I was experienced enough to know what this means.

Thanks for the help.

Fred


-- 
[EMAIL PROTECTED]
http://titan.iwu.edu/~fmiller/



Re: Form generation libraries

2000-05-24 Thread Peter Haworth

Jeffrey W. Baker wrote:
> I have read all of the messages in regarding the zygotic
> HTML::Forms/FormGen project, and I like the idea.  However, I hope that
> the inplementation of such a beast isn't in Perl.  To ensure that a
> quality product results, I propose that this library be written in C, and
> also in an object-oriented fashion.
> 
> What I propose is an object interface to the various form input types, as
> well as some higher level functionality that encapsulated what people
> frequently do with HTML forms.  For example, I would expect the C
> interface to look something like this:
> 
> myInput = hfTextInputNew();
> myInput->addAttr(myInput, "name", "first_name");
> myInput->addAttr(myInput, "value", "Jeffrey");
> printf("%s\n", myInput->render(myInput));
> myInput->destroy(myInput);
> 
> I would expect a similar interface with more methods for a select box,
> e.g. mySelect->addOption(mySelect, myOption), and myOption->select.

Where do you store those attributes before you do the rendering? If you tie
yourself to Apache, you could use tables. If you tie yourself to perl, you can
use hashes. Otherwise you have to do your own hashes. Blech, especially if you
then use the library with Apache and/or perl - wasted effort.

Bear in mind that it's nice to be able to support arbitrary attributes for
things like onMouseClick and the like, horrible though they are. This means
that you can't just define structs with members dedicated to specific
attributes.

> The Perl wrapper around this library is pretty obvious, and can use the
> object-oriented approach also.  We can build upon that with an
> enhanced-for-mod_perl interface.
> 
> I expect that a C implementation will be ideal from the standpoint of
> speed and also memory.  I have taken the liberty of implementing the
> neccessary code for the text input type, and the object code is a whopping
> 2116 bytes, which is mostly base class logic that won't be duplicated for
> the other types.  The implementation is also quite fast, rendering 10
> simple text inputs to /dev/null in .78 seconds, without optimizations.

Sounds good.

> If people think this is the way to go, I will write up a Makefile and
> release the code.

I'd like to see it, or at least an explanation of the issues mentioned above.

-- 
Peter Haworth   [EMAIL PROTECTED]
Everything can be filed under "miscellaneous."
--Dilbert's Laws




Re: RFC: Apache::Request::Forms (or something similar)

2000-05-24 Thread Peter Haworth

Vivek Khera wrote:
> > "PH" == Peter Haworth <[EMAIL PROTECTED]> writes:
> 
> >> 
> >> HTML::Form? :)
> 
> PH> Well, duh! Why didn't I think of that? Unfortunately though,
> PH> HTML::Form already exists, and doesn't really do the same kind of
> PH> thing. How about HTML::FormGen?
> 
> How 'bout HTML::StickyForms ?

OK, that's two votes, and I like it as well.

HTML::StickyForms (or possibly HTML::StickyForm) it is then.

-- 
Peter Haworth   [EMAIL PROTECTED]
A host is a host from coast to coast
& no one will talk to a host that's close
Unless the host (that isn't close)
is busy, hung or dead




Re: global variables and reparsing (short reproducible example)

2000-05-24 Thread tayers

> "M" == Marc Lehmann <[EMAIL PROTECTED]> writes:
M> On Tue, 23 May 2000, Perrin Harkins wrote:
>> Your sub &x is a closure.  That's why it returns the previous value of

M> No. In perl, a closure is *defined* as "anonymous subroutine" (see the
M> documentation). If you define it different, you are right, but you are not
M> talking about perl then.

What? Can we get a reference to your definition?

>From Camel book, 2nd edition, page 253:

Closures

Earlier we talked about creating anonymous subroutines with a
nameless C. Since anonymous subroutines have to be
generated somplace within your code (in order to generate the
reference that you poke into some variable), such routines can be
thought of as coming into existence at run-time. (That is, they
have a time of generation as well as a location of definition.)
Because of this fact, anonymous subroutines can act as I
with respect to C variables - that is, with respect to
variables visible lexically within the current scope. Closure is a
notion out of the Lisp world that says if you define an anonymous
function in a particular lexical context at a particular moment,
it pretends to run in that context even when it's called outside
of the context. In other words, you are guaranteed to get the same
copy of a lexical variable, even though many other instances of
the same lexical variable may have been created before or since.

Also 'perldoc -q closure' and 'man perlref' agree with Perrin.

There is one ambiguous use of "closure" in L that I found
during my quick scan. Maybe that's what you're hanging your hat on?

>From 'man perlsub'

   Like many languages, Perl provides for user-defined sub-
   routines.  These may be located anywhere in the main pro-
   gram, loaded in from other files via the `do', `require',
   or `use' keywords, or generated on the fly using `eval' or
   anonymous subroutines (closures). 

Given the above more complete descriptions I would say the usage in
L is confusing. 

Hope you have a very nice day, :-)
Tim Ayers ([EMAIL PROTECTED]) who, against better judgement, as an
ex-Lisper just couldn't let this slide




RE: Cookies

2000-05-24 Thread Geoffrey Young



> -Original Message-
> From: Paul [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 23, 2000 7:39 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Cookies
> 
> 
> > Is there an easier way to accomplish this? I seem to recall
> > that Apache has a simplfied way of setting a cookie upon the
> > initial request if one wasn't yet set, but I can't find anything
> > in the docs.
> 
> I'm doing something vaguely similar.
> 
> sub handler {
>  my($r,$cookie);
>  $r = shift;# the request object
>  if ($cookie = $r->header_in('Cookie')
>  and $cookie =~ /somevalue/o) { 
> # ... got the cookie, do some code
>  } else { # no cookie, so set one
> my $val = 'something useful';
> $r->headers_out->add('Set-Cookie' => 
>  "name=$val; path=/;");
>  }
>  # ... return something useful
> }
> ===
> 
> $r->header_in('Cookie') reads the HTTP headers the browser sent with
> the request, which include Cookies. 

since you use headers_out() already, you might want to try using
headers_in() just for style points :)
$r->headers_in->{'Cookie'}
 
> 
> $r->headers_out->add('Set-Cookie' => "CUID=$usr; path=/;") adds a
> Set-Cookie header to the HTTP header lines going out with the 
> response.
> 
> I do have a question, though.  Don't seperate cookies coming in from
> the browser get seperate Cookie: headers?  This code is working, but I
> don't want to build it to break later.  Should I be reading them into
> an array?

different cookies appear as one value in the headers, separated by a
semi-colon. try something like:
my @cookies =  split /; /, $r->headers_in->{'Cookie'};

> 
> Also, as I mentioned earlier, I couldn't get "domain=...;" to work.
> Suggestions?

make sure that the domain has a dot in front of it and that it matches the
hostname of the box (RFC 2109):
$headers_out->add('Set-Cookie', "name=$val; domain=.foo.com;");

HTH

--Geoff

> 
> Anyway, hope that helps.  
> Feel free to offer criticisms and suggestions.
> 
> Paul
> 
> Notice on grape nuts box tab (in its entirety):
> "CONTENTS MAY HAVE OCCURRED DURING SHIPPING AND HANDLING"
> 
> 
> __
> Do You Yahoo!?
> Send instant messages & get email alerts with Yahoo! Messenger.
> http://im.yahoo.com/
> 



Re: global variables and reparsing question (low priority ;)

2000-05-24 Thread Ken Williams

[EMAIL PROTECTED] (Marc Lehmann) wrote:
>> flag to keep from compiling again and checking $@ yourself, so you're
>> getting around these problems, but the file form of do is generally a red
>> flag.
>
>This is just as saying "division is a bad thing in general, because it
>let's you try to divide by zero". 

As a math teacher, I must point out that dividing by zero really *is*
bad, so perhaps we really *should* outlaw division.  Let people multiply
by the reciprocal.  

One of my students divided by zero and the rest of us had to clean up
the mess for weeks afterwards.  Pulp everywhere!  Much worse than trying
to take the square root of a negative number, which just gives you a
Pavlovian shock and sends you on your way.

( =), of course)


  ------
  Ken Williams Last Bastion of Euclidity
  [EMAIL PROTECTED]The Math Forum





Re: Apache::PerlVINC

2000-05-24 Thread Kees Vonk 7249 24549

> try this in httpd.conf:
> 
> 
> delete $INC{'Apache/PerlVINC.pm'};
> require Apache::PerlVINC;
> 

Apache start up now (why does mod_perl not do this, can you 
explain?), however I get the following error when trying to 
access a page that contains the reloaded module:



[Wed May 24 09:00:15 2000] [warn] Apache::PerlVINC: reloading 
'Ward/IDV/IDVDatabase.pm'

[Wed May 24 09:00:15 2000] [error] Can't locate 
Ward/IDV/IDVDatabase.pm in @INC (@INC contains:) at 
/opt/perl5/lib/site_perl/PA-RISC1.1/Apache/PerlVINC.pm line 
59.

-


I played around a little bit and found that I have to put the 
PerlVersionINC directive before the PerlINC directive (which 
makes sense looking at the code) and then that works (you 
might want to change this in your example, (and in the guide, 
Stas)).


Thank you very much, your help has been invaluable.


Kees


PS. my offer of helping out mainting this module still 
stands, I start understanding it better all the time.



Apache overhead using mod_perl IPC

2000-05-24 Thread Reilly, Thomas

Hi,
I'm new to all this and forgive me if my questions are basic
My question is how scaleable is Apache in terms of performance when i use
IPC from a mod_perl script? I basically want to have the Apache child
process handling the request to communicate with another process (using
mod_perl) and wait to get a response before continuing handling the request.
I know this isn't recommended but i have to talk to legacy code and retrieve
some data to send back to the client that made the request.
What is the best form of IPC to use and what are the implications on
Apaches performance? i.e is it ok to have the child handling the response
sit there waiting for its child to return something? Is this dangerous when
multiple requests are involved?

Thomas Reilly
Software Consultant,

Distributed Software Consultancy Ltd.,
Ballybrit Business Park,Galway,Ireland.
Tel: +353 (91) 760541 Fax: +353 (91) 760542
e-mail: [EMAIL PROTECTED]
web: http://www.dscie.com





Re: CGI->cookie() problem

2000-05-24 Thread Kenneth Lee

I dived into CGI.pm, and I found what probably the problem is.

When one calls CGI->cookie(), CGI will create a default query object, 
stored in the package global $CGI::Q, and in CGI::cookie(), it does 
some caching for performance issues. That seems to make things screwed up.

It follows that all mod_perl scripts are sharing the same $CGI::Q, if 
they `use CGI qw(:standard)' to import the methods.

Kenneth


"Randal L. Schwartz" wrote:
> 
> > "Kenneth" == Kenneth Lee <[EMAIL PROTECTED]> writes:
> 
> Kenneth> Hi perlers,
> Kenneth> It seems that CGI->cookie() is not always returning the right thing.
> 
> Kenneth> For example, three clients A, B and C send to the server three different
> Kenneth> session keys X, Y and Z repectively. In some circumstances, CGI->cookie()
> Kenneth> gives Y as A's cookie, Z as B's and X as C's, while they _are_ sending
> Kenneth> the correct ones. The problem seems to be solved now by replacing
> Kenneth> CGI-> cookie() with CGI::Cookie->fetch.
> 
> You know, I'd give a wager that this is because CGI::cookie is not
> always recognizing that the first parameter is "CGI" when called
> as CGI->cookie().  In fact, I had a problem the other day with that
> too.  Try changing CGI->cookie() (not documented as working, I see
> only instance calls, not class calls in "perldoc CGI") with CGI::cookie().



Re: global variables and reparsing question (low priority ;)

2000-05-24 Thread Marc Lehmann

On Tue, May 23, 2000 at 08:22:59PM -0700, Doug MacEachern <[EMAIL PROTECTED]> wrote:
> > If this were true, it would be very bad. If there is no technical
> > need to do this "half-reloading" then it should definitely be turned
> > off.
> 
> it is off by default, you turned it on with 'PerlFreshRestart On'

Which had undocumented side effects, breaking valid perl. (No problem, if
everywhere were documented... :)

> > It breaks perfectly valid perl code, creating some kind of
> 
> it's not breaking code, it's exposing broken code.  if a module can't
> then the module is broken.

You must be kidding here!!! Using lexicals on package level is broken??? If
it is broken, then _why_ is it recommended programming practise in perl (see
perltoot for example)?

Sorry, you can say that this and that programming technique is invalid
under PerlFreshRestart, which is entirely ok, and just means that mod_perl
!= perl (which it is in other details as well). Calling recommended perl
programming techniques "broken", however, is something entirely different

:-|

Especially since this results in _very_ subtle problems, in where, for
example, splitting a function into two functions might render a program
not working for reasons well outside the understanding of many perl
programmers.

In any case, mod_perl is fine to do this. It would have bitten me much
later if it didn't do this double-parsing at loading time. This, however,
is an incompatibility from mod_perl to standard perl, not "broken".

What is broken is the notion of "deleting from INC" is equivalent to
"unloading a module".

-- 
  -==- |
  ==-- _   |
  ---==---(_)__  __   __   Marc Lehmann  +--
  --==---/ / _ \/ // /\ \/ /   [EMAIL PROTECTED] |e|
  -=/_/_//_/\_,_/ /_/\_\   XX11-RIPE --+
The choice of a GNU generation   |
 |



Re: global variables and reparsing (short reproducible example)

2000-05-24 Thread Marc Lehmann

On Tue, 23 May 2000, Perrin Harkins wrote:

> Your sub &x is a closure.  That's why it returns the previous value of

No. In perl, a closure is *defined* as "anonymous subroutine" (see the
documentation). If you define it different, you are right, but you are not
talking about perl then.

-- 
  -==- |
  ==-- _   |
  ---==---(_)__  __   __   Marc Lehmann  +--
  --==---/ / _ \/ // /\ \/ /   [EMAIL PROTECTED] |e|
  -=/_/_//_/\_,_/ /_/\_\   XX11-RIPE --+
The choice of a GNU generation   |
 |



Re: global variables and reparsing question (low priority ;)

2000-05-24 Thread Marc Lehmann

> > Huh? Why is "do" a bad thing
> 
> Do is bad because it is called every time, even if you've already executed

You are confused about the two different forms of do. The do BLOCK form I
used has nothing to do with the do EXPR form you seem to be confused about.
perldoc -f do explains the differences quite in detail.

> flag to keep from compiling again and checking $@ yourself, so you're
> getting around these problems, but the file form of do is generally a red
> flag.

This is just as saying "division is a bad thing in general, because it
let's you try to divide by zero". Of course you could abuse do, but you
should read about the different forms of do in the perl documentation
where it explains what do is for, and what it isn't for.

(let's direct followup discussion about perl to private mail, thanks)

-- 
  -==- |
  ==-- _   |
  ---==---(_)__  __   __   Marc Lehmann  +--
  --==---/ / _ \/ // /\ \/ /   [EMAIL PROTECTED] |e|
  -=/_/_//_/\_,_/ /_/\_\   XX11-RIPE --+
The choice of a GNU generation   |
 |



Re: global variables and reparsing (short reproducible example)

2000-05-24 Thread Marc Lehmann

On Wed, May 24, 2000 at 12:52:37AM +0300, Stas Bekman <[EMAIL PROTECTED]> wrote:
>You can control what's being reloaded and what's not:
>http://perl.apache.org/guide/config.html#Apache_Restarts_Twice_On_Start   
>   

Not really. This would require intimate knowledge of some module's
implementation (which files it requires and which it doesn't). My hackish
example did something similar, indeed, but it had to be embedded into the
module source, which is somewhat inconvinient.

BTW, what is the connection between that part of config.html and
PerlFreshRestart? Can it happen that modules get reparsed even when
PerlFreshRestart is off? Should I abstain from trying to restart apache
when using any modules requiring full perl semantics? And is SIGUSR1 safe?

(Sorry, so many questions..  :)

-- 
  -==- |
  ==-- _   |
  ---==---(_)__  __   __   Marc Lehmann  +--
  --==---/ / _ \/ // /\ \/ /   [EMAIL PROTECTED] |e|
  -=/_/_//_/\_,_/ /_/\_\   XX11-RIPE --+
The choice of a GNU generation   |
 |



Re: global variables and reparsing (short reproducible example)

2000-05-24 Thread Marc Lehmann

On Tue, May 23, 2000 at 04:07:40PM -0700, Perrin Harkins <[EMAIL PROTECTED]> wrote:
> This is a combination of closures and PerlFreshRestart biting
(still no closures)

My example might be misleading, since I used x before it was defined (to make
the example short). Typical examples look like this:

my $global1;

sub func1_using_global1 {
}

sub func2_using_global2_and_func1 {
}
 
etc... Users of the module outside the module itself can get incosistent
views about which fucntion accesses which global.

> Most people do a "PerlRequire startup.pl" and then put all that stuff in
> startup.pl, which runs before the fork.  It will not be run twice because
> PerlRequire will see it in %INC, unless you use PerlFreshRestart.

I was under the impression that you cannot configure Apache from a
PerlRequire. If that is not the case (and somehow works) I'd really like
to get away from perlsections.

> Your sub &x is a closure.  That's why it returns the previous value of
> $x.  When it gets re-defined, it should start looking at the value of the
> new $x.

You cannot redefine closures as well.

-- 
  -==- |
  ==-- _   |
  ---==---(_)__  __   __   Marc Lehmann  +--
  --==---/ / _ \/ // /\ \/ /   [EMAIL PROTECTED] |e|
  -=/_/_//_/\_,_/ /_/\_\   XX11-RIPE --+
The choice of a GNU generation   |
 |



Re: Cookies

2000-05-24 Thread Matt Sergeant

On Tue, 23 May 2000, Jim Serio wrote:

> Like I said, the cookie is being set, but I can't read the cookie.
> Apache::Cookie->fetch('cookie_name'); doesn't work.
> 
> >this is a fixup handler?  you shouldn't be sending the complete http
> >header there.  you should use $r->headers_out like you did in your
> >original example.  and, use telnet to see what your module is actually
> >sending, or a log handler that dumps $r->as_string, or Apache::DumpHeaders
> >(on cpan).
> 
> 
> This brings up a not-so-mod_perl question. Is there a way to telnet
> to name-based virtual hosts? Can I spoof the GET request?

telnet  80
GET / HTTP/1.1
Host: 



-- 


Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org http://xml.sergeant.org