[31703] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2966 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat May 29 14:09:40 2010

Date: Sat, 29 May 2010 11:09:21 -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, 29 May 2010     Volume: 11 Number: 2966

Today's topics:
        =?windows-1256?B?49/H4ePHyiDjzMfk7eUg4+Qgx+HH5MrR5Mogxw <sofaelgen4@gmail.com>
    Re: Force Perl cgi to run as specific id under IIS <spamtrap@shermpendley.com>
        installing Net::SSH::Perl <ron.eggler@gmail.com>
    Re: installing Net::SSH::Perl <ron.eggler@gmail.com>
    Re: installing Net::SSH::Perl <derykus@gmail.com>
        Is $_ special somehow? <steve@staticg.com>
    Re: Is $_ special somehow? <kkeller-usenet@wombat.san-francisco.ca.us>
    Re: Is $_ special somehow? <uri@StemSystems.com>
    Re: Is $_ special somehow? <john@castleamber.com>
    Re: Is $_ special somehow? <uri@StemSystems.com>
    Re: Is $_ special somehow? <willem@turtle.stack.nl>
    Re: Is $_ special somehow? sln@netherlands.com
        running jar file with multiple arguments in perl <angcoolit@gmail.com>
    Re: running jar file with multiple arguments in perl <angcoolit@gmail.com>
    Re: Where is the perl documentationn for '..' (command  <tzz@lifelogs.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 29 May 2010 04:41:10 -0700 (PDT)
From: sofa elgen4 <sofaelgen4@gmail.com>
Subject: =?windows-1256?B?49/H4ePHyiDjzMfk7eUg4+Qgx+HH5MrR5Mogxw==?= =?windows-1256?B?4ewgx+Hj5sjH7eEg5sfhx9HW7A==?=
Message-Id: <db396727-ec5b-40fc-ac5e-54e721fffc18@q33g2000vbt.googlegroups.com>

49/H4ePHyiDjzMfk7eUg4+Qgx+HH5MrR5Mogx+HsIMfh4+bIx+3hIObH4cfR1uwKaHR0cDovL3Zv
aXAtc29mYS5ibG9nc3BvdC5jb20v


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

Date: Sat, 29 May 2010 12:31:30 -0400
From: Sherm Pendley <spamtrap@shermpendley.com>
Subject: Re: Force Perl cgi to run as specific id under IIS
Message-Id: <m2bpbyllel.fsf@shermpendley.com>

TomW <thomas.e.welch@boeing.com> writes:

> I'm trying to force perl cgi scripts to run under a specific user id
> under IIS.

Seems to me that you'd do it the same way if the script were written
in Perl, Python, Ruby, or anything else. You should try asking about
this in a group that talks about IIS.

sherm--

-- 
Sherm Pendley                <www.shermpendley.com>
                             <www.camelbones.org>
Cocoa Developer


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

Date: Fri, 28 May 2010 08:50:59 -0700 (PDT)
From: cerr <ron.eggler@gmail.com>
Subject: installing Net::SSH::Perl
Message-Id: <90ef24d1-9b4d-4cb0-9b74-d438d1130108@40g2000vbr.googlegroups.com>

Hi There,

I've been trying to install "Net::SSH::Perl" from cpan(http://
search.cpan.org/~turnstep/Net-SSH-Perl-1.34/lib/Net/SSH/Perl.pm)
because i need an ssh connection to a client but i'm having serious
issues.
I've been trying to install it with perl -MCPAN -e 'install
Net::SSH::Perl' and by choosing all the default options i get to
following:

PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/00-compile.t t/01-
dh.t
t/00-compile.t .. Math::BigInt: couldn't load specified math lib(s),
fallback to Math::BigInt::FastCalc at /home/reg/.cpan/build/Crypt-
DH-0.06-FepXlP/blib/lib/Crypt/DH.pm line 6
t/00-compile.t .. ok
t/01-dh.t ....... Math::BigInt: couldn't load specified math lib(s),
fallback to Math::BigInt::FastCalc at /home/reg/.cpan/build/Crypt-
DH-0.06-FepXlP/blib/lib/Crypt/DH.pm line 6
t/01-dh.t ....... 15/18

