Re: How to restart the root server from within modperl?

2003-08-14 Thread Dennis Stout
On a whim, I would try writing a second script to do the actual shutdown and
restart of Apache.

Then have your mod_perl program either run it in the background (with a &) or
fork it into another process.

Just a thought.

Dennis

S.T.O.U.T. = Synthetic Technician Optimized for Ultimate Troublshooting
- Original Message - 
From: "Dirk Lutzebaeck" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 11, 2003 13 16
Subject: How to restart the root server from within modperl?


>
> Hi,
>
> how can I restart the root httpd server from within modperl? My
> problem is that when I call system() with say apachectl restart the
> father process is stopped killing the children including the apachectl
> itself. So it can't start of again. Can I call something like a reload
> of httpd.conf?
>
> Why I want to do this? I have a set of configurations and file links
> for different versions for my modperl application which I want to activate
> from the modperl application itself (having a HTML user interface).
>
> Thanks for help,
>
> Dirk



Re: Variables

2003-07-21 Thread Dennis Stout
> > Is there a way I could get these variables populated on server start and
never
> > loaded again unless the database was changed?  So in my subroutine for
posting
> > an event that changed it I could call "repopulate_queue_hash" and have it
redo
> > the hash, so changes still happened without a restart, but the hash itself
is
> > just passed from the root apache process to the children?
>
> You can load it into globals at startup and their values will be shared
> by all children until you write to them.  You could also load it

So in startup.perl put

my %queue_list = list_queues;
my %tech_list = list_techs;

and so on?

Then each process would get a copy of the hash?

> separately in each child process in the init hook.  However, you'd

If I did that, then I'd want a few children processes at a time and also with
a few amount of requests per child...  Boy am I ever glad this'll be moved off
my box once it's finsihed ;)

> probably be better off using MLDBM::Sync, so that all changes are shared
> immediately.  It's quite fast, and since it uses a tied interface it
> would be easy to switch your code to use globals if it turns out not be
> fast enough.

After reading the perldoc for MLDBM, and reviewing my deadline for the project
of "today", I think I'll just use globals for now.  But once I meet get the
management satisified, I'll be moved into a "enhancment" phase of hte project,
instead of a devel phase, and I'll implement it then to see how well it works.

Thanks :)



Variables

2003-07-21 Thread Dennis Stout
In this project I'm making (database), I have several variables with a
potential for a large amount of information to be held in them.

They're all hashes.  Some are hashes of hashes...

There is a tech_list, which holds information about each technician.
There is a queue_list which holds an ID and a queue name (to interact with a
db)
There is a list of ISP's (we're the help desk for 3, and constantly looking
for more)
There is a list of service plans (dialup, 256k/512k/768k dsl..)
There is a list of operating systems..
A list of browsers...

All the lists have an ID component and a name component, so it's used in the
context of

$list{$_} (where $_ is
the current iteration of a foreach loop and everything in the option tags is
created as it iterates...)

Is there a way I could get these variables populated on server start and never
loaded again unless the database was changed?  So in my subroutine for posting
an event that changed it I could call "repopulate_queue_hash" and have it redo
the hash, so changes still happened without a restart, but the hash itself is
just passed from the root apache process to the children?

I know this means that each child would retain the old hash util it died and
another one respawned, meaning some people would see the change and others
wouldn't until it fully propogated, but I can make that happen easily enough
by decreasing the number of requests per child...  I know that happens at some
performance loss, but I think the loss of performance in Apache would be less
than the loss of performance generating the same hash over and over again,
which will grow to be huge after time.  Consider 350 users using this thing
for a solid 16 hours a day, and a hundred or so using it the other 8.

Thanks

Dennis





Re: Values of an array..

