[29517] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 761 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 16 14:29:34 2007

Date: Thu, 16 Aug 2007 11:29:26 -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           Thu, 16 Aug 2007     Volume: 11 Number: 761

Today's topics:
        unable to use perl on windows <chavanpriya@gmail.com>
    Re: unable to use perl on windows <mritty@gmail.com>
    Re: unable to use perl on windows <pinaki_m77@yahoo.com>
    Re: unable to use perl on windows <chavanpriya@gmail.com>
    Re: unable to use perl on windows <sisyphus1@nomail.afraid.org>
    Re: unable to use perl on windows <mritty@gmail.com>
    Re: unable to use perl on windows <chavanpriya@gmail.com>
    Re: unable to use perl on windows <pinaki_m77@yahoo.com>
    Re: unable to use perl on windows <ayaz@dev.null>
    Re: unable to use perl on windows <bik.mido@tiscalinet.it>
        Using Subroutines with CGI::Session::MySQL? <ljames@apollo3.com>
    Re: Using Subroutines with CGI::Session::MySQL? <paduille.4061.mumia.w+nospam@earthlink.net>
    Re: Using Subroutines with CGI::Session::MySQL? <ljames@apollo3.com>
    Re: Using Subroutines with CGI::Session::MySQL? xhoster@gmail.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 15 Aug 2007 18:12:54 -0000
From:  pc <chavanpriya@gmail.com>
Subject: unable to use perl on windows
Message-Id: <1187201574.936199.205700@e9g2000prf.googlegroups.com>

Hi,I have downloaded and installed active perl.Its in C:/Perl .The
path c:/perl/bin is present in my path variable but still when I type
perl in C: the command is not recognized.However, if i change
directory to c:/perl/bin and type perl it works.Can some one tell me
why I am not able to execute perl from c: even though the path
variable is updated?


PC



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

Date: Wed, 15 Aug 2007 11:45:32 -0700
From:  Paul Lalli <mritty@gmail.com>
Subject: Re: unable to use perl on windows
Message-Id: <1187203532.112221.13340@w3g2000hsg.googlegroups.com>

On Aug 15, 2:12 pm, pc <chavanpr...@gmail.com> wrote:
> Hi,I have downloaded and installed active perl.Its in C:/Perl .The
> path c:/perl/bin is present in my path variable but still when I type
> perl in C: the command is not recognized.However, if i change
> directory to c:/perl/bin and type perl it works.Can some one tell me
> why I am not able to execute perl from c: even though the path
> variable is updated?

What leads you to believe that C:/perl/bin is in your path?  The fact
that cmd.exe can't find a program that's in that directory when you're
not in that directory suggests that it's not in your path.

If you updated your path while you had a command window open, that
command window's path will not be updated to reflect the changes.
Close the window and reopen it.

Paul Lalli



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

Date: Wed, 15 Aug 2007 14:15:49 -0700
From:  googler <pinaki_m77@yahoo.com>
Subject: Re: unable to use perl on windows
Message-Id: <1187212549.613252.273610@e9g2000prf.googlegroups.com>

On Aug 15, 1:12 pm, pc <chavanpr...@gmail.com> wrote:
> Hi,I have downloaded and installed active perl.Its in C:/Perl .The
> path c:/perl/bin is present in my path variable but still when I type
> perl in C: the command is not recognized.

Do you have only one environment variable for path? Is it called Path
or PATH?



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

Date: Wed, 15 Aug 2007 17:17:01 -0700
From:  pc <chavanpriya@gmail.com>
Subject: Re: unable to use perl on windows
Message-Id: <1187223421.826397.19720@x35g2000prf.googlegroups.com>

Hi Paula and Googler,

I am sure that the Path is set because I chekced it in My Computer--
>Advanced-->Environment variables .I see that there is a variable
"Path" which contains c:/perl/bin in it.



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