and there it just keeps hanging, ain't goin anywhere from here... :o

And then if i do a:

perl -MCPAN -e 'install Math::BigInt::FastCalc'

I get this:

CPAN: Storable loaded ok (v2.20)
Going to read '/home/reg/.cpan/Metadata'
  Database was generated on Thu, 27 May 2010 22:27:07 GMT
Math::BigInt::FastCalc is up to date (0.19).

How can I get Net::SSH::Perl installed properly?
Thank you!
Ron


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

Date: Fri, 28 May 2010 09:05:24 -0700 (PDT)
From: cerr <ron.eggler@gmail.com>
Subject: Re: installing Net::SSH::Perl
Message-Id: <37194b5a-a150-4c19-a155-c20792385e98@f13g2000vbm.googlegroups.com>

[snip]

Okay, i've been able to install it by downloading the .tar.gz and
compiling/installing it manually. But if i have a script that looks
like this:

[perl]
#!/usr/bin/perl -w
use strict;
use Net::SSH::perl;
[/perl]

and execute this i still get:
 ./checkINITnPDS.pl
Can't locate Net/SSH/perl.pm in @INC (@INC contains: /etc/perl /usr/
local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/
share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/
site_perl .) at ./checkINITnPDS.pl line 3.
BEGIN failed--compilation aborted at ./checkINITnPDS.pl line 3.
:(( What's going on here? :o


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

Date: Fri, 28 May 2010 10:28:26 -0700 (PDT)
From: "C.DeRykus" <derykus@gmail.com>
Subject: Re: installing Net::SSH::Perl
Message-Id: <a2fb48fb-ffdb-4e05-8681-1a20466cb6ce@a27g2000prj.googlegroups.com>

On May 28, 9:05=A0am, cerr <ron.egg...@gmail.com> wrote:
> [snip]
>
> Okay, i've been able to install it by downloading the .tar.gz and
> compiling/installing it manually. But if i have a script that looks
> like this:
>
> [perl]
> #!/usr/bin/perl -w
> use strict;
> use Net::SSH::perl;
                ^^^^^
                Perl

--
Charles DeRykus




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

Date: Fri, 28 May 2010 15:45:49 -0700 (PDT)
From: Steve <steve@staticg.com>
Subject: Is $_ special somehow?
Message-Id: <5487df27-b1ec-4088-a481-62b5927d6f93@t26g2000prt.googlegroups.com>

I'm going through the O'reilly book and I learned about the next
operator.  So this works, as it should:

-----------------------------------------
my @words = qw#hello kayak prong#;
for (@words)
{
	next if /kayak/;
	print "$_\n";
}
-----------------------------------------

However, if I write it as this, it doesn't work:
-----------------------------------------
my @words = qw#hello kayak prong#;
for my $word (@words)
{
	next if /kayak/;
	print "$word\n";
}
-----------------------------------------

Why is this? I thought in this case, $_ and $word would contain the
same thing?


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

Date: Fri, 28 May 2010 16:05:22 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: Is $_ special somehow?
Message-Id: <jqu5d7xm7m.ln2@goaway.wombat.san-francisco.ca.us>

Yes, $_ is special.  Check perldoc perlvar for more details.

On 2010-05-28, Steve <steve@staticg.com> wrote:
>
> However, if I write it as this, it doesn't work:
> -----------------------------------------
> my @words = qw#hello kayak prong#;
> for my $word (@words)
> {
> 	next if /kayak/;

This line is equivalent to

	next if $_ =~ /kayak/;

But you want

	next if $word =~ /kayak/;

If you don't use $_ as your loop variable, then your regular expression
statements need to specify the variable to use.

--keith

-- 
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information



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

Date: Fri, 28 May 2010 19:11:06 -0400
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: Is $_ special somehow?
Message-Id: <87eigvoc51.fsf@quad.sysarch.com>

>>>>> "S" == Steve  <steve@staticg.com> writes:

  S> I'm going through the O'reilly book and I learned about the next
  S> operator.  So this works, as it should:

there are many o'reilly books on perl. which one are you reading?

  S> -----------------------------------------
  S> my @words = qw#hello kayak prong#;

# is a poor choice for a string delimiter. the best practice choices are
usually paired chars like () or {}. some styles like // especially when
passing args to a use command.

  S> for (@words)
  S> {
  S> 	next if /kayak/;
  S> 	print "$_\n";
  S> }
  S> -----------------------------------------

  S> However, if I write it as this, it doesn't work:
  S> -----------------------------------------
  S> my @words = qw#hello kayak prong#;
  S> for my $word (@words)
  S> {
  S> 	next if /kayak/;
  S> 	print "$word\n";
  S> }
  S> -----------------------------------------

  S> Why is this? I thought in this case, $_ and $word would contain the
  S> same thing?

you don't say what is different or show output. this is a classic newbie
issue saying something doesn't work but not saying what you expected vs
what you see.

now i can see the issue and it is very simple. for will only alias its
list elements to $_ if you don't supply a loop variable. in the second
case you do so /kayak/ will match against $_ which isn't set (or has
some older value left over). this means you likely weren't using
warnings which would have told you that $_ was undef (assuming that for
the moment). that would have clued you in to noticing $_ was never being
set in the second loop. you could have also tested that by printing $_
in the second loop. that is a classic debugging technique. you think $_
would be set or the /kayak/ would match against it but that wasn't the
case. some simple prints of the right things would have told you
this. always check your assumptions with debugging prints when you are
not sure about something.

so this lesson was more than on your bug but how to debug your own code.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Fri, 28 May 2010 21:12:23 -0500
From: John Bokma <john@castleamber.com>
Subject: Re: Is $_ special somehow?
Message-Id: <87d3wfv4l4.fsf@castleamber.com>

"Uri Guttman" <uri@StemSystems.com> writes:

> you don't say what is different or show output. this is a classic newbie
> issue saying something doesn't work but not saying what you expected vs
> what you see.

He did: he expect the second snippet to work like the first. It doesn't
matter what the output is IMO, since it's clear what the mistake is in
the second example.

Please don't make beginners look stupid, thank you.

-- 
John Bokma                                                               j3b

Hacking & Hiking in Mexico -  http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development


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

Date: Fri, 28 May 2010 23:47:48 -0400
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: Is $_ special somehow?
Message-Id: <87r5kvmkrf.fsf@quad.sysarch.com>

>>>>> "JB" == John Bokma <john@castleamber.com> writes:

  JB> "Uri Guttman" <uri@StemSystems.com> writes:
  >> you don't say what is different or show output. this is a classic newbie
  >> issue saying something doesn't work but not saying what you expected vs
  >> what you see.

  JB> He did: he expect the second snippet to work like the first. It doesn't
  JB> matter what the output is IMO, since it's clear what the mistake is in
  JB> the second example.

  JB> Please don't make beginners look stupid, thank you.

i beg to differ. claiming the two outputs aren't the same isn't the same
as saying what is different about them. that info would always make it
easier to find the bug. and it is a good lesson on how to describe
bugs. the classic 'it doesn't work' is something you need to teach to
avoid.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Sat, 29 May 2010 08:05:50 +0000 (UTC)
From: Willem <willem@turtle.stack.nl>
Subject: Re: Is $_ special somehow?
Message-Id: <slrni01imu.1sfe.willem@turtle.stack.nl>

John Bokma wrote:
) "Uri Guttman" <uri@StemSystems.com> writes:
)
)> you don't say what is different or show output. this is a classic newbie
)> issue saying something doesn't work but not saying what you expected vs
)> what you see.
)
) He did: he expect the second snippet to work like the first. It doesn't
) matter what the output is IMO, since it's clear what the mistake is in
) the second example.