2003-07-21 Thread Dennis Stout
> >"Dennis Stout"  wrote ...
> > my %user_list = get_users($where);
> >
> > foreach (keys %user_list) {
> > my $user = $_;
> > foreach (@{$user_list{$user}{DOMAIN}}) {
> > $user_list{$user}{DOMAINS} .=
> >"$user_list{$user}{DOMAIN}[$_],";
> > }
> > chop($user_list{$user}{DOMAINS});
> >...
>
> >$user_list{$user}{DOMAINS} .= "$user_list{$user}{DOMAIN}[$_],";
>
> That line is the culprit.  $_ contains each domain name as a text
> string.  Which evaluates to 0 when used as an integer, which then gives the
> first entry in the array.  Thus you get the first entry in the array as
> many times as you have entries in the array.  Try changing that to a
> regular (indexed) for loop and that should fix it.

Good eye, I was too busy thinking of hashes and things.

I hate array's.

Should just be $user_list{$user}{DOMAINS .= "$_,"; huh?

Thanks

Dennis



Re: Values of an array..

2003-07-21 Thread Dennis Stout
> shouldnt 'my $user' be outside the foreach loop?

No, it's supposed to be changed each iteration through the loop.  Basically it
saves $_ to something else, so the next foreach loop doesn't overwrite it,
since I need it's value as a key for the hash the next loop creates.

Dennis



Values of an array..

2003-07-21 Thread Dennis Stout
I dunno if it's an array or a reference ot an array anymore, heh.

Whats happening, is instead of this thing pulling all 3 of my domains from a
database, it's pulling the first domain in the list as many times as I have
domains for.  So when I only had 2 domains in the db for myself, it listed
hte first twice.  I added a 3rd ot test the theory, and behold, I get hte
first one 3 times.

Here is some massive subroutinage..

sub post_search_form {
my $state = shift;
my %args = $state->{q};
$state->{template} = 'generic.tmpl';
$state->{title} = "User Search";
my $blah = "";
my $where;
my %search;

$search{USER} = $state->{q}{user} if $state->{q}{user};
$search{ISP} = $state->{q}{isp} if $state->{q}{isp};
$search{PWORD} = $state->{q}{pword} if $state->{q}{pword};
if ($state->{q}{name}) {
($search{FIRST}, $search{LAST}) = split("
",$state->{q}{name});
}
$search{H_PHONE} = $search{W_PHONE} = $search{D_PHONE} =
$search{C_PHONE} = $state->{q}{phone} if $state->{q}{phone};
$search{EMAIL1} = $search{EMAIL2} = $search{EMAIL3} =
$search{EMAIL4} = $state->{q}{email} if $state->{q}{email};
$search{STATICIP} = $state->{q}{staticip} if $state->{q}{staticip};
$search{DOMAIN} = $state->{q}{domain} if $state->{q}{domain};
$search{ACCNUM} = $state->{q}{accnum} if $state->{q}{accnum};

foreach (keys %search) {
if ($_ eq "DOMAIN") {
$where .= "domain.$_ LIKE \"\%$search{$_}\%\" AND ";
} elsif ($_ eq m/PHONE/) {
$where =~ s/ AND $/ OR /;
$where .= "users.$_ LIKE \"\%$search{$_}\%\" OR ";
} else {
$where .= "users.$_ LIKE \"\%$search{$_}\%\" AND ";
}
}

$where =~ s/ OR $//;
$where =~ s/ AND $//;

my %user_list = get_users($where);

foreach (keys %user_list) {
my $user = $_;
foreach (@{$user_list{$user}{DOMAIN}}) {
$user_list{$user}{DOMAINS} .=
"$user_list{$user}{DOMAIN}[$_],";
}
chop($user_list{$user}{DOMAINS});

$blah .=
"$_$user_list{$_}{ISP}$user_list{$_}{PWORD}$user_list{$_}{FIRST}
$user_list{$_}{LAST}$user_list{$_}{H_PHONE},$user_list{$_}{W_PHONE}
,$user_list{$_}{C_PHONE},$user_list{$_}{D_PHONE}$user_list{$_}{EMAI
L1},$user_list{$_}{EMAIL2},$user_list{$_}{EMAIL3},$user_list{$_}{EMAIL4}$user_list{$_}{STATICIP}$user_list{$_}{DOMAINS}$user_
list{$_}{ACCNUM}";
}

$args{body} =<

userisppasswordnamephoneemail
static ipdomainservice number
$blah


EOF

return output_html($state, %args);
}

sub get_users {
my $where = shift;
my %search;
my %user_list;

my $sth =
$Sql->select("ISP,USER,PWORD,FIRST,LAST,H_PHONE,W_PHONE,C_PHONE,D_PHONE,EMAI
L1,EMAIL2,EMAIL3,EMAIL4,STATICIP,ACCNUM","users","$where");
while (my $row = $sth->fetchrow_hashref) {
$user_list{$row->{USER}} = {
ISP =>  $row->{ISP},
PWORD   =>  $row->{PWORD},
FIRST   =>  $row->{FIRST},
LAST=>  $row->{LAST},
H_PHONE =>  $row->{H_PHONE},
W_PHONE =>  $row->{W_PHONE},
C_PHONE =>  $row->{C_PHONE},
D_PHONE =>  $row->{D_PHONE},
EMAIL   =>  $row->{EMAIL},
STATICIP=>  $row->{STATICIP},
ACCNUM  =>  $row->{ACCNUM},
};
}

foreach my $user (keys %user_list) {
$sth = $Sql->select("DOMAIN","domain","USER='$user'");
while (my $row = $sth->fetchrow_hashref) {
push @{$user_list{$user}{DOMAIN}}, $row->{DOMAIN};
warn "$row->{DOMAIN}";
}
}

return %user_list;
}


That warn statement in sub get_users generates this in my error_log file

www.blah.org at /home/httpd/ttms/perl/SQLCrap.pm line 145.
www.boop.com at /home/httpd/ttms/perl/SQLCrap.pm line 145.
www.fucker.com at /home/httpd/ttms/perl/SQLCrap.pm line 145.

And yet displayed on the webpage is

www.blah.org,www.blah.org,www.blah.org

So uh...  what am I doing wrong?

Dennis



Re: does pnotes() work at all in 1.27?

2003-07-18 Thread Dennis Stout
> No progress yet. I just tested pnotes in the same handler and it works.
> Tested it again by setting a value in the content handler and trying to
> retreive it it my logging handler and no luck.

It looks like I start work on finding out about your problem tonight instead
of last night.

Funny story:  I did a field call this morning in Palmer, had to do a line test
for DSL.  Then I had to do another one down Knik Goose Bay road (I know you
have no idea of these locations, but thats roughly 30 miles there...).  About
25 miles out of Palmer, I hear this "ti-ti-ti-ti-thwou - whack" vaguely
somewhere above and behind me.

Anwyays, get to the location, customers mahcine is up and running on DSL, so
no line test neccessary.

On my way back to Palmer, I see this laptop on the side of the road...  I pull
over, and guess what I left sitting on the van in Palmer?

W.  Ever seen remains of a laptop after hitting pavement at 55mph?

I can't believe it stayed up there for so long.  I was stopping at all kinds
of stop lights/signs and stuff, and reaching speeds of 80mph around curves :D

Alright, so this wasn't mod_perl related.  A bunch of techies can laugh over
this tho, and humor is a good thing :)

Dennis



Re: does pnotes() work at all in 1.27?

2003-07-17 Thread Dennis Stout
> Has anyone gotten $r->pnotes() to work under Apache 1.3.27 and mod_perl
> 1.27? A simple yes will do because then at least I'll know if it's my
> mistake or a bug.

I'll work on it when I get home again.  weee, thursday, gotta have this
project done monday..  *sigh*

The good news, is that I run Apache 1.3.27 and mod_perl 1.27.

Anyways, thought you might like to know I'll work on it and someone out there
HAS read your email :)

Dennis



Re: pnotes and notes not working from Apache::Registry to handler

2003-07-16 Thread Dennis Stout
> I'm trying to store data about a user who has authenticated in
> $r->pnotes so that a perl logging phase handler can stick the user_id in
> the db. I call $r->pnotes('keyname' => 'somevalue'); in an apache
> registry script, and then call $r->pnotes('keyname') in the logging
> handler later on during the logging phase, but am getting nothing back.
> No errors, just undef. I've tried notes too, and no luck their either.
> I'm using Apache::Request btw. I've also tried retreiving a tied hash
> using $r->pnotes() and there are no key/values in that either.

the mod_perl API book specifically said pnotes is the way to communicate
between handlers.  As I have hte PDF version, I can't exactly cut & paste it
easily...

pnotes gets cleared after every request, so good thinking on trying notes, as
it apearently doesn't.

the basic usage is this:

$r->pnotes("MY_HANDLER" => [qw(one two)]);
my $val = $r->pnotes("MY_HANDLER");
print $val->[0]; # prints "one"

So basically, $r->pnotes("MY_HANDLER" => [qw(one two)]); will create a hash
where MY_HANDLER is a key to an anonymous array.

my $val = $r->pnotes("MY_HANDLER"); sets $val to be the reference to that
array.

print $val->[0]; dereferences the first spot in the array reference.  The
dereferencing thing is key here.  $val[0] will throw errors about globals not
being declared as arrays or something of that sort.


> Did I forget to compile apache or mod_perl with an option of some sort?
> I can't think of any other explanation. I compiled mod_perl with
> EVERYTHING=1

There is the problem right there.  It needs to be compiled with "EVERYTHING=1
PLUS_THAT_OTHER_LITTLE_THING_NOT_INCLUDED_IN_EVERYTHING=1".

:P

Dennis



Re: cookies

2003-07-16 Thread Dennis Stout
WOOO!

I went to the ttms site, logged in, AND IT AUTHNTICATED ME AND GAVE ME PAGES!!
:D

Aight,  is on me tonight :D

I can't beleive it!  3 weeks on this bloody thing and I got it to finally
Authenticat me =D

Course, I had to disable things in order to get it to give me a cookie to
authenticate with, but a few if's will fix that :D

I'm happy, I'm happy, I'm happy!  I might actually meet deadline :D

w00t!

er...  *ahem*

My thanks to all of you, and special thanks to Mark who helped me the most :D

Dennis



Re: cookies

2003-07-16 Thread Dennis Stout
> Cool dude. Now if you know why $r->pnotes() isn't working under
> apache/modperl .27 you'll make my day!

Got some source code to show me what you're doing with it?

Otherwise I'll just have to cut and paste the mod_perl API book to you ;)
hehehehe.

Dennis




Re: cookies

2003-07-16 Thread Dennis Stout
w00t!

ttms_user: mp2Ti5p1JkhCObm9LKBFGsiAltop8aAWwl6vLLDr/3rtb09MRzZrEg==

Here,

your $cookie = Apache::Cookie->new($state->{r},
-name   => 'Mark',
-value  => 'AWESOME!!!',
-expires=> time + 86400*30*7,
-domain => '.dyndns.org',
-path   => '/',
);

(okay, I made up "your", it sounds better than "my", and sinec this is fake
nayways... heh)

oop, looking at that, I should set the domain to something more sane again,
like stout.dyndns.org.  :P

Dennis

P.S. Does anyone else try to use Outlook Express like vi and get odd error
messages after a days worth of coding?

- Original Message - 
From: "Mark Maunder" <[EMAIL PROTECTED]>
To: "Dennis Stout" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, July 16, 2003 20 33
Subject: Re: cookies


> >From perldoc CGI::Cookie
> # fetch existing cookies
> %cookies = fetch CGI::Cookie;
> $id = $cookies{'ID'}->value;
> #You're doing $cookies->value;
>
> ID == the name that you used when you set the cookie.
>
> On Wed, 2003-07-16 at 21:27, Dennis Stout wrote:
> > *pounds head against brick wall*  why must it work against me???
> >
> > A cookie for anyone who solves this.
> >
> > sub handler {
> > my $r = shift;
> > my $result = undef;
> >
> > eval { $result = inner_handler($r) };
> > return $result unless $@;
> >
> > warn "Uncaught Exception: $@";
> >
> > return SERVER_ERROR;
> > }
> >
> > sub inner_handler {
> > my $r = shift;
> >
> > my %q = ($r->args, $r->content);
> > my %state = (r => $r, q => \%q);
> >
> > $state{title} = '';
> > $state{template} = '';
> > $state{auth_status} = password_boxes(\%state);
> >
> > #   warn "%ENV: \n";
> > #   foreach (keys %ENV) {
> > #   warn "$_ => $ENV{$_}\n";
> > #   }
> > #   my %headers = $r->headers_in;
> > #   warn "Headers: \n";
> > #   foreach (keys %headers) {
> > #   warn "$_: $headers{$_}\n";
> > #   }
> > my $cookie = Apache::Cookie->fetch;
> > warn "z - $cookie->value";
> > validate_auth_cookie(\%state, $cookie);
> >
> > my $function = $r->uri;
> > if (($state{login_user} eq '') and ($function ne '/login.cgi')) {
> > $function = '/login.html';
> > }
> > my $func = $Dispatch{$function} || $Dispatch{DEFAULT};
> >
> > return DECLINED unless $func;
> > return $func->(\%state);
> > }
> >
> > Upon accessing a page (therefore generating lots of warning info in
logs...) I
> > get this in my error log.
> >
> > z - HASH(0x916ea08)->value at /home/httpd/ttms/perl/RequestHandler.pm line
> > 108.
> >
> > (the z is there so I know where at in my code the line in the log file is
> > being generated.  I like z's and a's more than I do
> > "some/long/path/and/filename line 108")
> >
> > I have tried using $cookie as a value in and of itself, I've tried
> > $cookie->{ttms_user}  (the name of hte cookie is ttms_user), I've tried
> > changing $cookie to %cookie and doing a $cookie{ttms_user} ..
> >
> > I might break down, declare this a bug, and use $ENV{HTTP_COOKIE} instead.
> >
> > Any ideas how to fix this to return to me the cookie itself?  Thanks.
> >
> > Dennis
> >
> > - Original Message - 
> > From: "Dennis Stout" <[EMAIL PROTECTED]>
> > To: "Dennis Stout" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> > Sent: Wednesday, July 16, 2003 20 13
> > Subject: Re: cookies
> >
> >
> > > Well I'll be damned.
> > >
> > > My computer at home does the cookie thing perfectly well.  My
workstation at
> > > work does not do cookies.  So my mod_perl creation is working fine as
far as
> > > getting the cookies.
> > >
> > > 
> > > YAY FOR WIN2K DOMAINS AND ADMIN WHO USE HELP DESK TECHS TO PROGRAM
TICKETING
> > > SYSTEMS FOR DSL, DIGITAL TV, AND DOMAINS!
> > > 
> > >
> > > I still have a problem tho.  The cookie string itself i

Re: cookies

2003-07-16 Thread Dennis Stout
*pounds head against brick wall*  why must it work against me???

A cookie for anyone who solves this.

sub handler {
my $r = shift;
my $result = undef;

eval { $result = inner_handler($r) };
return $result unless $@;

warn "Uncaught Exception: $@";

return SERVER_ERROR;
}

sub inner_handler {
my $r = shift;

my %q = ($r->args, $r->content);
my %state = (r => $r, q => \%q);

$state{title} = '';
$state{template} = '';
$state{auth_status} = password_boxes(\%state);

#   warn "%ENV: \n";
#   foreach (keys %ENV) {
#   warn "$_ => $ENV{$_}\n";
#   }
#   my %headers = $r->headers_in;
#   warn "Headers: \n";
#   foreach (keys %headers) {
#   warn "$_: $headers{$_}\n";
#   }
my $cookie = Apache::Cookie->fetch;
warn "z - $cookie->value";
validate_auth_cookie(\%state, $cookie);

my $function = $r->uri;
if (($state{login_user} eq '') and ($function ne '/login.cgi')) {
$function = '/login.html';
}
my $func = $Dispatch{$function} || $Dispatch{DEFAULT};

return DECLINED unless $func;
return $func->(\%state);
}

Upon accessing a page (therefore generating lots of warning info in logs...) I
get this in my error log.

z - HASH(0x916ea08)->value at /home/httpd/ttms/perl/RequestHandler.pm line
108.

(the z is there so I know where at in my code the line in the log file is
being generated.  I like z's and a's more than I do
"some/long/path/and/filename line 108")

I have tried using $cookie as a value in and of itself, I've tried
$cookie->{ttms_user}  (the name of hte cookie is ttms_user), I've tried
changing $cookie to %cookie and doing a $cookie{ttms_user} ..

I might break down, declare this a bug, and use $ENV{HTTP_COOKIE} instead.

Any ideas how to fix this to return to me the cookie itself?  Thanks.

Dennis

- Original Message - 
From: "Dennis Stout" <[EMAIL PROTECTED]>
To: "Dennis Stout" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, July 16, 2003 20 13
Subject: Re: cookies


> Well I'll be damned.
>
> My computer at home does the cookie thing perfectly well.  My workstation at
> work does not do cookies.  So my mod_perl creation is working fine as far as
> getting the cookies.
>
> 
> YAY FOR WIN2K DOMAINS AND ADMIN WHO USE HELP DESK TECHS TO PROGRAM TICKETING
> SYSTEMS FOR DSL, DIGITAL TV, AND DOMAINS!
> 
>
> I still have a problem tho.  The cookie string itself is not being passed
> along.  Instead, I am getting Apache::Cookie=SCALAR(0x9115c24).
>
> I imagine somewhere I need to do something like ->as_string or something.
> blah
>
> Thanks for helping, sorry I didn't spot that the error was infact, in the
> dumbterminal called a win2k box I was using, and not in any actual code
>
> Dennis Stout
>
> - Original Message - 
> From: "Dennis Stout" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, July 16, 2003 13 13
> Subject: cookies
>
>
> > Okay, so technically this isn't really "mod_perl" speific...  but the
cookie
> > is being set with mod_perl and it's a huge mod_perl program being affected
> by
> > this:)
> >
> > I have a cookie, the domain is set to .stout.dyndns.org (with the leading
> .).
> >
> > I set the cookie just fine now (thanks to those helping me on thatr)
> >
> > I had a problem parsing the cookie.  Added some debugging (okay, warn
lines
> up
> > the yingyang) and after cycling through the headers and warning them out
to
> > the errorlog...  I never saw any cookie info.
> >
> > So... If the website is ttms.stout.dyndns.org shouldn't the cookie domain
be
> > .stout.dyndns.org?
> >
> > *sigh*  6 more days to finish this database.  I doubt I'll make it.
> >
> > Dennis
> >
>



Re: cookies

2003-07-16 Thread Dennis Stout
Well I'll be damned.

My computer at home does the cookie thing perfectly well.  My workstation at
work does not do cookies.  So my mod_perl creation is working fine as far as
getting the cookies.


YAY FOR WIN2K DOMAINS AND ADMIN WHO USE HELP DESK TECHS TO PROGRAM TICKETING
SYSTEMS FOR DSL, DIGITAL TV, AND DOMAINS!


I still have a problem tho.  The cookie string itself is not being passed
along.  Instead, I am getting Apache::Cookie=SCALAR(0x9115c24).

I imagine somewhere I need to do something like ->as_string or something.
blah

Thanks for helping, sorry I didn't spot that the error was infact, in the
dumbterminal called a win2k box I was using, and not in any actual code

Dennis Stout

- Original Message - 
From: "Dennis Stout" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 16, 2003 13 13
Subject: cookies


> Okay, so technically this isn't really "mod_perl" speific...  but the cookie
> is being set with mod_perl and it's a huge mod_perl program being affected
by
> this:)
>
> I have a cookie, the domain is set to .stout.dyndns.org (with the leading
.).
>
> I set the cookie just fine now (thanks to those helping me on thatr)
>
> I had a problem parsing the cookie.  Added some debugging (okay, warn lines
up
> the yingyang) and after cycling through the headers and warning them out to
> the errorlog...  I never saw any cookie info.
>
> So... If the website is ttms.stout.dyndns.org shouldn't the cookie domain be
> .stout.dyndns.org?
>
> *sigh*  6 more days to finish this database.  I doubt I'll make it.
>
> Dennis
>