Date: Thu, 16 Aug 2007 10:40:16 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: unable to use perl on windows
Message-Id: <46c39cf1$0$22253$afc38c87@news.optusnet.com.au>


"pc" <chavanpriya@gmail.com> wrote in message 
news:1187223421.826397.19720@x35g2000prf.googlegroups.com...
> Hi Paula and Googler,
>
> I am sure that the Path is set because I chekced it in My Computer--
>>Advanced-->Environment variables .I see that there is a variable
> "Path" which contains c:/perl/bin in it.
>

At the command prompt, enter:
path

If the output doesn't contain C:\perl\bin, then there's your answer.
If the output *does* contain C:\perl\bin, then please post a copy'n'paste of 
that output so that we can peruse it.

I believe that none of us (including me) have ever come across a situation 
where the claim you are making is correct.

Cheers,
Rob 



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

Date: Wed, 15 Aug 2007 17:58:10 -0700
From:  Paul Lalli <mritty@gmail.com>
Subject: Re: unable to use perl on windows
Message-Id: <1187225890.580935.216920@r29g2000hsg.googlegroups.com>

On Aug 15, 8:17 pm, pc <chavanpr...@gmail.com> wrote:
> Hi Paula and Googler,

Paula is a female's name.  My name is Paul.

> I am sure that the Path is set because I chekced it in My Computer-->Advanced-->Environment variables .I see that there is a variable
>
> "Path" which contains c:/perl/bin in it.

Does it actually contain exactly that, or does it contain the correct
C:\perl\bin?

Paul lalli



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

Date: Thu, 16 Aug 2007 01:18:21 -0000
From:  pc <chavanpriya@gmail.com>
Subject: Re: unable to use perl on windows
Message-Id: <1187227101.551362.114180@e9g2000prf.googlegroups.com>

Hi,

Paul-Sorry for typing your name wrong.
I changed the direction of the slash from / to \ and its working fine
now.
Thank you Paul,Rob,Googler for your help



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

Date: Wed, 15 Aug 2007 21:16:23 -0700
From:  googler <pinaki_m77@yahoo.com>
Subject: Re: unable to use perl on windows
Message-Id: <1187237783.988428.206660@i13g2000prf.googlegroups.com>

On Aug 15, 8:18 pm, pc <chavanpr...@gmail.com> wrote:
> Hi,
>
> Paul-Sorry for typing your name wrong.
> I changed the direction of the slash from / to \ and its working fine
> now.
> Thank you Paul,Rob,Googler for your help

That's a bit strange. I did see that you were using / instead of \ in
your path name, but I thought that Windows usually accepts / too. In
fact I changed my Path environment variable to use / and the 'perl'
command still worked for me. So I didn't point this out. I guess this
must be due to different versions of the OS.



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

Date: Thu, 16 Aug 2007 14:56:14 +0500
From: Ayaz Ahmed Khan <ayaz@dev.null>
Subject: Re: unable to use perl on windows
Message-Id: <20070816145614.20e1e97b.ayaz@dev.null>

"googler" typed:
> pc <chavanpr...@gmail.com> wrote:
>> Paul-Sorry for typing your name wrong.
>> I changed the direction of the slash from / to \ and its working
>> fine now.
>> Thank you Paul,Rob,Googler for your help
> 
> That's a bit strange. I did see that you were using / instead of \ in
> your path name, but I thought that Windows usually accepts / too. In
> fact I changed my Path environment variable to use / and the 'perl'
> command still worked for me. So I didn't point this out. I guess this
> must be due to different versions of the OS.

I bet the OP unwittingly fixed the PATH while re-typing it to use
backslashes.

-- 
Ayaz Ahmed Khan


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

Date: Thu, 16 Aug 2007 13:50:27 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: unable to use perl on windows
Message-Id: <6ce8c3pgekkvt4932f11vmf4jc6d2npnip@4ax.com>

On Wed, 15 Aug 2007 21:16:23 -0700, googler <pinaki_m77@yahoo.com>
wrote:

