[25983] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 8202 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 25 18:05:27 2005

Date: Sat, 25 Jun 2005 15:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 25 Jun 2005     Volume: 10 Number: 8202

Today's topics:
        CGI:Session porting to Apache:Session <""alexjaquet\"@[no spam]msn.com">
    Re: CGI:Session porting to Apache:Session <""alexjaquet\"@[no spam]msn.com">
    Re: CGI:Session porting to Apache:Session <""alexjaquet\"@[no spam]msn.com">
    Re: CGI:Session porting to Apache:Session <""alexjaquet\"@[no spam]msn.com">
    Re: CGI:Session porting to Apache:Session <""alexjaquet\"@[no spam]msn.com">
    Re: Example for User-defined subroutines for GetOptions <skuo@psi.nsc.com>
    Re: Fixed: ActiveState: Can't spawn "cmd.exe"? <occitan@esperanto.org>
    Re: mod_perl under windows <""alexjaquet\"@[no spam]msn.com">
    Re: mod_perl under windows <noreply@gunnar.cc>
    Re: mod_perl under windows <""alexjaquet\"@[no spam]msn.com">
    Re: mod_perl under windows <""alexjaquet\"@[no spam]msn.com">
    Re: mod_perl under windows <noreply@gunnar.cc>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sat, 25 Jun 2005 21:31:55 +0200
From: Alexandre Jaquet <""alexjaquet\"@[no spam]msn.com">
Subject: CGI:Session porting to Apache:Session
Message-Id: <42bdb134$0$1150$5402220f@news.sunrise.ch>

Anybody 've already done that ?

right now I use :


$CGI::Session::MySQL::TABLE_NAME = 'sessions';
my $session = new CGI::Session( "driver:MySQL", undef, {Handle=>$dbh} );
$session->expire('+2h');
$session->$query->param( "username", "$username");
$session->$query->param( "level", "$level");

What's about mod_perl 2.0 ?

Cheers

--
Alexandre Jaquet


------------------------------

Date: Sat, 25 Jun 2005 22:03:52 +0200
From: Alexandre Jaquet <""alexjaquet\"@[no spam]msn.com">
Subject: Re: CGI:Session porting to Apache:Session
Message-Id: <42bdb8b2$0$1150$5402220f@news.sunrise.ch>

Alexandre Jaquet > a écrit :
> Anybody 've already done that ?
> 
> right now I use :
> 
> 
> $CGI::Session::MySQL::TABLE_NAME = 'sessions';
> my $session = new CGI::Session( "driver:MySQL", undef, {Handle=>$dbh} );
> $session->expire('+2h');
> $session->$query->param( "username", "$username");
> $session->$query->param( "level", "$level");
> 
> What's about mod_perl 2.0 ?
> 
> Cheers
> 
> -- 
> Alexandre Jaquet


When I run my script under mod_perl I got the followin error message :
Can't locate auto/CGI/Session/MySQL/CGI=HASH

Anybody know how to deal with CGI::Session under mod_perl

thx


------------------------------

Date: Sat, 25 Jun 2005 22:30:09 +0200
From: Alexandre Jaquet <""alexjaquet\"@[no spam]msn.com">
Subject: Re: CGI:Session porting to Apache:Session
Message-Id: <42bdbedb$0$1150$5402220f@news.sunrise.ch>

Alexandre Jaquet > a écrit :
> Alexandre Jaquet > a écrit :
> 
>> Anybody 've already done that ?
>>
>> right now I use :
>>
>>
>> $CGI::Session::MySQL::TABLE_NAME = 'sessions';
>> my $session = new CGI::Session( "driver:MySQL", undef, {Handle=>$dbh} );
>> $session->expire('+2h');
>> $session->$query->param( "username", "$username");
>> $session->$query->param( "level", "$level");
>>
>> What's about mod_perl 2.0 ?
>>
>> Cheers
>>
>> -- 
>> Alexandre Jaquet
> 
> 
> 
> When I run my script under mod_perl I got the followin error message :
> Can't locate auto/CGI/Session/MySQL/CGI=HASH
> 
> Anybody know how to deal with CGI::Session under mod_perl
> 
> thx

I currently read a document about Apache::Session :
http://perl.enstimac.fr/perl5.8.5/site_perl/5.8.5/Apache/Session.html