Re: cookies

2003-07-16 Thread Dennis Stout
> > One possibility: Check the -path option. It's supposed to set it to '/'
> > by default if you dont specify it, but it doesn't. I discovered this
> > about 20 minutes ago with a similar bug. So manually specify something
> > like:
> > my $cookie = Apache::Cookie->new($r,
> > -name => 'cookiename',
> > -value => 'someval',
> > -expires => '+7d',
> > -domain => '.dontvisitus.org',
> > -path => '/',
> > );

what I have is this:

sub set_auth_cookie {
my $state = shift;

my $val = build_auth_string($state);
my $c = Apache::Cookie->new($state->{r},
-name   => 'ttms_user',
-value  => $val,
-expires=> time + 86400*30*7,
-domain => $Cookie_Domain,
-path   => '/',
);
$state->{cookie_out} = $c;
}

This is called by various other routines, and $state is a hash = {r => $r, q =
\%q }, where q is a hash = {$r->args, $r->content}.

build_auth_string is another subroutine that makes a 446bit encryption string
thats encoded with mime::base64...

I got a path.  Does that get sent to all webpages ever, or just ones underh te
/ directory?  In otherwords, does hte cookie get sent when accessing
/login.html and not when accessing /admin/view_techs.html?

All the pages on this domain are generated dynamically with a custom built
dispatch table and some awesome subroutinage.  Does that matter?  Maybe I
should read the complete netscape cookie specification :/

I know the cookie is set because it tells me when it expires and when it was
last accessed and what not on the box I browse to it with. (win2k... blah)

And the program itself is running in a Linux environment :)

Time for more warnage in the routines...

If anyone wants sourcecode to look at, email me.  It's much to big to just
post to the list.

Dennis



cookies

2003-07-16 Thread Dennis Stout
Okay, so technically this isn't really "mod_perl" speific...  but the cookie
is being set with mod_perl and it's a huge mod_perl program being affected by
this:)

I have a cookie, the domain is set to .stout.dyndns.org (with the leading .).

I set the cookie just fine now (thanks to those helping me on thatr)

I had a problem parsing the cookie.  Added some debugging (okay, warn lines up
the yingyang) and after cycling through the headers and warning them out to
the errorlog...  I never saw any cookie info.

So... If the website is ttms.stout.dyndns.org shouldn't the cookie domain be
.stout.dyndns.org?

*sigh*  6 more days to finish this database.  I doubt I'll make it.

Dennis



Re: [admin] please trim the quoted text in replies to a minimum

2003-07-14 Thread Dennis Stout
> Of course don't jump to the other exteme edge and overtrim. Use your common
> sense as a guide to how much is enough to keep the sufficient context.

I remember once upon a lot of bluemoons ago, in the days when FidoNet took
place over phone line and 2400baud modems, when client readers would actually
warn you about sending a message that contained more than x percent quoted
material, and would automagically put your cursor underneath the original text
instead of above it!

*sigh* ...  Good old days, 1:17/71 was me :D

Dennis



Re: must I use mod-perl

2003-07-13 Thread Dennis Stout
> > Install it if you have a lot of time. It took me week to config it and
month
> > for rewritting scripts.
>
> If you're using a system that has some sort of packages, then there are
> probably mod_perl packages for it.  Installing mod_perl on a Debian
> GNU/Linux systems takes about as long as the download plus 1 minute.

If you know what you're doing, it doesn't take long either.

I downloaded source for Apache, PHP, and mod_perl and compiled it all and had
it working in about the time it took to download it + compile time + about 5
minutes.

There is no config to mod_perl really.  Either it's there or it isn't.

Dennis



Re: mod_perl 2.0 and cookies

2003-07-11 Thread Dennis Stout
> So I've decided to dive headlong into 2.0. So far I like it but find the
> documentation lacking and there seems to be a lot missing. I tried
> Apache::Cookie with it, no dice. It gave an error to the effect that it
> didn't know what "bootstrap" was (I think that was it). Apache::Cookie
> made inserting cookies in mod_perl 1.0 so easy which in turn made life
> easier for programming. However I have scoured the documentation on how
> to insert a cookie into the header and the only thing I could come up
> with is that you use a filter to do it. Somehow I don't think that this
> is right and I am completely off. Could someone enlighten me as to how
> cookies work in MP2? If I can get past this I can figure out the rest on
> my own and maybe write a little documentation if I can understand it
> enough to do so.


>From what I've figured out through experiementing, tho I'd find out a lot more
by reading source and I'd be a bit more accurate in this... But I think
mod_perl 2 is just simply lacking all together.  I think the docs are lacking
info because the program is lacking hte feature!

Course, this only means I havern't figured out how to use the features, if
they are there.  But, to me, mod_perl x+1 should be backwards compatible with
mod_perl x, if it isn't, then it's broken.  (in my opinion..)

Dennis



Re: select multiple

2003-07-10 Thread Dennis Stout
> >mod_perl and the methods available in the apache request object shuold
beable
> >to replace CGI.pm entirely, especially when you have a highly customized
> >RequestHandler :/
> >
> >Guess I'll see what happens, since I need cookie headers to work AND now
> >multiple values for one param.
>
> Have you looked at Apache::Request?

Reading documentation.. and it looks like $r->param is what I need :)  Thanks!

--- perldoc Apache::Request ---

param

Get or set request parameters (using case-insensitive
keys) by mimicing the OO interface of "CGI::param".
Unlike the CGI.pm version, Apache::Request's param
method is very fast- it's now quicker than even
mod_perl's native Apache->args method.  However,
CGI.pm's "-attr => $val" type arguments are not sup-
ported.

# similar to CGI.pm

my $value = $apr->param('foo');
my @values = $apr->param('foo');
my @params = $apr->param;

# the following differ slightly from CGI.pm

# assigns multiple values to 'foo'
$apr->param('foo' => [qw(one two three)]);

# returns ref to underlying apache table object
my $table = $apr->param; # identical to $apr->parms - see below

parms

Get or set the underlying apache parameter table of
the Apache::Request object.  When invoked without
arguments, "parms" returns a reference to an
Apache::Table object that is tied to the
Apache::Request object's parameter table.  If called
with an Apache::Table reference as as argument, the
Apache::Request object's parameter table is replaced
by the argument's table.

# $apache_table references an Apache::Table object
$apr->parms($apache_table); # sets $apr's parameter table

# returns ref to Apache::Table object provided by $apache_table
my $table = $apr->parms;




Re: select multiple

2003-07-10 Thread Dennis Stout
ARHG.

I want to stay as far away from use CGI; as possible =/

*sigh*

mod_perl and the methods available in the apache request object shuold beable
to replace CGI.pm entirely, especially when you have a highly customized
RequestHandler :/

Guess I'll see what happens, since I need cookie headers to work AND now
multiple values for one param.

S.T.O.U.T. = Synthetic Technician Optimized for Ultimate Troublshooting
- Original Message - 
From: "Chris Faust" <[EMAIL PROTECTED]>
To: "Dennis Stout" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, July 10, 2003 16 30
Subject: Re: select multiple


> CGI.pm does the trick for me, the multi values are seperated by \0
>
> < select name="yadda" multi>
> yadda1
> yadda2
> yadda3
> 
> 
>
> my $CGI = new CGI();
>  %form_data = $CGI->Vars;
>
> @options = split("\0",$form_data{'yadda'});
>
> $options[0] = yadda1, $options[1] = yadda2  etc .
>
> Not usable live code obviously, but you should see the idea...
>
> -Chris
> - Original Message - 
> From: "Dennis Stout" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
> <[EMAIL PROTECTED]>
> Sent: Thursday, July 10, 2003 4:52 PM
> Subject: Re: select multiple
>
>
> >
> > Interesting.
> >
> > So in mod_perl, I would use $r->args{__what__} to get to it?  Heh.
> >
> > I'll email the mod_perl list..
> >
> > Dennis
> >
>
>



Fw: select multiple

2003-07-10 Thread Dennis Stout
This is the original email I sent out, regarding my multiple selects...