>That's a bit strange. I did see that you were using / instead of \ in
>your path name, but I thought that Windows usually accepts / too. In

Windows API's accept both. But on the command line they do not work
the same. Appearently a PATH specification is another such case, at
least under some releases of "OS"!  ;-)


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Thu, 16 Aug 2007 06:32:05 -0700
From:  "L. D. James" <ljames@apollo3.com>
Subject: Using Subroutines with CGI::Session::MySQL?
Message-Id: <1187271125.652437.87690@22g2000hsm.googlegroups.com>

Can somebody tell me why accessing the sessions will cause the mysql
driver to fail.

Please look at the follow code.  I have commented out the access
line.  Please notice that refreshing the page will increment the
count, because it will communicate with the session.  Uncommenting
then line, and the count variable will stop incrementing.

#--------------------------- Code Begin
-------------------------------

use warnings;
use strict;
use DBI;
use CGI qw(:standard);
use Switch;
use CGI::Carp qw(fatalsToBrowser);
use CGI::Session::MySQL;

my $name;
my $count;

my $query = new CGI;
my $dbh = DBI->connect( "DBI:mysql:flightmembers:localhost",
"username", "userpass" );
my $sid = cookie('CGISESSID') || param('CGISESSID') || undef;
my $session = new CGI::Session("driver:MySQL", $sid, {Handle=>$dbh})
or die "Session Error...";

sub processdata()
{
    my $username = 'No Data Yet';
    print "<br>-->$name<--<br>-->$count<--<br>";
    # $username = $session->param('f_name');
    print "<br>Processing Data for $username.<br>";
}

print $session->header();

$name = $session->param('f_name');
$count = $session->param("count") || "0";;
$count++;
$session->param('f_name','Larry James');
$session->param('count',"$count");

&processdata();

#---------------------------- Code End
--------------------------------

Thanks in advance for any comments on this.

-- L. James

--
L. D. James
ljames@apollo3.com
www.apollo3.com/~ljames



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

Date: Thu, 16 Aug 2007 11:05:16 -0500
From: "Mumia W." <paduille.4061.mumia.w+nospam@earthlink.net>
Subject: Re: Using Subroutines with CGI::Session::MySQL?
Message-Id: <13c8tfadr2v1fe0@corp.supernews.com>

On 08/16/2007 08:32 AM, L. D. James wrote:
> Can somebody tell me why accessing the sessions will cause the mysql
> driver to fail.
> 
> Please look at the follow code.  I have commented out the access
> line.  Please notice that refreshing the page will increment the
> count, because it will communicate with the session.  Uncommenting
> then line, and the count variable will stop incrementing.
> 
> #--------------------------- Code Begin
> -------------------------------
> 
> use warnings;
> use strict;
> use DBI;
> use CGI qw(:standard);
> use Switch;
> use CGI::Carp qw(fatalsToBrowser);
> use CGI::Session::MySQL;
> 
> my $name;
> my $count;
> 
> my $query = new CGI;
> my $dbh = DBI->connect( "DBI:mysql:flightmembers:localhost",
> "username", "userpass" );
> my $sid = cookie('CGISESSID') || param('CGISESSID') || undef;
> my $session = new CGI::Session("driver:MySQL", $sid, {Handle=>$dbh})
> or die "Session Error...";
> 
> sub processdata()
> {
>     my $username = 'No Data Yet';
>     print "<br>-->$name<--<br>-->$count<--<br>";
>     # $username = $session->param('f_name');
>     print "<br>Processing Data for $username.<br>";
> }
> 
> print $session->header();
> 
> $name = $session->param('f_name');
> $count = $session->param("count") || "0";;
> $count++;
> $session->param('f_name','Larry James');
> $session->param('count',"$count");
> 
> &processdata();
> 
> #---------------------------- Code End
> --------------------------------
> 
> Thanks in advance for any comments on this.
> 
> -- L. James
> 
> --
> L. D. James
> ljames@apollo3.com
> www.apollo3.com/~ljames
> 