It is irrelevant that the mistake is clear.

The OP cannot know that it is clear, otherwise they would have known what
the mistake is in the first place.  Therefore, they should have posted
all information that would be helpful to solving the problem, such as
exactly what the expected and actual outputs are, etcetera.

Being a beginner, they have just as much to learn about how to ask
questions effectively as about programming itself.


SaSW, Willem
-- 
Disclaimer: I am in no way responsible for any of the statements
            made in the above text. For all I know I might be
            drugged or something..
            No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT


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

Date: Sat, 29 May 2010 09:57:51 -0700
From: sln@netherlands.com
Subject: Re: Is $_ special somehow?
Message-Id: <ldg206l825bb181ei3iel3hpek3lpsa0s0@4ax.com>

On Sat, 29 May 2010 08:05:50 +0000 (UTC), Willem <willem@turtle.stack.nl> wrote:

>John Bokma wrote:
>) "Uri Guttman" <uri@StemSystems.com> writes:
>)
>)> you don't say what is different or show output. this is a classic newbie
>)> issue saying something doesn't work but not saying what you expected vs
>)> what you see.
>)
>) He did: he expect the second snippet to work like the first. It doesn't
>) matter what the output is IMO, since it's clear what the mistake is in
>) the second example.
>
>It is irrelevant that the mistake is clear.
>
>The OP cannot know that it is clear, otherwise they would have known what
>the mistake is in the first place.