S.T.O.U.T. = Synthetic Technician Optimized for Ultimate Troublshooting
- Original Message - 
From: "Dennis Stout" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 10, 2003 11 39
Subject: select multiple


> Beginners-CGI;
>
> If I have a form with a lot of values (such as Tech ID, Tech Name, Tech
> Queues..) and one of the fields is a select multiple, with a varied amount
of
> options selected, how are those values sent to the cgi script?
>
> Is it something like ?queue=lvl1,lvl2,admin,sysad&foo=bar or what?
>
> Thanks
>
> Dennis
>
>
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>



Re: select multiple

2003-07-10 Thread Dennis Stout
> Because there is no way to create a delimiter that the potential data
doesn't contain, the browser doesn't have the option to choose an arbitrary
delimiter like a comma, or the like.  So (though I can't speak for all
browsers most will do the same) each value is passed with the same key, so
your string ends up like:
>
> ?queue=lvl1&queue=lvl2&queue=admin&queue=sysad&foo=bar
>
> This punts the problem to the server side (or whatever does the query string
parsing) so there are multiple ways to handle it, build a complex data
structure that stores an array reference for any multi-valued keys, store the
keys with some known delimiter (aka cgi-lib.pl used to use the null character
\0).  So it depends on your request parser, some provide multiple manners (I
think the standard CGI does). Have a look at the respective docs for how your
parser handles it, unless you are writing a parser...but then why do that with
so many good freely available ones?

Interesting.

So in mod_perl, I would use $r->args{__what__} to get to it?  Heh.

I'll email the mod_perl list..

Dennis



Re: Apache config problem .. please help

2003-07-03 Thread Dennis Stout
> I made a simple mod_perl change to the config and when restarting Apache 
> I got this error:
> (98)Address already in use: make_sock: could not bind to address 
> 0.0.0.0:2250
> no listening sockets available, shutting down
> /usr/local/apache/bin/apachectl: line 87: 16512 Segmentation fault  
> $HTTPD $ARGV
> 
> I then backed out the change and retried, got the same error.


killall httpd

then try it again :)

Dennis



Re: If (!$one_thing) {$other;}

2003-07-02 Thread Dennis Stout
> I think when I'm done and get this roled out, I'll work on making something
> very similar but completely database driven.  All the functions in the
> dispatch table will be brought in through a single SQL statement called in
an
> eval context.

This also means I can write a small subroutine to eval a form that's been
posted, and given the authentication passes, add code to the thing while it's
running, AND save the code to the DB so it'll be around for reboots.

Wouldn't that just be awesome?

A totally dynamic web driven database that can be completely reconfigured on
the fly.

I wonder if using  sections in the httpd.conf file, if a guy
could put the entire RequestHandler in a database as well  heh

I spose that might take some work, probably with vi and gcc, on apache source
files.

Dennis



Re: If (!$one_thing) {$other;}

2003-07-02 Thread Dennis Stout
> On Wed, 2003-07-02 at 21:24, Dennis Stout wrote:
> > > Okay, I put in some code to take the generated headers and enter them
into
> > the
> > > body of the page.  This had an odd effect.
> >
> > I bet I have a login problem.

Whoops.  logic problem.  YAY, maybe the core of all my problems is vast
amounts of typo's caused by carpal tunnel =/

> You lost me.  You were having problems with headers not being sent,
> right?  That probably means that either $r is not the Apache object you
> think it is, or your program is not actually calling send_http_header.
> Have you done enough debugging to rule both of those things out?

$r is indeed the correct Apache object.

Where I believe hte problem exists is in the PerlSendHeaders dealybob John
mentioned in a private email to me...

I'm currently taking a break from that section of hte program and have
disabled it with a series of #'s for now...  I'm going to work more directly
with the SQL interface I'm making.  I think I'll junk what I have and write a
new one from scratch

I think when I'm done and get this roled out, I'll work on making something
very similar but completely database driven.  All the functions in the
dispatch table will be brought in through a single SQL statement called in an
eval context.

I might work on that once I have sufficiently pounded my brain with enough
beer.

m, 4 day weekend

Dennis



Re: If (!$one_thing) {$other;}

2003-07-02 Thread Dennis Stout
> > Not likely.  Your syntax looks okay to me.  It probably isn't being
> > called for some reason, or else $r is not what you think it is.  Throw
> > in some debug statements and find out what's actually happening there.
>
>
> Okay, I put in some code to take the generated headers and enter them into
the
> body of the page.  This had an odd effect.

I bet I have a login problem.

User tries to do whatever.  Gets asked to login.  Fills in login form, hits
submit, but posting is a request in and of itself.  So the request for the cgi
is made, user doesn;'t have a valid cookie yet, gets redirected to the login
page ...

Dennis



Re: If (!$one_thing) {$other;}

2003-07-02 Thread Dennis Stout
> Not likely.  Your syntax looks okay to me.  It probably isn't being
> called for some reason, or else $r is not what you think it is.  Throw
> in some debug statements and find out what's actually happening there.


Okay, I put in some code to take the generated headers and enter them into the
body of the page.  This had an odd effect.

I got headers at hte TOP of hte page, before the  tags, and here is what
it reads:

HTTP/1.1 200 OK
Date: Wed, 02 Jul 2003 22:33:52 GMT
Server: Apache/1.3.27 (Unix) mod_perl/1.27
Connection: close
Content-Type: text/html
Set-Cookie:

So the cookie it's trying to set is wrong, but I can work on that later.  Why
is it not sending it normally?  More importantly, why am I seeing this when I
view source?  I'm not supposed to ever see header info.

Dennis



if (!$one_thing) { $other; }

2003-07-02 Thread Dennis Stout
I suppose the subroutine that makes the call to it would help too.

I'll spare you all the dispatch routine as it's quite lengthy, but basically
the DispatchTbl::* generates webpages dynamically depending on the uri
caught by RequestHandler::handler();.

sub post_login_form {
my $state = shift;
my %args = $state->{q};
$state->{template} = 'generic.tmpl';
$state->{title} = 'TTMS Login';

my $checkpass = get_password($state);

if ($checkpass eq $state->{q}{login_pass}) {
$state->{login_user} = $state->{q}{login_user};
$state->{login_pass} = $state->{q}{login_pass};
$state->{auth_status} = "Logged in as $state->{login_user}";
set_auth_cookie($state);

$args{body} = "Good Morning, Dave.";
} else {
set_logout_cookie($state);

$args{body} = "I'm afraid I can't let you do that, Dave.";
}

return output_html($state, %args);
}




If (!$one_thing) {$other;}

2003-07-02 Thread Dennis Stout
This is irking me.

$state preserves information about the request and so on.  Now,
$r->whatever_method works just fine.. EXCEPT for sending headers.  When I
visit my site, I get my nifty login page, and that is all.  Always the login
page.

I telnetted into the thing to see what kinds of cookie strings I was getting
back and... NO HEADERS!  No Content-type: 's or nothing.

$r->send_http_header; must be broken, eh?  How to fix?? =P

I'll spare all of your eyes by not sending complete source, but here's the
basic idea.


#!/usr/bin/perl

package RequestHandler;
use strict;

# snipped out a lot of use vars qw();'s and $val = blah.

sub handler {
my $r = shift;
my $result = undef;

eval { $result = inner_handler($r) };
return $result unless $@;

warn "Uncaught Exception: $@";

return SERVER_ERROR;
}

sub inner_handler {
my $r = shift;

my %q = ($r->args, $r->content);
my %state = (r => $r, q => \%q);

$state{login_user} = '';
$state{login_pass} = '';
$state{title} = '';
$state{template} = '';
$state{auth_status} = password_boxes(\%state);

validate_auth_cookie(\%state);

my $function = $r->uri;
$function = '/login.html' if $state{login_user} eq '';
my $func = $Dispatch{$function} || $Dispatch{DEFAULT};

return $func->(\%state);
}

sub output_html {
my $state = shift;
my %args = @_;
my $title = $state->{title};
my $r = $state->{r};

$r->status(200);

my $template = HTML::Template->new(
filename=>
"$Template_Dir/$state->{template}",
die_on_bad_params   => 0,
);

$template->param(TITLE => $title);
eval { foreach (keys %args) {
$template->param($_ => $args{$_});
}};
$template->param(ERRORS => $@) if $@;

$r->header_out( 'Set-Cookie' => $state->{cookie_out} ) if
$state->{cookie_out};
$r->send_http_header('text/html');
print $template->output();
}

sub get_password {
my $state = shift;

my $row = $Sql->select_hashref('DECODE(PWORD,\'blah\')', 'techs',
"TECH=\"$state->{
q}->{login_user}\"");
return $row->{"DECODE(PWORD,'blah')"};
}

sub build_auth_string {
my $state = shift;
my $ip = shift || $ENV{REMOTE_ADDR};
my $time = shift || time;

my $login = $state->{login_user};
my $password = $state->{login_pass};
my $val = join "::", $login, $ip, $password, $time;

# Iterate thru by 8 byte hunks.
# with the added 8 spaces, do not do the last hunk
# which will be all spaces
my $blown;
my $pos;
for ( $pos = 0;  (($pos + 8) < length($val) ) ; $pos+=8 ) {
$blown .= $cipher->encrypt(substr($val, $pos, 8));
# encrypt this without temp vars
}

my $enc  = encode_base64($blown,"");

$enc;
}

sub parse_auth_string {
my $state  = shift;
my $cookie = shift;

return unless $cookie;
return if $cookie =~ /logged_out/;

my $unenc= decode_base64($cookie);
my $unblown;

# start at 8, take 8 bytes at a time
# $unenc should be exactly a multiple of 8 bytes.

my $pos;
for ( $pos = 0; $posdecrypt(substr($unenc, $pos, 8));
}
my ($login, $ip, $password, $time)=split ( /::/, $unblown, 4);
}

sub get_auth_cookie {
my $state=shift;
my $cookie = TTMSCGI->parse_cookie($ENV{HTTP_COOKIE})->{ttms_user};
my($login, $ip, $password, $time) = parse_auth_string($state,
$cookie);
($login, $ip, $password, $time);
}

sub set_auth_cookie {
my $state = shift;

my $val = build_auth_string($state);
my $c = TTMSCGI->build_cookie(
name=> 'ttms_user',
value   => $val,
expires => time + 86400*30*7,
domain  => $Cookie_Domain,
path=> '/',
);
$state->{cookie_out} = $c;
}

sub build_logout_cookie {
TTMSCGI->build_cookie(
name   => 'ttms_user',
value  => "logged_out",
expires=> time - 86400,
domain => $Cookie_Domain,
path   => '/'
);
}