I'm assuming you're running under mod_perl.

This seems to have something to do with the peculiar environment that 
mod_perl creates.

I got your program to update the count correctly by placing this line at 
the top of the file:

package Experimental;

The idea was to make sure that the script was always evaluated in the 
same package. I haven't figured out why it's necessary to do this, but I 
think it has something to do with the way processdata() is defined.




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

Date: Thu, 16 Aug 2007 09:46:54 -0700
From:  "L. D. James" <ljames@apollo3.com>
Subject: Re: Using Subroutines with CGI::Session::MySQL?
Message-Id: <1187282814.269365.151610@b79g2000hse.googlegroups.com>

On Aug 16, 12:05 pm, "Mumia W." <paduille.4061.mumia.w
+nos...@earthlink.net> wrote:

> I'm assuming you're running under mod_perl.
>
> This seems to have something to do with the peculiar environment that
> mod_perl creates.
>
> I got your program to update the count correctly by placing this line at
> the top of the file:
>
> package Experimental;
>
> The idea was to make sure that the script was always evaluated in the
> same package. I haven't figured out why it's necessary to do this, but I
> think it has something to do with the way processdata() is defined.

Thanks for the quick solution.  I have mod_perl installed.  I thought
the code was running the perl, v5.8.8 package that was installed and
updated via CPAN (in an effort to fix the problem).

It's working now, but I'll study more about your comments so that I
can learn how to have my scripts more portable.

Since the immediate problem that had me very perplexed for a day, it's
not as critical, but I'm curious what others are doing to define their
sub routines that would possibly work without the package Experimental
line.

By the way, when I use the File session driver it works fine (without
the package Experimental line).  However, I prefer to use the MySQL
driver.

Thanks a lot for the rescue and input.

-- L. James

--
L. D. James
ljames@apollo3.com
www.apollo3.com/~ljames



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

Date: 16 Aug 2007 17:07:29 GMT
From: xhoster@gmail.com
Subject: Re: Using Subroutines with CGI::Session::MySQL?
Message-Id: <20070816130731.021$dY@newsreader.com>

"L. D. James" <ljames@apollo3.com> wrote:
> Can somebody tell me why accessing the sessions will cause the mysql
> driver to fail.
>
> Please look at the follow code.  I have commented out the access
> line.  Please notice that refreshing the page will increment the
> count, because it will communicate with the session.  Uncommenting
> then line, and the count variable will stop incrementing.
>
> #--------------------------- Code Begin
> -------------------------------
>
> use warnings;
> use strict;
> use DBI;
> use CGI qw(:standard);
> use Switch;
> use CGI::Carp qw(fatalsToBrowser);
> use CGI::Session::MySQL;
>
> my $name;
> my $count;
>
> my $query = new CGI;
> my $dbh = DBI->connect( "DBI:mysql:flightmembers:localhost",
> "username", "userpass" );
> my $sid = cookie('CGISESSID') || param('CGISESSID') || undef;
> my $session = new CGI::Session("driver:MySQL", $sid, {Handle=>$dbh})
> or die "Session Error...";
>
> sub processdata()

Why use prototypes?

> {
>     my $username = 'No Data Yet';
>     print "<br>-->$name<--<br>-->$count<--<br>";
>     # $username = $session->param('f_name');
>     print "<br>Processing Data for $username.<br>";
> }

In a mod_perl environment, the $session that is accessible from inside
processdata is the variable allocated when the code was compiled, which
means it is the variable that was in effect the first time this
particular apache process invoked this code.  So on subsequent invocation,
$session outside of processdata is a new $session, while inside of
processdata you get some earlier $session.

This is part of the "variable will not stayed shared" problem.  One
fix is to pass $session into the subroutine rather than using the one
from the outer scope:

sub processdata {
  my $session=shift;
  #...
};



Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

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 V11 Issue 761
**************************************


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