And I tryed to do as it's write on the doc :

  tie %session, 'Apache::Session::MySQL', undef,
     { DataSource => 'dbi:mysql:sessions' };

I thinked I could replace dbi:mysql:sessions by a currently opened db 
connection


tie %session, 'Apache::Session::MySQL', undef,{ DataSource => 
'$dbh:sessions' };
$session {username} = "$username";
$session {level} = "$level";

but I got Can't connect to datasource error.

I didn't understand why :s

I've share my db connection by declaring on the top of my script my 
$dbh. But didn't reuse it ??

Any idea why ?

Cheers


------------------------------

Date: Sat, 25 Jun 2005 22:40:16 +0200
From: Alexandre Jaquet <""alexjaquet\"@[no spam]msn.com">
Subject: Re: CGI:Session porting to Apache:Session
Message-Id: <42bdc139$0$1150$5402220f@news.sunrise.ch>

Alexandre Jaquet > a écrit :
> Alexandre Jaquet > a écrit :
> 
>> Alexandre Jaquet > a écrit :
>>
>>> Anybody 've already done that ?
>>>
>>> right now I use :
>>>
>>>
>>> $CGI::Session::MySQL::TABLE_NAME = 'sessions';
>>> my $session = new CGI::Session( "driver:MySQL", undef, {Handle=>$dbh} );
>>> $session->expire('+2h');
>>> $session->$query->param( "username", "$username");
>>> $session->$query->param( "level", "$level");
>>>
>>> What's about mod_perl 2.0 ?
>>>
>>> Cheers
>>>
>>> -- 
>>> Alexandre Jaquet
>>
>>
>>
>>
>> When I run my script under mod_perl I got the followin error message :
>> Can't locate auto/CGI/Session/MySQL/CGI=HASH
>>
>> Anybody know how to deal with CGI::Session under mod_perl
>>
>> thx
> 
> 
> I currently read a document about Apache::Session :
> http://perl.enstimac.fr/perl5.8.5/site_perl/5.8.5/Apache/Session.html
> 
> And I tryed to do as it's write on the doc :
> 
>  tie %session, 'Apache::Session::MySQL', undef,
>     { DataSource => 'dbi:mysql:sessions' };
> 
> I thinked I could replace dbi:mysql:sessions by a currently opened db 
> connection
> 
> 
> tie %session, 'Apache::Session::MySQL', undef,{ DataSource => 
> '$dbh:sessions' };
> $session {username} = "$username";
> $session {level} = "$level";
> 
> but I got Can't connect to datasource error.
> 
> I didn't understand why :s
> 
> I've share my db connection by declaring on the top of my script my 
> $dbh. But didn't reuse it ??
> 
> Any idea why ?
> 
> Cheers

Finally founded a solution :

tie %session, 'Apache::Session::MySQL', undef, {
			DataSource => 'dbi:mysql:recordz:localhost:sessions',
			UserName => 'alexj',
			Password => 'xxx',
			LockDataSource => 'dbi:mysql:recordz:localhost:sessions',
			LockUserName => 'alexj',
			LockPassword => 'xxx'
		    };




------------------------------

Date: Sat, 25 Jun 2005 23:21:06 +0200
From: Alexandre Jaquet <""alexjaquet\"@[no spam]msn.com">
Subject: Re: CGI:Session porting to Apache:Session
Message-Id: <42bdcacc$0$1150$5402220f@news.sunrise.ch>

Alexandre Jaquet > a écrit :
> Alexandre Jaquet > a écrit :
> 
>> Alexandre Jaquet > a écrit :
>>
>>> Anybody 've already done that ?
>>>
>>> right now I use :
>>>
>>>
>>> $CGI::Session::MySQL::TABLE_NAME = 'sessions';
>>> my $session = new CGI::Session( "driver:MySQL", undef, {Handle=>$dbh} );
>>> $session->expire('+2h');
>>> $session->$query->param( "username", "$username");
>>> $session->$query->param( "level", "$level");
>>>
>>> What's about mod_perl 2.0 ?
>>>
>>> Cheers
>>>
>>> -- 
>>> Alexandre Jaquet
>>
>>
>>
>>
>> When I run my script under mod_perl I got the followin error message :
>> Can't locate auto/CGI/Session/MySQL/CGI=HASH
>>
>> Anybody know how to deal with CGI::Session under mod_perl
>>
>> thx
> 
> 
> I currently read a document about Apache::Session :
> http://perl.enstimac.fr/perl5.8.5/site_perl/5.8.5/Apache/Session.html
> 
> And I tryed to do as it's write on the doc :
> 
>  tie %session, 'Apache::Session::MySQL', undef,
>     { DataSource => 'dbi:mysql:sessions' };
> 
> I thinked I could replace dbi:mysql:sessions by a currently opened db 
> connection
> 
> 
> tie %session, 'Apache::Session::MySQL', undef,{ DataSource => 
> '$dbh:sessions' };
> $session {username} = "$username";
> $session {level} = "$level";
> 
> but I got Can't connect to datasource error.
> 
> I didn't understand why :s
> 
> I've share my db connection by declaring on the top of my script my 
> $dbh. But didn't reuse it ??
> 
> Any idea why ?
> 
> Cheers