sub set_logout_cookie {
my $state = shift;
$state->{cookie_out} = build_logout_cookie($state);
}

sub validate_auth_cookie {
my $state = shift;
my ($login, $ip, $pass, $time) = get_auth_cookie($state);
return unless $login && $pass;

my $checkpass = get_password($state);
if ($pass eq $checkpass) {
$state->{login_user} = $login;
$state->{login_pass} = $pass;
$state->{auth_status} = "Logged in as $state->{login_user}";
return;
}
return;
}



Re: Please help newbie with Module problem.

2003-07-02 Thread Dennis Stout
You can send me- er, the "Help Dennis Move out of Alaska" charity money by
giving your credit card number to

*grin*

Thank you, I'm sure Randy would agree when I say it's nice to be appreciated
:)

Dennis Stout
S.T.O.U.T. = Synthetic Technician Optimized for Ultimate Troublshooting
- Original Message - 
From: "Matt Corbett" <[EMAIL PROTECTED]>
To: "'Dennis Stout'" <[EMAIL PROTECTED]>; "'Randy Kobes'"
<[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, July 02, 2003 11 55
Subject: RE: Please help newbie with Module problem.


> Dennis and Randy and others on the list that gave advice,
> Thank you so much for both your help. This has sorted out the problem. I
> copied the *.pl files to the c:\apache\perl directory and before I made
> the change to the httpd.conf file I tried it tham again and it's
> perfect. If either or both of you can recommend a good charity I will
> make a small donation for your time. Again thanks
>
> Matt
>
>
> -Original Message-
> From: Dennis Stout [mailto:[EMAIL PROTECTED]
> Sent: 02 July 2003 19:28
> To: Matt Corbett
> Subject: Re: Please help newbie with Module problem.
>
>
> > I don't have a PerlHandler set in my httpd.conf.
> >
> > How should I set this.
>
> Edit whatever form of an httpd.conf file that Apache has under Win32
> (should be hte same, location I don't know).
>
> mv the script out of the cgi-bin and into somewhere else, like
> C:/Apache/perl
>
> Let's say the name is RequestHandler.pm
>
> In httpd, add this line:
>
> 
> 
> SetHandler perl-script
> PerlHandler RequestHandler
> 
> 
>
> Restart Apache, and any access to blah.yourdomain.whatever/ should get
> trapped in there.
>
> You may need to add the other standard apache directives to that, like
> ServerName blah.yourdomain.whatever and so on, but probably not.
>
> >
> > I think we are so close I can almost feel it.
>
> Yes, we are.  The code I sent you is hte core of hte project I'm
> currently programming, which includes an entire dispatch table.
>
> Now if only I could get it to grab the right friggin string from a SQL
> server to authenticate >:|
>
> >
> >
> > -Original Message-
> > From: Dennis Stout [mailto:[EMAIL PROTECTED]
> > Sent: 02 July 2003 18:57
> > To: Matt Corbett
> > Subject: Re: Please help newbie with Module problem.
> >
> >
> > Hrm.
> >
> > Off the top of my head, I've not a clue.
> >
> > Did you setup Apache with a
> >
> > PerlHandler /path/to/file_with_script.perl
> >
> > directive?
> >
> > S.T.O.U.T. = Synthetic Technician Optimized for Ultimate
> > Troublshooting
> > - Original Message - 
> > From: "Matt Corbett" <[EMAIL PROTECTED]>
> > To: "'Dennis Stout'" <[EMAIL PROTECTED]>
> > Sent: Wednesday, July 02, 2003 09 49
> > Subject: RE: Please help newbie with Module problem.
> >
> >
> > >
> > >
> > > Thanks Dennis, It's now giving me "Premature end of script
> > > headers:". Can you help me again.
> > >
> > > Matt
> > > -Original Message-
> > > From: Dennis Stout [mailto:[EMAIL PROTECTED]
> > > Sent: 02 July 2003 17:46
> > > To: Matt Corbett; [EMAIL PROTECTED]
> > > Subject: Re: Please help newbie with Module problem.
> > >
> > >
> > > > this, however the line   $r->content-type('text/html'); seems to
> be
> > > > giving my compiler some problems. You could'nt just give me a hint
> > > > on
> > >
> > > My mistake, shift key didn't get pressed hard enough =P
> > >
> > > $r->content_type('text/html');
> > >
> > > Dennis
> > >
> > >
> >
>
>



Re: Please help newbie with Module problem.

2003-07-02 Thread Dennis Stout
> this, however the line   $r->content-type('text/html'); seems to be
> giving my compiler some problems. You could'nt just give me a hint on

My mistake, shift key didn't get pressed hard enough =P

$r->content_type('text/html');

Dennis



Re: Please help newbie with Module problem.

2003-07-02 Thread Dennis Stout
> however when I run the following code
>
> #!c:/perl/bin/perl -w
>  use Apache ();
> use Apache::Request ();
> use CGI::Carp qw(fatalsToBrowser);
> my $r = Apache::Request->new(shift);
> # my $apr = Apache::Request->new($r);
> print  "Content-type:text/html\n\n";
> print "Hello, World...\n";
> print $r;
> print @INC;
>
> I receive the message
> Can't locate object method "new" via package "Apache::Request" (perhaps
> you forgot to load "Apache::Request"?) at c:\apache\cgi-bin\ap2.pl line
> 6.

mod_perl sends $r to the handler() subroutine by default.  That is, if you're
using it in a PerlHandler context, like you should with anything that uses
Apache::Request.

Therefore, th ollowing should work for you.

#!/usr/bin/perl -w
use strict;

use Apache::Constants qw(:common);

sub handler {
  my $r = shift;
  my $result = undef;

  eval { $result = inner_handler($r) };
  return $result unless $@;

 warn "Uncaught Exception: $@";

  return SERVER_ERROR;
}

sub inner_handler {
  my $r = shift;

  $r->content-type('text/html');
  $r->status(200);

  my $html = "Hello World!You
Tried To Access URI: ". $r->uri ."";

 $r->send_http_header;
  print $html;
}



Re: How tell what version of mod_perl is installed?

2003-06-06 Thread Dennis G. Allard
On Thu, 2003-06-05 at 14:13, Ged Haywood wrote:
> ...
> If the question to which you refer is the one in the subject line,
> then one answer is look in the error log.  Apache tells you when it
> starts.  It's generally about the first thing it says.  Your error log
> is defined in your Apache configuration file (probably httpd.conf) in
> a line that starts
> 
> ErrorLog

I know about that file.

However, in my case (~stock Red Hat 8.0 Apache 2.0.40), my error log
(/var/log/httpd/error_log) shows:

[Thu Jun 05 02:54:44 2003] [notice] Apache/2.0.40 (Red Hat
Linux) configured -- resuming normal operations

I spent some time scrounging the Apache Web site and can't find any
documentation on how to show what DSOs (Dynamic Shared Objects, aka
Apache modules) are loaded.  Google groups shows some other people
having this question.

For Apache 1.0, one can inspect the httpd.conf for LoadModule
directives.  For Apache 2.0 in Red Hat, one can do that but, also, for
modules that are packaged as separate RPMs, one must examine
/etc/httpd/conf.d/*.  Such techniques do not constitute a documented API
for finding that information, but are better than nothing.  See:

  http://oceanpark.com/notes/howto_redhat8-apache2-mod_perl.html


You can find out what modules are statically linked with your Apache
image by doing, for example:

[EMAIL PROTECTED] httpd]# httpd -l
Compiled in modules:
  core.c
  prefork.c
  http_core.c
  mod_so.c

apachetcl -l will also do that.

But I don't have mod_perl statically linked.  It is loaded by my
/etc/httpd/conf.d/perl.conf file.  


> You could also take a look at
> 
> http://perl.apache.org/docs/2.0/user/intro/start_fast.html
> 
> which has an example of the output in the error log from a server when
> it's started.

But no documentation as to why or how that line is generated nor what it
means.


> 
> If your question isn't the one in the subject line, please accept my
> apologies - I haven't been following this thread closely.  Feel free
> to ask it again if it hasn't yet been answered.

It was in some earlier responses:

[EMAIL PROTECTED] root]# perl -Mmod_perl -le 'print mod_perl->VERSION'
1.9905


> There's more FM to R if you work with Apache/mod_perl 1.x - if you're
> going to be doing a lot of work for a commercial application and you
> don't want to be involved in the mod_perl 2.x development, and you're
> going to want lots more people around to hold your hand, then that's
> what I'd recommend.  There are good books too.  Buy them.  Read them.
> You're an exceptional individual if you can absorb it all the first
> time through, so read them again.

One of the best books I've ever read in my tenure doing software
development is the excellent one by Lincoln Stein and Doug MacEachern,
Writing Apache Modules with Perl and C.  First thing I read back in 1999
when I started using mod_perl.  I eagerly await an update that covers
Apache 2.0 and mod_perl 2.0.

> 
> Oh, heck.  More advice.
> 73,
> Ged.


All well founded advice is appreciated.



Cheers,
Dennis


-- 
Dennis G. Allard   telephone: 1.310.399.4740
Ocean Park Software http://oceanpark.com





Re: How tell what version of mod_perl is installed?

2003-06-06 Thread Dennis G. Allard
On Thu, 2003-06-05 at 13:53, Thomas Klausner wrote:

> Sorry, typo: it should say -Mmod_perl instead of -Mmod-perl, i.e.:
> 
> % perl -Mmod_perl -le 'print mod_perl->VERSION'

THANKS! (I should have caught that one myself, for crying out loud).

For the sake of completeness:

[EMAIL PROTECTED] root]# uname -a
Linux oceanpark.com 2.4.20-18.8 #1 Thu May 29 07:20:39 EDT 2003 i686 athlon i386 
GNU/Linux

[EMAIL PROTECTED] root]# cat /etc/issue
Red Hat Linux release 8.0 (Psyche)
Kernel \r on an \m

[EMAIL PROTECTED] root]# perl -Mmod_perl -le 'print mod_perl->VERSION'
1.9905



Cheers,
Dennis


-- 
Dennis G. Allard   telephone: 1.310.399.4740
Ocean Park Software http://oceanpark.com





Re: How tell what version of mod_perl is installed?

2003-06-06 Thread Dennis G. Allard
On Thu, 2003-06-05 at 13:37, Thomas Klausner wrote:
> Hi!
> 
> On Thu, Jun 05, 2003 at 01:37:59PM -0700, Dennis G. Allard wrote:
[In reply to Stas]
> > Please note, though, one of my goals in life is to rely on my software
> > providers to do the work of providing me with a stable, tested,
> > updatable OS and associated tools.  If I download 'out of band' updates,
> > then I can no longer rely on Red Hat's network update tool, for example.
> > 
> > With all due respect for your fine work, which is awesome, there are
> > application developers such as myself out there who simply don't have
> > time to track the bleeding edge except when absolutely forced to do so
> > (which sometimes does happen).
> 
> The latest Red Hat comes with Apache 2 (because Apache 2 is quite stable).
> Unfortunatly mod_perl 2.0 is /not/ that finished (Sorry Stas..). But because
> Red Hat wants to provide mod_perl to its Users, they included the Beta
> Version in their distro.

And once mod_perl 2.0 become stable, Red Hat will ship it, and those
having my philosophy will begin developing with it!

> 
> So blame them ...

No blame needed.  Everyone is doing a good job as fast as they can.


> 
> > > /home/stas> perl-blead   -Mmod_perl -le 'print mod_perl->VERSION'
> > > 1.2701
> > > /home/stas> perl-blead -MApache2 -Mmod_perl -le 'print mod_perl->VERSION'
> > > 1.9910
> > 
> > Bummer, I don't have perl-blead and there are only 17 references to it
> > in the entire history of Dejanews, none that seem to point to a
> > download...
> 
> You don't need perl-blead (which is probably Stas' install of the latest
> unstable Perl version)
> 
> This will do the same job:
> % perl -Mmod-perl -le 'print mod_perl->VERSION'

Bummmer, that does not work either for me on Red Hat 8.0:

[EMAIL PROTECTED] httpd]# perl -Mmod-perl -le 'print mod_perl->VERSION'
Can't locate mod.pm in @INC (@INC contains:
/usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .).
BEGIN failed--compilation aborted.


I'm new to this list.  Thanks for everyone's advice.


-- 
Dennis G. Allard   telephone: 1.310.399.4740
Ocean Park Software http://oceanpark.com





Re: How tell what version of mod_perl is installed?

2003-06-06 Thread Dennis G. Allard
On Thu, 2003-06-05 at 13:08, Perrin Harkins wrote:
> On Thu, 2003-06-05 at 15:55, Dennis G. Allard wrote:
> > MySQL ShmySQL.  A database that didn't have transactions until last year
> > and still has no stored procedures
> 
> Uh, we're talking about session data here, right?  Basically ...

My point about MySQL was a general comment for why I did not use it (in
the past), not just about sessions.

Your suggestions for tools to implement sessions are all sound.

Cheers,
Dennis

> -- 
> Dennis G. Allard <[EMAIL PROTECTED]>
> http://oceanpark.com



Re: How tell what version of mod_perl is installed?

2003-06-06 Thread Dennis G. Allard
Hmmm.  No one has actually answered the question, although I am getting
all kinds of advice...  (-; ...

On Thu, 2003-06-05 at 01:42, Stas Bekman wrote:
> Thomas Klausner wrote:
> > Hi!
> > 
> > On Don, Jun 05, 2003 at 12:35:37 -0700, Dennis G. Allard wrote:
> > 
> > 
> >>I am running Red Hat 8.0, Apache/2.0.40.
> > 
> > 
> > AFAIK, mod_perl 1.x won't run with Apache 2.0, so I'm quite sure you're
> > running mod_perl 2 (which comes shipped with Red Hat 8)
> 
> But Dennis, you don't want the version that comes with RH8, it's 1 year old! 
> get 1.99_09 from here:
> http://perl.apache.org/download/index.html

Thanks for that information, Stas.

I'll take that to mean 'yes', I do have mod_perl 2.0 (although, per my
previous post of my `strings /usr/lib/httpd/modules/mod_perl.so` output,
my version is (I guess) 1.99_05-dev, which, you have to admit, does not
look like '2.0'.

Please note, though, one of my goals in life is to rely on my software
providers to do the work of providing me with a stable, tested,
updatable OS and associated tools.  If I download 'out of band' updates,
then I can no longer rely on Red Hat's network update tool, for example.

With all due respect for your fine work, which is awesome, there are
application developers such as myself out there who simply don't have
time to track the bleeding edge except when absolutely forced to do so
(which sometimes does happen).
  
My heuristic is that I intentionally stay behind the curve.  I don't use
Oracle 9 yet, for example.

My current need for mod_perl 2.0 is not critical, so I will give it
another year or so before I dig in and make the (substantial) effort of
coverting entirely to it.


> 
> to check the version you can do:
> 
> /home/stas> perl-blead   -Mmod_perl -le 'print mod_perl->VERSION'
> 1.2701
> /home/stas> perl-blead -MApache2 -Mmod_perl -le 'print mod_perl->VERSION'
> 1.9910
> 
> As you can see, I have both. 1.9910 is mod_perl-2.0-tobe (but currently only 
> 1.9909 is available, 1.9910 is a cvs version).

Bummer, I don't have perl-blead and there are only 17 references to it
in the entire history of Dejanews, none that seem to point to a
download...

[EMAIL PROTECTED] httpd]# perl-blead -MApache2 -Mmod_perl -le 'print
mod_perl->VERSION'
bash: perl-blead: command not found
[EMAIL PROTECTED] httpd]# 
[EMAIL PROTECTED] httpd]# whereis perl-blead
perl-blead:
[EMAIL PROTECTED] httpd]# locate perl-blead


I could take time to find/download perl-blead, but hey, gotta go earn
some money!  (-;  Outta here for now.

> 
> 
> __
> Stas BekmanJAm_pH --> Just Another mod_perl Hacker
> http://stason.org/ mod_perl Guide ---> http://perl.apache.org
> mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com


-- 
Dennis G. Allard   telephone: 1.310.399.4740
Ocean Park Software http://oceanpark.com





Re: How tell what version of mod_perl is installed?

2003-06-06 Thread Dennis G. Allard
On Thu, 2003-06-05 at 11:02, Perrin Harkins wrote:
> On Thu, 2003-06-05 at 03:35, Dennis G. Allard wrote:
> > (BTW, my more general goal is to have shared memory across multiple
> > Apache threads as part of implementing sessions so that I can avoid
> > doing a database write at every HTTP request just to save session IDs.)
> 
> Hmmm, save session IDs?  Why aren't you just putting those in a cookie
> or in the URLs?
> 
> If you meant to say session data rather than IDs, there are several good

Correct, I meant session data.

> ways to do this, and IPC::ShareLite isn't one of them.  It's too slow. 
> If this is for a single machine, try either IPC::MM or MLDBM::Sync.  If
> it's for a cluster, it's pretty hard to beat MySQL.
>
> - Perrin

MySQL ShmySQL.  A database that didn't have transactions until last year
and still has no stored procedures

Actually, I have nothing against MySQL.  I happen to prefer Postgres,
being a Berkeley kind of guy, Oracle due to its many strengths, and ap5
(http://ap5.com) for small applications since I prefer relational
calculus and Lisp to relational algebra and SQL, the COBOL of the 21st
Century.  Flame off.

I will politely decline a more detailed debate on these subjects, which
are outside the scope of this mailing list.

BTW, I wanted to use Apache::Session or CGI::Session but had some
problems with each, possibly related to my newness with Apache
2/mod_perl 2/compat/whatever.  So, I've decide to implement my own
sessions for now, just for the hell of it, while I wait for Apache 2
dust to settle or land a project where I am forced to decipher the
possibilities better.



-- 
Dennis G. Allard <[EMAIL PROTECTED]>
http://oceanpark.com



How tell what version of mod_perl is installed?

2003-06-05 Thread Dennis G. Allard
I ran into some problems trying to get a Perl CGI script to make use of
IPC::Sharelite, so I want to understand the Apache and mod_perl
threading model in order to be able to use shared memory across multiple
Apache threads.

For starters, I better make sure I learn more about mod_perl 2.0, as in,
do I even have it on my system yet!

I am running Red Hat 8.0, Apache/2.0.40.

How do I tell if mod_perl 1.0 or mod_perl 2.0 is installed (or, at
least, that the .so is the .so for mod_perl 2.0)?

Some facts about my system that may help answer this question are
provided below...


[EMAIL PROTECTED] root]# httpd -V
Server version: Apache/2.0.40
Server built:   May 22 2003 05:19:58
Server's Module Magic Number: 20020628:0
Architecture:   32-bit
Server compiled with
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D HTTPD_ROOT="/etc/httpd"
 -D SUEXEC_BIN="/usr/sbin/suexec"
 -D DEFAULT_PIDLOG="logs/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="logs/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"



[EMAIL PROTECTED] root]# strings /usr/lib/httpd/modules/mod_perl.so
...
mod_perl/1.99_05-dev
...


[EMAIL PROTECTED] root]# cat /etc/httpd/conf.d/perl.conf
LoadModule perl_module modules/mod_perl.so

# This will allow execution of mod_perl to compile your scripts to
# subroutines which it will execute directly, avoiding the costly
# compile process for most requests.
#
#Alias /perl /var/www/perl
#
#
#dga- Here's my best guess at config so far:
#
Alias /perl /home/httpd/perl

  SetHandler perl-script
  PerlHandler ModPerl::Registry::handler
  PerlOptions +ParseHeaders
  Options +ExecCGI

[EMAIL PROTECTED] root]# 



[EMAIL PROTECTED] root]# cat /home/httpd/perl/startup.pl
#!/usr/bin/perl

use Apache::compat ();
1;



Thanks for any tips and help anyone might provide.

(BTW, my more general goal is to have shared memory across multiple
Apache threads as part of implementing sessions so that I can avoid
doing a database write at every HTTP request just to save session IDs.)

Cheers,
Dennis


-- 
Dennis G. Allard   telephone: 1.310.399.4740
Ocean Park Software http://oceanpark.com





[patch] Apache::DBI can't be made to always ping

2003-06-03 Thread dennis . ingram
We've been having some problems with our Oracle 8.1.5 database on AIX, which has
highlighted what looks like a problem with Apache::DBI. To cut a very long story
short, due to an Oracle problem database handles are becoming invalid reasonably
frequently. In this case, we would expect Apache::DBI to ping on each connect
request as the ping timeout is set to zero. However, it has been returning dead
handles. Enabling the trace feature showed that it did not always ping, the
problem being that if there is a request for a handle within one second, even if
the ping timeout is zero it will not ping.

A patch for this follows, it is simply a matter of changing the time test from a
> to a >= in line 103 of version 0.88:

my $needping = (($PingTimeOut{$dsn} == 0 or $PingTimeOut{$dsn} > 0) and $now -
$LastPingTime{$dsn} >= PingTimeOut{$dsn}) ? 1 : 0;

So far as I can tell this still applies to the most recent version. I would like
to ask the maintainer of this module if this patch or equivalent fix could be
included in the next release of the module.

Apologies if this message is posted to the wrong place, I think I got it
right...

Regards
Dennis Ingram




**
This email with any attachments is confidential and may be
subject to legal privilege.  If it is not intended for you please
reply immediately, destroy it and do not copy, disclose or use
it in any way.
**



libperl.so: undefined symbol: PL_dowarn

2002-11-22 Thread Dennis Kruyt



Hi,
 
I have compiled mod_perl en installed it without 
any errors but wen i try to start Apache witch mod_perl then i get the following 
error:
 
Starting Apache 1.3.27:Syntax error on line 274 
of /opt/apache-1.3.27/conf/httpd.conf:Cannot load 
/opt/apache/libexec/libperl.so into server: /opt/apache/libexec/libperl.so: 
undefined symbol: PL_dowarn/opt/apache/bin/apachectl startssl: httpd could 
not be started
I use Apache 1.3.27 from source on a Debian 3 box, 
with the standard perl (5.6.1-7) that came with debian.
 
Here is the output from perl Makefile.PL 
:
 
 
packages:/opt/pkgs/src/mod_perl-1.27# perl 
Makefile.PL USE_APXS=1 WITH_APXS=/opt/apache/bin/apxs  EVERYTHING=1Will 
configure via APXS 
(apxs=/opt/zx/apache/bin/apxs)PerlDispatchHandler.enabledPerlChildInitHandlerenabledPerlChildExitHandlerenabledPerlPostReadRequestHandler..enabledPerlTransHandlerenabledPerlHeaderParserHandler.enabledPerlAccessHandler...enabledPerlAuthenHandler...enabledPerlAuthzHandlerenabledPerlTypeHandler.enabledPerlFixupHandlerenabledPerlHandler.enabledPerlLogHandler..enabledPerlInitHandler.enabledPerlCleanupHandler..enabledPerlRestartHandler..enabledPerlStackedHandlers.enabledPerlMethodHandlers..enabledPerlDirectiveHandlers...enabledPerlTableApienabledPerlLogApi..enabledPerlUriApi..enabledPerlUtilApi.enabledPerlFileApi.enabledPerlConnectionApi...enabledPerlServerApi...enabledPerlSectionsenabledPerlSSI.enabledWill 
run tests as User: 'nobody' Group: 'root'Configuring mod_perl for building 
via APXS + Creating a local mod_perl source tree + Setting up 
mod_perl build environment (Makefile) + id: mod_perl/1.27 + 
id: Perl/v5.6.1 (linux) [perl]Note (probably harmless): No library found for 
-lperlNow please type 'make' to build libperl.soChecking CGI.pm 
VERSION..okChecking for LWP::UserAgent..okChecking for 
HTML::HeadParserokChecking if your kit is complete...Looks 
goodWriting Makefile for ApacheWriting Makefile for 
Apache::ConnectionWriting Makefile for Apache::ConstantsWriting Makefile 
for Apache::FileWriting Makefile for Apache::LeakWriting Makefile for 
Apache::LogWriting Makefile for Apache::ModuleConfigWriting Makefile for 
Apache::PerlRunXSWriting Makefile for Apache::ServerWriting Makefile for 
Apache::SymbolWriting Makefile for Apache::TableWriting Makefile for 
Apache::URIWriting Makefile for Apache::UtilWriting Makefile for 
mod_perlpackages:/opt/pkgs/src/mod_perl-1.27#
What is the problem that i get this error 
libperl.so: undefined symbol: PL_dowarn?
 
Dennis,


Re: libperl.so: undefined symbol: PL_dowarn

2002-11-22 Thread Dennis
I added the following debian packages: libperl-dev libperl5.6
and recompiled it and the problem was gone.

Dennis,

- Original Message -
From: "Stas Bekman" <[EMAIL PROTECTED]>
To: "Dennis" <[EMAIL PROTECTED]>; "Modperl" <[EMAIL PROTECTED]>
Sent: Thursday, November 21, 2002 5:58 PM
Subject: Re: libperl.so: undefined symbol: PL_dowarn


> Dennis wrote:
> > Hi,
> >
> > I have compiled mod_perl en installed it without any errors but wen i
try to
> > start Apache witch mod_perl then i get the following error:
> >
> > Starting Apache 1.3.27:
> > Syntax error on line 274 of /opt/apache-1.3.27/conf/httpd.conf:
> > Cannot load /opt/apache/libexec/libperl.so into server:
> > /opt/apache/libexec/libperl.so: undefined symbol: PL_dowarn
> > /opt/apache/bin/apachectl startssl: httpd could not be started
>
> As gozer suggest next to me, you might have a stray header file from an
> older perl, which happened to be picked by the build. Any chance you
> have a few installations of perl? Trying install from scratch?
>
>
> --
>
>
> _
> Stas Bekman JAm_pH  --   Just Another mod_perl Hacker
> http://stason.org/  mod_perl Guide   http://perl.apache.org/guide
> mailto:[EMAIL PROTECTED]  http://ticketmaster.com http://apacheweek.com
> http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
>
>
>




libperl.so: undefined symbol: PL_dowarn

2002-11-21 Thread Dennis
Hi,

I have compiled mod_perl en installed it without any errors but wen i try to
start Apache witch mod_perl then i get the following error:

Starting Apache 1.3.27:
Syntax error on line 274 of /opt/apache-1.3.27/conf/httpd.conf:
Cannot load /opt/apache/libexec/libperl.so into server:
/opt/apache/libexec/libperl.so: undefined symbol: PL_dowarn
/opt/apache/bin/apachectl startssl: httpd could not be started

I use Apache 1.3.27 from source on a Debian 3 box, with the standard perl
(5.6.1-7) that came with debian.

Here is the output from perl Makefile.PL :


packages:/opt/pkgs/src/mod_perl-1.27# perl Makefile.PL USE_APXS=1
WITH_APXS=/opt/apache/bin/apxs  EVERYTHING=1
Will configure via APXS (apxs=/opt/zx/apache/bin/apxs)
PerlDispatchHandler.enabled
PerlChildInitHandlerenabled
PerlChildExitHandlerenabled
PerlPostReadRequestHandler..enabled
PerlTransHandlerenabled
PerlHeaderParserHandler.enabled
PerlAccessHandler...enabled
PerlAuthenHandler...enabled
PerlAuthzHandlerenabled
PerlTypeHandler.enabled
PerlFixupHandlerenabled
PerlHandler.enabled
PerlLogHandler..enabled
PerlInitHandler.enabled
PerlCleanupHandler..enabled
PerlRestartHandler..enabled
PerlStackedHandlers.enabled
PerlMethodHandlers..enabled
PerlDirectiveHandlers...enabled
PerlTableApienabled
PerlLogApi..enabled
PerlUriApi..enabled
PerlUtilApi.enabled
PerlFileApi.enabled
PerlConnectionApi...enabled
PerlServerApi...enabled
PerlSectionsenabled
PerlSSI.enabled
Will run tests as User: 'nobody' Group: 'root'
Configuring mod_perl for building via APXS
 + Creating a local mod_perl source tree
 + Setting up mod_perl build environment (Makefile)
 + id: mod_perl/1.27
 + id: Perl/v5.6.1 (linux) [perl]
Note (probably harmless): No library found for -lperl
Now please type 'make' to build libperl.so
Checking CGI.pm VERSION..ok
Checking for LWP::UserAgent..ok
Checking for HTML::HeadParserok
Checking if your kit is complete...
Looks good
Writing Makefile for Apache
Writing Makefile for Apache::Connection
Writing Makefile for Apache::Constants
Writing Makefile for Apache::File
Writing Makefile for Apache::Leak
Writing Makefile for Apache::Log
Writing Makefile for Apache::ModuleConfig
Writing Makefile for Apache::PerlRunXS
Writing Makefile for Apache::Server
Writing Makefile for Apache::Symbol
Writing Makefile for Apache::Table
Writing Makefile for Apache::URI
Writing Makefile for Apache::Util
Writing Makefile for mod_perl
packages:/opt/pkgs/src/mod_perl-1.27#

What is the problem that i get this error libperl.so: undefined symbol:
PL_dowarn?

Dennis,




Re: How do I force a 'Save Window?'

2002-11-20 Thread Dennis Daupert

Thanks all for the great suggestions. This group is wonderfully helpful.
I tried the quick route, setting MIME type to "application/octet-stream,"
and that works fine for xl spreadsheets, but I still get the same behavior
as before with MS Project files (browser IE 5.00.3105.0106, which is one
of the IE versions we have to support). I will need a bit more time to try
some of the other more involved ideas , so that won't be for a few more
days.

/dennis

---
Office phone: 817-762-8304

---
 "Great leaders never tell people how to do their jobs.
   Great leaders tell people what to do and establish a
 framework within which it must be done.
  Then they let people on the front lines,
   who know best, figure out how to get it done."
~ General H. Norman Schwarzkopf







How do I force a 'Save Window?'

2002-11-19 Thread Dennis Daupert
I have file upload working, can upload files of ascii or binary format.
But a problem when you browse to a page that dynamically displays
hyperlinks to files. Text and html files display normally in a browser,
and Word docs popup MS Word as a helper app, and the word doc
opens fine. But MS Project files popup a browser instance and MS
Project, and you get the usual "Enable macros" and such popups as
normal, but only  a subset of the project displays in the browser window,
and none of the buttons are active in the Project application. Bummer.

How can I force a "Save File" dialog screen for selected files, so the user
will have the option to download the file, then open it in Project or
whatever?


Thanks for any help or information.

/dennis

---
Office phone: 817-762-8304

---
 "Great leaders never tell people how to do their jobs.
   Great leaders tell people what to do and establish a
 framework within which it must be done.
  Then they let people on the front lines,
   who know best, figure out how to get it done."
~ General H. Norman Schwarzkopf







Re: File Upload Questions

2002-11-15 Thread Dennis Daupert
Thanks all for the suggestions;  I really appreciate the help.
I will tuck BINMODE away for future reference.

Before I got those ideas, while digging around in the mailing
list archives I found a reference to the link function in
Apache::Request that creates a hard symlink to a specified
path from the uploaded temp file, thus:

  my $upload = $apr->upload('file');
  $upload->link("/path/to/newfile") or
  die sprintf "link from '%s' failed: $!", $upload->tempname;

I tried that last night, and it works great.

Makes me a believer in checking the archives.

/dennis


---
Office phone: 817-762-8304

---
 "Great leaders never tell people how to do their jobs.
   Great leaders tell people what to do and establish a
 framework within which it must be done.
  Then they let people on the front lines,
   who know best, figure out how to get it done."
~ General H. Norman Schwarzkopf







File Upload Questions

2002-11-14 Thread Dennis Daupert
I have gotten file upload working using Apache::Request for
text files. But binary files seem to have other ideas :-)

For example, uploading a word doc, I get a success message,
but when I retrieve the doc after uploading it, and try to open it in
Word 2000, I get the popup error message:

"The document name or path is not valid... etc"

Do I need to do anything to detect the content type of the file and
set binary versus ascii transfers? The man page for Apache::Request
talks about type, but not how to set the transfer.

In case I have done something silly in my code, here is a section in which
I untaint the filename, and also remove the leading c:\path\to\file info
(for windows uploads) or similar /path/to/file for unix uploads:

# now let's untaint the filename itself
if ($data{'up_filename'} =~ /^([-\@\/\w\:\\.]+)$/) {
$data{'up_filename'} = $1;
my $cleanfile = $data{'up_filename'};
$cleanfile = $1; # $cleanfile now untainted
$cleanfile =~ s#\.\.##g;
$cleanfile =~ s[//][/]g;
 # take out windows backslashes
 if ($cleanfile =~ /\\/) {
  my @parts = split ( /\\/, $cleanfile );
 $cleanfile = pop @parts;
   }
   # take out unix forward slashes
   if ($cleanfile =~ /\//) {
   my @parts = split ( /\//, $cleanfile );
  $cleanfile = pop @parts;
   }
$data{'up_filename'} = $cleanfile;
}

And then:

my $fh = $upload->fh;
my @file = <$fh>;

open ( WRITEFILE, ">$data{'write_dir'}/$data
{'up_filename'}" ) or die "couldn't open $data{'up_filename'} for writing:
$! \n";
 print WRITEFILE "@file";
close (WRITEFILE);

Any insight greatly appreciated.

/dennis

---
Office phone: 817-762-8304

---
 "Great leaders never tell people how to do their jobs.
   Great leaders tell people what to do and establish a
 framework within which it must be done.
  Then they let people on the front lines,
   who know best, figure out how to get it done."
~ General H. Norman Schwarzkopf







re: [ANNOUNCE] Apache Hello World Benchmarks - Apache C API, HelloDB

2002-07-30 Thread Dennis Haney


> The bias in the test is even a little slanted towards the JSP
> benchmarks since the trivial connection pooling I used there is
> nothing like the Apache::DBI overhead in the mod_perl test, when I
> could have just used a persistent global $dbh instead. ( maybe I
> should? )

I believe you should. It is the most common setup using mod_perl, if
you are concerned about performance, anyway.

-- 
Dennis
use Inline C => qq{void p(char*g){
printf("Just Another %s Hacker\n",g);}};p("Perl");



I can see Apache.pm, why can't he?

2002-07-29 Thread Dennis Daupert

What's up with this? I'm trying to load Apache::DBI on startup.

I have apache and mod_perl installed, and running ok,
and have installed additional modules, including the
Apache::Bundle.

When I put the line in mod_perl.conf,

PerlModule Apache::DBI

I can't start the web server.

On the command line, when I say

perl -e 'use Apache::DBI'

I get the error msg:

Can't locate object method "module" via package "Apache"
(perhaps you forgot to load "Apache"? at /usr/lib/perl5/
site_perl/5.6.1/Apache/DBI.pm line 199.

Line 199 checks for Apache.pm and Apache::Status, thus:

if ($INC('Apache.pm') and Apache->module('Apache::Status'));

I have both Apache.pm and Apache::Status installed.

What gives?

/dennis








re: [OT] mod_gzip configuration

2001-12-04 Thread Dennis Haney

It works fine for me...

a random entry from my log:

0xc159be10.boanxx2.adsl.tele.dk - - [02/Dec/2001:13:01:45 +0100] + 4 
davh.dk davh.dk 200 200 1604 "GET /perl/pla/calc.pl HTTP/1.1" "-" 
"Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90)" 78pct.

Was compressed 78%

my config:


  mod_gzip_on Yes
  mod_gzip_dechunkYes
  mod_gzip_minimum_file_size  300
  mod_gzip_maximum_file_size  0
  mod_gzip_maximum_inmem_size 10
  mod_gzip_keep_workfiles No
  mod_gzip_temp_dir   /tmp
  mod_gzip_can_negotiate  Yes
  mod_gzip_item_include   file \.html$
  mod_gzip_item_include   file \.jsp$
  mod_gzip_item_include   file \.php$
  mod_gzip_item_include   file ^$
  mod_gzip_item_include   file \.pl$
  mod_gzip_item_include   mime ^text/.*
  mod_gzip_item_include   mime ^application/x-httpd-php
  mod_gzip_item_include   mime ^httpd/unix-directory$
  mod_gzip_item_include   handler ^perl-script$
  mod_gzip_item_include   handler ^server-status$
  mod_gzip_item_include   handler ^server-info$
#  mod_gzip_item_exclude   file \.css$
#  mod_gzip_item_exclude   file \.js$
  mod_gzip_item_exclude   mime ^image/.*



-- 
Dennis
use Inline C => qq{void p(char*g){printf("Just Another %s Hacker\n",g);}};p("Perl");





RH7.0+Apache_1.3.14+mod_perl-1.24_01 -- bad combination ?

2000-11-04 Thread Dennis

When I'm compiling mod_perl on RH6.2 everything works just fine,
but when I try the same steps on RH7.0, it refuses to run apache server,
saying that I don't have a lockfile on the local disk when I do.
(compiling stand alone apache on RH7.0 works but when mod_perl compiles
apache, it doesn't work)

I tried downloading perl5.6.0 and compiling it and mod_perl with the same
compiler .. it still didn't work ..

did anybody have the same problem ?
is there a solution ?  or should I stick to RH6.2 for now ..

Dennis






databases .. authentication ..

2000-10-17 Thread Dennis



Hey there
 
I am trying to 
replicate a website, and everything seems to work, except the 
database
I'm not sure, where to start, but I'll start with 
the code I saw on one of the .html files,  The password is sent to that 
html by the means of POST method .
 
 &( $user =  new singles::users 
$cgi::fields{password} ; '' )  &is( ! ref $user ) 

 &skip(5) 
 
the code should either authenticate a user 
or reject the password ..I'm new to Perl, and I'm not sure exactly 
what the above commands do...  but I got all the scripts in place and they 
should be working..  but they are rejecting all the passwords I try, even 
that I got my password files in place.  Maybe I don't have some pointers to 
the appropriate data loaded in some appropriate place.  Do you know how do 
I do that ?  or what the problem might be ?  
Besides that, is 
there some info out there that can help me get started with building a database 
? (in case I can't make this one work) or maybe also i could learn more about my 
database.  I also I have files called dbm.pl and dbm.pm.  is it a 
standard package somewhere ? 
 
thanks,
Dennis
 


I got it to work: apache fails to work with mod_perl

2000-10-15 Thread Dennis

Hey

just so you know, I got it to work, but I made some changes, that is
switched Redhat 7.0 to Redhat6.2
apache3.12 to 3.14
mod_perl-1.24 to 1.24_01

the problem was probably in Redhat7.0, but don't quote me on this because I
changed all 3 variables (RH, apache and mod_perl)
but it works now

Dennis


> I'm having a problem making apache work with mod_perl.
> Short problem description is:  when I compile apache by itself, it =
> works,
> but when I compile mod_perl (which builds apache also) it doesn't work =
> and gives me an error that's on =
> http://www.apache.org/docs/misc/FAQ-D.html#nfslocking=20
>  When I am trying to fix the error as it says on the page, apache is =
> still behaving the same way, that is -- not working and giving me the =
> same error.
>
> I am using RedHat Linux 7.0




apache fails to work with mod_perl .. (old PerlRequire conf/startup.pl + more info)

2000-10-14 Thread Dennis
apache as root, and hope that's not 
the problem and I don't think it should be .. 
I can try compiling it as a user other than root .. 
or should I ?

 
thank you,
Dennis 
 
 


PerlRequire conf/startup.pl

2000-10-13 Thread Dennis



Hey
 
I have "PerlRequire conf/startup.pl" in 
httpd.conf
and startup.pl has  "1;" in it
then I start apache "/usr/local/apache/bin/apachectl start
 
and it says:
/usr/local/apache/bin/apachectl start: httpd 
started
 
but it looks like it's exiting out right 
away.  is that what it's supposed to do ?
 
thanks
Dennis 



<:& > tags

2000-04-24 Thread Dennis



Hey 
 
Have anybody heard of 
<:&   ''some 
perl 
code'' 
> or 

<:  
''some perl 
code''    
>
tags ? 
 

If so, what module is 
responsible for handling those ? 
 
I think it looks something like SSI, but SSI has 
different style of tags and SSI didn't work with those.  or maybe it's a 
different SSI.
Do you know anything about it ? 
 
thanks,
Denn
 
 
 


Trying to setup embedded Perl

2000-04-22 Thread Dennis



Hey 
 
can you throw some helpful hints on the problem I'm 
having ?   
 
I'm trying to move a working site from 
singleslibrary.com to my server.  Unfortunately the guy who wrote the site 
for us is not available anymore .. and nobody seems to know what to do, 
including me.
What I'm trying to do is setup the following: I 
have HTML code, the one like in P.S.
and it seems to have Perl embedded in between 
<:   >   and  
brackets
 
can Apache handle that ?  do I need some other 
program ?  Just wondering if I can use apache to do that
 
 
P.S.
 
I took the following HTML/Perl parts from http://singleslibrary.com/dynahtml/singles/sample.html  

 
Do 
you have children?<:&field('chihome')>EOF<:&htmlselect( 
'chil', CHIHOME, NULL )>Do you 
drink?<:&field('drink')>
 Do 
you smoke?<:&field('smoke')>
 



Apache::DBI Problem

2000-01-07 Thread Dennis Megarry

This message was sent from Geocrawler.com by "Dennis Megarry" <[EMAIL PROTECTED]>
Be sure to reply to that address.

Everything was running fine, i installed mod_perl 
and ApacheDBI, now, I get errors trying to 
connect to mySQL, the message showing up in my 
error_log file is this:

httpd: [Thu Jan  6 22:45:23 2000] [error] 
Undefined subroutine 
&Apache::ROOTwww_2eelite_2ecom::cgi_2dbin::get_2ec
gi::configure called at /user3/elite/cgi-
bin/get.cgi line 16.

Also, when I try to start the startup.pl file 
that came with ApapcheDBI i get this error 
message:

Can't locate object method "module" via 
package "Apache" at /usr/local/lib/perl5
/site_perl/5.005/Apache/DBI.pm line 202.
BEGIN failed--compilation aborted at startup.pl 
line 11.

Anyone have an idea what I'm doing wrong?

Dennis



Geocrawler.com - The Knowledge Archive