He said he was learning about the next operator. How is he learning about
that and doesen't know the for operator?
Furthermore, how does he know that $_ would contain anything, or what it
is in this context?

[snip]
>Being a beginner, they have just as much to learn about how to ask
>questions effectively as about programming itself.

But the questions is why did he put a variable between for and the list?
(he is just learning about "next")
And how does he know what this means:
	"next if /kayak/;"

I think the question is fake.
Usually beginners would start with something traditional and laborous:

for (my $i = 0; $i < @words; $i++)
{
   if ($words[$i] =~ /kayak/)
   {
      next;
   }
   # do something else
}

-sln


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

Date: Sat, 29 May 2010 03:27:44 -0700 (PDT)
From: Kulit Ko <angcoolit@gmail.com>
Subject: running jar file with multiple arguments in perl
Message-Id: <09141deb-15e0-4c35-9bd4-b105dd1bd0d4@a27g2000prj.googlegroups.com>

Hi All,
Im trying to run a jar file. this jar file will output multiple
question in console manner and i need to input a value in order to
proceed.
e.g :
A. Choose value 1 :
1 Windows
2 Unix
Input : 2 <Enter>
B. Choose value 2 :
1 Oracle
2 DB2
Im trying :
"java -jar program.jar < abc.txt"
where abc.txt has a value of :
2
1
3
etc.
but its not working its only getting the first value. please help.
thanks.


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

Date: Sat, 29 May 2010 03:38:10 -0700 (PDT)
From: Kulit Ko <angcoolit@gmail.com>
Subject: Re: running jar file with multiple arguments in perl
Message-Id: <bdec3aaf-b9bf-4528-800b-5cb95de53d7f@a27g2000prj.googlegroups.com>

btw, ive also try :
OPEN PIPE, "|java -jar program.jar";
    open FH, /abc.txt
    while (my $res = <FH>)
    print PIPE "$res";
    close FH;
close PIPE;


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

Date: Fri, 28 May 2010 11:01:23 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Where is the perl documentationn for '..' (command line)
Message-Id: <87ljb49fsc.fsf@lifelogs.com>

On Tue, 25 May 2010 07:47:10 -0500 brian d foy <brian.d.foy@gmail.com> wrote: 

bdf> In article <87d3wlmikj.fsf@lifelogs.com>, Ted Zlatanov
bdf> <tzz@lifelogs.com> wrote:
 
>> It would be nice if there was an operator perldoc switch analogous to -f
>> for functions.

bdf> I have this on my to do list, but for more than just operators. I'd
bdf> include all keywords, etc.

So like -q then but across all docs?  That would also be very cool
whenever you get to it, thanks, but the advantage of -f is that it goes
to the definition and not just ocurrences.

Ted


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

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:

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

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#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 2966
***************************************


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