I just finish to port a cgi script into mod perl that's really amazing 
the performance gained


------------------------------

Date: Sat, 25 Jun 2005 10:49:37 -0700
From: Steven Kuo <skuo@psi.nsc.com>
Subject: Re: Example for User-defined subroutines for GetOptions please
Message-Id: <Pine.LNX.4.60.0506251047390.22922@psi.nsc.com>

On Fri, 24 Jun 2005, * Tong * wrote:

> Hi,
>
> I need an example for the User-defined subroutines for GetOptions please.
>
>
> ,-----
> | When GetOptions() encounters the option, it will call the subroutine
> | with two or three arguments. The first argument is the name of the
> | option. For a scalar or array destination, the second argument is the
> | value to be stored. For a hash destination, the second arguments is the
> | key to the hash, and the third argument the value to be stored. It is up
> | to the subroutine to store the value, or do whatever it thinks is
> | appropriate.
> `-----
>
> Since the destination is a subroutines, how can Perl tell if it is  scalar
> or array or hash?

[snipped ...]


In a prior reply, I forgot to post an example:


#!/usr/bin/perl
use strict;
use warnings;

use Getopt::Long;

GetOptions(
     'save_to_hash=s%' => sub {
 	print "Option: $_[0], key: $_[1], value: $_[2]\n";
     },
     'save_to_array=s@' => sub {
 	print "Option: $_[0], array_element: $_[1]\n";
     },
);

Invoke as:

$ perl long.pl --save_to_hash foo=bar --save_to_array baz
Option: save_to_hash, key: foo, value: bar
Option: save_to_array, array_element: baz

-- 
Hope this helps,
Steven


------------------------------

Date: Sat, 25 Jun 2005 23:04:16 +0200
From: Daniel Pfeiffer <occitan@esperanto.org>
Subject: Re: Fixed: ActiveState: Can't spawn "cmd.exe"?
Message-Id: <d9kgs4$61l$03$1@news.t-online.com>

la 24.06.2005 03:55 A. Sinan Unur skribis:
> Darren Dunham <ddunham@redwood.taos.com> wrote in
> news:gtJue.3179$Bx6.2017@newssvr13.news.prodigy.com: 
> 
> 
>>A. Sinan Unur <1usa@llenroc.ude.invalid> wrote:
>>
>>>Daniel Pfeiffer <occitan@esperanto.org> wrote in
>>>news:42B88A3F.9050805@esperanto.org: 
>>
>>>>However, checking the coding of those functions, they are broken. 
>>>>Cygwin wrongly inherits from Unix, and that only splits on :, which
>>>>will completely fail on the like of '/bin:"C:/WINNT":"/Path/with
>>>>space"'. 
>>
>>>What are you talking about??? Let me fire up Cygwin shell ... Oooops,
>>>better add a directory with spaces to my path ... Done, now I fire up
>>>the shell.
>>
>>>Here is my $PATH:
>>
>>>PATH='/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:
>>>/cygdrive/c/opt/Perl/bin/:/cygdrive/c/opt/gs8.50/bin:
>>>/cygdrive/c/opt/gs8.50/lib:/cygdrive/c/opt/Perl/bin:
>>>/cygdrive/c/opt/jdk/bin:/cygdrive/c/opt/GTK/2.0/bin:
>>>/cygdrive/c/opt/GIMP-2.2/bin:/cygdrive/c/opt/PuTTY:
>>>/cygdrive/c/Program Files/HighMAT CD Writing Wizard:
>>>/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:
>>>/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/opt/util:
>>>/cygdrive/c/opt/vim/vim63:/cygdrive/c/opt/TeX/bin/win32
>>
>>>Note the requisite path with spaces in the middle of this list. Now:
>>
>>I don't think he's talking about the spaces.  I think he's talking
>>about the colons.  One of his directories is "C:/WINNT".  While I'd
>>never have such a directory listed in cygwin myself (preferring
>>/cygdrive/c/WINNT), it does appear to work...
>>
>>$ ls -ld "C:/WINDOWS"
>>drwxrwx---+ 65 Administrators SYSTEM 0 Jun 15 08:37 C:/WINDOWS
>>
>>Then again, I'd argue that such a path isn't a valid "UNIX" path, so
>>having that cause an error within cygwin isn't really a surprise.
> 
> 
> I understand what you are saying, but I do not see how this is relevant 
> to $PATH. 
> 
> I have my path set only in My Computer -> Properties > Advanced -> 
> Environment Variables.
> 
> If I run Cygwin perl, whether in Cygwin bash it correctly sees 
> /cygdrive/c/WINDOWS where it is set as C:\WINDOWS in the My Computer 
> dialog.
> 
> Anyway, I have not seen a concrete code example from the OP that 
> illustrates the problem.

I have no clue why, but on my company PC configured by an external company, 
when I start Cygwin, I get this kind of PATH='/bin:"C:/WINNT":"/Path/with 
space"' with some directories even listed
both ways.  And Cygwin finds commands in those "C:/..." entries, so it must be 
valid.  Then also Perl programs should work with this, and not say "We'd like 
you to configure qour computer differently!"


------------------------------

Date: Sat, 25 Jun 2005 16:18:10 +0200
From: Alexandre Jaquet <""alexjaquet\"@[no spam]msn.com">
Subject: Re: mod_perl under windows
Message-Id: <42bd67aa$0$1150$5402220f@news.sunrise.ch>

Alexandre Jaquet > a écrit :
> Hi,
> 
> I try to run this script under Apache/2.0.44 (Win32) mod_perl/1.99_08 
> Perl/v5.8.6  :
> 
> #!perl -w
> use CGI;
> 
>   local our $q = CGI->new;
>   local our  $name = $q->param('name');
>   print_response();
> 
>   sub print_response{
>     print "Content-type: text/plain\r\n\r\n";
>     print "Thank you, $name!";
>   }
> 
> And got the following error :
> 
> [Sat Jun 25 12:54:36 2005] [error] 6108: ModPerl::Registry: Can't locate 
> object method "FILENO" via package "Apache::RequestRec" at 
> C:/indigoperl/perl/lib/CGI.pm line 709.
> Compilation failed in require at C:/indigoperl/apache/cgi-bin/test4.pl 
> line 3.
> BEGIN failed--compilation aborted at 
> C:/indigoperl/apache/cgi-bin/test4.pl line 3.
> 
> [Sat Jun 25 12:54:51 2005] [error] 6108: ModPerl::Registry: Undefined 
> subroutine CGI::delete
>  at C:/indigoperl/apache/cgi-bin/test4.pl line 5
> 
> [Sat Jun 25 12:55:03 2005] [error] 6108: ModPerl::Registry: Undefined 
> subroutine CGI::delete
>  at C:/indigoperl/apache/cgi-bin/test4.pl line 5
> 
> Thanks for your help



I 've reinstall mod_perl, perl and install xampp but know I got error 
when I try to install new module with ppm :

Win32API::Registry object version 0.22 does not match bootstrap 
parameter 0.23 at


------------------------------

Date: Sat, 25 Jun 2005 19:18:55 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: mod_perl under windows
Message-Id: <3i5i00Fjv62fU1@individual.net>

Alexandre Jaquet > wrote:
> I try to run this script under Apache/2.0.44 (Win32) mod_perl/1.99_08 
> Perl/v5.8.6  :
> 
> #!perl -w
> use CGI;
> 
>   local our $q = CGI->new;

Why 'local'?

> And got the following error :
> 
> [Sat Jun 25 12:54:36 2005] [error] 6108: ModPerl::Registry: Can't locate 
> object method "FILENO" via package "Apache::RequestRec" at 
> C:/indigoperl/perl/lib/CGI.pm line 709.

The CGI::binmode() function in CGI.pm 3.05 (which comes with IndigoPerl) 
spans over line 709. Apparently the version of mod_perl you mention does 
not like fileno(), so you may want to try the following hack in CGI.pm:

sub binmode {
#    return unless defined($_[1]) && defined fileno($_[1]);
     return unless defined($_[1]) && ref $_[1] eq 'GLOB';
     CORE::binmode($_[1]);
}

CGI.pm includes several other occurrences of fileno(), so the fix may 
not be sufficient.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


------------------------------

Date: Sat, 25 Jun 2005 21:28:10 +0200
From: Alexandre Jaquet <""alexjaquet\"@[no spam]msn.com">
Subject: Re: mod_perl under windows
Message-Id: <42bdb053$0$1153$5402220f@news.sunrise.ch>

Gunnar Hjalmarsson a écrit :
> Alexandre Jaquet > wrote:
> 
>> I try to run this script under Apache/2.0.44 (Win32) mod_perl/1.99_08 
>> Perl/v5.8.6  :
>>
>> #!perl -w
>> use CGI;
>>
>>   local our $q = CGI->new;
> 
> 
> Why 'local'?
> 
>> And got the following error :
>>
>> [Sat Jun 25 12:54:36 2005] [error] 6108: ModPerl::Registry: Can't 
>> locate object method "FILENO" via package "Apache::RequestRec" at 
>> C:/indigoperl/perl/lib/CGI.pm line 709.
> 
> 
> The CGI::binmode() function in CGI.pm 3.05 (which comes with IndigoPerl) 
> spans over line 709. Apparently the version of mod_perl you mention does 
> not like fileno(), so you may want to try the following hack in CGI.pm:
> 
> sub binmode {
> #    return unless defined($_[1]) && defined fileno($_[1]);
>     return unless defined($_[1]) && ref $_[1] eq 'GLOB';
>     CORE::binmode($_[1]);
> }
> 
> CGI.pm includes several other occurrences of fileno(), so the fix may 
> not be sufficient.
> 

why local ? because it's will not be shared between process ... as I 
read in the documentation ...

http://perl.apache.org/docs/1.0/guide/porting.html


------------------------------

Date: Sat, 25 Jun 2005 21:33:38 +0200
From: Alexandre Jaquet <""alexjaquet\"@[no spam]msn.com">
Subject: Re: mod_perl under windows
Message-Id: <42bdb19b$0$1150$5402220f@news.sunrise.ch>

Gunnar Hjalmarsson a écrit :
> Alexandre Jaquet > wrote:
> 
>> I try to run this script under Apache/2.0.44 (Win32) mod_perl/1.99_08 
>> Perl/v5.8.6  :
>>
>> #!perl -w
>> use CGI;
>>
>>   local our $q = CGI->new;
> 
> 
> Why 'local'?
> 
>> And got the following error :
>>
>> [Sat Jun 25 12:54:36 2005] [error] 6108: ModPerl::Registry: Can't 
>> locate object method "FILENO" via package "Apache::RequestRec" at 
>> C:/indigoperl/perl/lib/CGI.pm line 709.
> 
> 
> The CGI::binmode() function in CGI.pm 3.05 (which comes with IndigoPerl) 
> spans over line 709. Apparently the version of mod_perl you mention does 
> not like fileno(), so you may want to try the following hack in CGI.pm:
> 
> sub binmode {
> #    return unless defined($_[1]) && defined fileno($_[1]);
>     return unless defined($_[1]) && ref $_[1] eq 'GLOB';
>     CORE::binmode($_[1]);
> }
> 
> CGI.pm includes several other occurrences of fileno(), so the fix may 
> not be sufficient.
> 

I 've done a complete reinstallation and know everything work fine.

Thanks anyway


------------------------------

Date: Sat, 25 Jun 2005 22:13:39 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: mod_perl under windows
Message-Id: <3i5s7lFjpbjhU1@individual.net>

Alexandre Jaquet > wrote:
> Gunnar Hjalmarsson a écrit :
>> Alexandre Jaquet > wrote:
>>>
>>>   local our $q = CGI->new;
>>
>> Why 'local'?
> 
> because it's will not be shared between process ... as I 
> read in the documentation ...
> 
> http://perl.apache.org/docs/1.0/guide/porting.html

I see. Thanks for explaining.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 8202
***************************************


home help back first fref pref prev next nref lref last post