[25368] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7613 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 6 11:05:48 2005

Date: Thu, 6 Jan 2005 08:05:25 -0800 (PST)
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, 6 Jan 2005     Volume: 10 Number: 7613

Today's topics:
        Cant return multiple hashes from subroutine <sam.wun@authtec.com>
    Re: Cant return multiple hashes from subroutine <richard@zync.co.uk>
    Re: CGI.pm and special characters in hidden inputs <flavell@ph.gla.ac.uk>
        CRYPT:RC5 problem, can't unencrypt derekg0@gmail.com
    Re: Dummy regex question <not@home.net>
    Re: Dummy regex question <not@home.net>
    Re: Is zero even or odd? <dak@gnu.org>
    Re: Is zero even or odd? <george@briar.demon.co.uk>
    Re: Mail::Thread, From headers incorrect? (Anno Siegel)
    Re: Multiple lines of html store in variable non messy  <andrew.davey@gmail.com>
    Re: Multiple lines of html store in variable non messy  <andrew.davey@gmail.com>
    Re: Multiple lines of html store in variable non messy  <spamtrap@dot-app.org>
    Re: Multiple submit actions. <noreply@gunnar.cc>
        Net::SSH::Perl - remoteinteract.pl doesn?t work <news@chaos-net.de>
    Re: Net::SSH::Perl - remoteinteract.pl doesn?t work <1usa@llenroc.ude.invalid>
    Re: Net::SSH::Perl - remoteinteract.pl doesn?t work <news@chaos-net.de>
    Re: Net::SSH::Perl - remoteinteract.pl doesn?t work <1usa@llenroc.ude.invalid>
    Re: Newbie question on require and semaphores <ThomasKratz@REMOVEwebCAPS.de>
    Re: Newbie question: "Get substring of line" <bik.mido@tiscalinet.it>
    Re: PHP in Perl <shawn.corey@sympatico.ca>
    Re: specifying use strict <carlton_gregory@yahoo.com>
    Re: specifying use strict <1usa@llenroc.ude.invalid>
    Re: trouble with passing reference of hash. <tadmc@augustmail.com>
    Re: trouble with passing reference of hash. <tadmc@augustmail.com>
    Re: Trouble with returning data from recursive sub (Anno Siegel)
        unix commands project? (hymie!)
    Re: unix commands project? (Peter Scott)
    Re: Why does this work? <abigail@abigail.nl>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 06 Jan 2005 23:38:44 +0800
From: sam <sam.wun@authtec.com>
Subject: Cant return multiple hashes from subroutine
Message-Id: <crjnka$1i2m$1@news.hgc.com.hk>

Hi group,

The following code only return a single hash:

#!/usr/bin/perl -w

use strict;
use warnings;
use Data::Dumper;

sub construct
{
     my %values = ();
     my %valuesB = ();
     my $sales_total = 200;
     my $sales_totalB = 400;
     $values{'sales_calc_total'} = ($sales_total);
     $valuesB{'sales_calc_total'} = ($sales_totalB);
     return (%values, %valuesB);
}

my(%hashh, %hashhB) = construct;
print Dumper(%hashh);
print "\n";
print Dumper(%hashhB);
print "sales: $hashh{'sales_calc_total'}\n";

Result:
# !perl
perl test5.pl
$VAR1 = 'sales_calc_total';
$VAR2 = 400;

sales: 400

But where is hashh?

I've been scratching my head for whole day but couldn't found a way to 
fix it. It does look simple, but it turns out killing me completely. :(

Thanks


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

Date: Thu, 06 Jan 2005 16:06:07 +0000
From: Richard Gration <richard@zync.co.uk>
Subject: Re: Cant return multiple hashes from subroutine
Message-Id: <pan.2005.01.06.16.06.06.595826@zync.co.uk>

On Thu, 06 Jan 2005 23:38:44 +0800, sam wrote:

> Hi group,
> 
> The following code only return a single hash:

Actually, it returns a single *list*, which in this case is successive
key,value pairs *from*both*hashes*.

All information you need is in "perldoc perlref", but the short version is
that you need to return *references* to hashes, not the hashes themselves.

#!/usr/bin/perl -w

use strict;
use warnings;
use Data::Dumper;

sub construct
{
     my %values = ();
     my %valuesB = ();
     my $sales_total = 200;
     my $sales_totalB = 400;
     $values{'sales_calc_total'} = ($sales_total);
     $valuesB{'sales_calc_total'} = ($sales_totalB);
     return (\%values, \%valuesB);
             ^         ^
}

# This line incorrect now, have to pick up hash refs
#my(%hashh, %hashhB) = construct;

my ($hashr1, $hashr2) = construct;
    ^        ^

# this block now must use hash refs, not hashes
#print Dumper(%hashh);
#print "\n";
#print Dumper(%hashhB);
#print "sales: $hashh{'sales_calc_total'}\n";

print Dumper($hashr1);
             ^
print "\n";
print Dumper($hashr2);
             ^
print "sales: $hashh->{'sales_calc_total'}\n";
                    ^^

HTH
Rich


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

Date: Thu, 30 Dec 2004 15:58:34 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: CGI.pm and special characters in hidden inputs
Message-Id: <Pine.LNX.4.61.0412301547590.17745@ppepc56.ph.gla.ac.uk>

On Thu, 30 Dec 2004, Gunnar Hjalmarsson wrote:

> Alan J. Flavell wrote:
> > Did/does CGI.pm really emit &apos; on its own initiative?
> 
> No, the escapeHTML() method in CGI.pm replaces ' with &#39;

So it does.  I'm sorry, I realise now that I should have taken the 
time to look before posting...

> (but only when the charset is ISO-8859-1 or WINDOWS-1252, if I 
> understand it correctly).

You do - pasting from the version of CGI.pm that I happen to have to 
hand:

|         my $latin = uc $self->{'.charset'} eq 'ISO-8859-1' ||
|                     uc $self->{'.charset'} eq 'WINDOWS-1252';
|         if ($latin) {  # bug in some browsers
|                $toencode =~ s{'}{&#39;}gso;
|                $toencode =~ s{\x8b}{&#8249;}gso;
|                $toencode =~ s{\x9b}{&#8250;}gso;

But what you omitted to mention was that comment.  There is *no 
theoretical need* for that code: it's meant to work-around bugs in 
specific browsers (probably now outdated, but the workarounds are 
harmless to properly-behaved client agents, so there's no particular 
need to remove the workarounds).

I distinctly remember the (security-relevant!) bug which the \x8b and 
\x9b workarounds are meant to address, and tests confirmed that the 
bug indeed seemed to be confined to documents coded in those specific 
character encodings; but I must confess I'm not exactly familiar with 
the one which prompted L.S to reformulate the apostrophe character.


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

Date: 6 Jan 2005 07:09:15 -0800
From: derekg0@gmail.com
Subject: CRYPT:RC5 problem, can't unencrypt
Message-Id: <1105024155.686272.171590@z14g2000cwz.googlegroups.com>

I'm having a problem with decrypting a password after base64 encoding
and writing to a file, closing the file, opening the file unencoding it
and decrypting.  any help with this would be appreciated.  Also, after
the program is run i'm getting control characters on the next command
prompt, I'm guessing this has something to do with the problem?

Here is my test program and the output below that:

-bash-2.05b# cat testpw.pl
#!/usr/bin/perl
require 5.002;
use FileHandle;
use Crypt::RC5;
use MIME::Base64;

$key =3D "keyfile";
$rounds =3D 12;
$ref =3D Crypt::RC5->new( $key, $rounds );

$rawpw =3D "test";
print "rawpw $rawpw\n";
$encrypted =3D $ref->encrypt( $rawpw );
print "encrypted $encrypted\n";
$encpw =3D encode_base64( $encrypted );
print "encoded $encpw\n";
chomp $encpw;
print "chomped $encpw\n";


$myfile =3D new FileHandle "> testpw";

if (!defined $myfile)
{
print "$date Error could not open output file\n";
exit 0;
}

print $myfile "$encpw\n";
$myfile->close;

$infile =3D new FileHandle "< testpw";
if (!defined $myfile)
{
print "$date Error could not open input file\n";
exit 0;
}
$thepw =3D $infile->getline;
$infile->close;

print "thepw from file $thepw";
$unencpw =3D decode_base64( $thepw );
print "unencpw $unencpw\n";
$ftppw =3D $ref->decrypt( $unencpw );
print "ftppw $ftppw\n";



the output is...


-bash-2.05b# ./testpw.pl
rawpw test
encrypted =C2=C3=BB=C2b/
encoded Dpr7vwhiGC8=3D

chomped Dpr7vwhiGC8=3D
thepw from file Dpr7vwhiGC8=3D
unencpw =C2=C3=BB=C2b/
ftppw
-bash-2.05b# ?6c^[[?6c



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

Date: Thu, 06 Jan 2005 15:32:13 GMT
From: "JayEs" <not@home.net>
Subject: Re: Dummy regex question
Message-Id: <1ScDd.12717$iC4.7894@newssvr30.news.prodigy.com>

> This is, of course, perfectly valid (it doesn't actually help the OP,
> because the OP didn't give accurate information about his problem).  And
> there are, of course, more than one ways to do it. In general however,
> you should use split when you know what you want to throw away, and use
> regexps when you know what you want to keep.


How much more accurate do I need to be?

* I asked a question with a clear description of the problem: How to split 
string that contains a space. * Proposed solution didn't do the job, after 
some discussion Scott figured out what the problem was after I gave the NG a 
code sample reproducing the problem. * Not due to not giving inaccurate 
information, but due to the problem being obfuscated by an idiosyncracy of 
the OS (or so it seems).

I don't think that saying I didn't give accurate information is entirely 
fair...
Then again, problem is solved (thanks Mr, Bryce) so all is well that ends 
well. 




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

Date: Thu, 06 Jan 2005 15:42:54 GMT
From: "JayEs" <not@home.net>
Subject: Re: Dummy regex question
Message-Id: <20dDd.12719$iC4.6999@newssvr30.news.prodigy.com>

> I looked at the output in a hex editor. I suspected something like this.

Haven't used one of those in years... eheheh Thank God!

> I don't know. It could be a "feature" of WWW::Mechanize. I suspect that 
> \xA0 is an ANSI non-breaking space. If so, it could be Win32 specific.

If it's any module "feature", then I would say it's TokeParser's. Before I 
give it to TokeParser I write the HTML to a file, open the file and hand 
*THAT* to the parser.

Regardless, the problem is solved (thank you) and I'll add this one to my 
"things to watch for list" in future scarping attempts. 




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

Date: Thu, 30 Dec 2004 20:23:55 +0100
From: David Kastrup <dak@gnu.org>
Subject: Re: Is zero even or odd?
Message-Id: <x54qi37fp0.fsf@lola.goethe.zz>

"Nicholas O. Lindan" <see@sig.com> writes:

> "David Kastrup" <dak@gnu.org> wrote
>
>> > >It gives us, for example,
>> > >1 = 0/0 = (0+0)/0 = (0/0) + (0/0) = 2
>
> Well, that's wrong.  Obviously wrong.  But constructing
> a false statement doesn't have much value that I can see.

Well, so we better not define things leading to false statements.

> Try:
> 0 + 0 = 2 * 0 <> 0
> 1 = 0/0
>
> Then:
> 1 + 1 = 0/0 + 0/0 = (0+0)/0 = 2 * 0/0 = 2
>
>> > The only definition that does not result in contradictions is that
>> > 0/0 is 'any number'. 1 is just one solution.
>
> I'll buy it.

You buy 0+0 <> 0?  Uh, 0+x = x+0 = x is the _definition_ of 0.  If you
buy 0+0 <> 0, you'll buy anything.

> To say 'it is not defined' is as to say 'here there be monsters',
> and suddenly everybody (most everbody, well, would you believe >0)
> wants to go there.  It is the undiscovered country.

0/0 is the undiscovered country?  I recommend that you take a pair of
knitting needles and stick them with your bare hands into the next
electric outlet.  That will give you some more exciting "undiscovered
country".  Not everything that is a proven bad idea is "undiscovered".

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum


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

Date: Thu, 30 Dec 2004 20:42:31 -0000
From: "George Dishman" <george@briar.demon.co.uk>
Subject: Re: Is zero even or odd?
Message-Id: <cr1p5l$gp2$1@news.freedom2surf.net>


"Nicholas O. Lindan" <see@sig.com> wrote in message 
news:OiYAd.7391$qf5.5059@newsread3.news.atl.earthlink.net...
> "George Dishman" <george@briar.demon.co.uk> wrote
>> "Nicholas O. Lindan" <see@sig.com> wrote
>
>> > under this proposed system k * 0 <> 0
>
> 0 <> (n * 0) = 0 + 0 + ... 0
>
>> > I know that it doesn't make sense in conventional terms.
>> > So what.  I don't care that it looks like idiocy.
>> > Does it work?
>>
>> It means you can't solve problems that can be
>> solved by conventional approach so it doesn't
>> work for me.
>
> What are the problems that can be solved by the
> conventional but not by the proposed?  I'm not trying
> to be belligerent; I am honestly curious.

Let's take a trivial example, you say above

 k * 0 <> 0

If I connect k resistors of equal value in series,
the voltage across the chain will be k times the
voltage across each. If the resistors are 1 ohm
and I pass 1 amp through the chain then each
resistor will have 1 volt across it and the total
will be k volts. If I reduce the current to zero,
the voltage across any one resistor will be zero
but, according to your proposal, the total voltage
isn't zero. What is it?

George




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

Date: 6 Jan 2005 12:33:57 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Mail::Thread, From headers incorrect?
Message-Id: <crjb7l$esv$2@mamenchi.zrz.TU-Berlin.DE>

Nathan  <frizop-manchu@charter.net> wrote in comp.lang.perl.misc:
> -----------
> the problem
> -----------
> I believe the "from" headers of today's email are not the same the module 
> was originally written for.
> 
> the test cases for Mail::Thread show this in the '^From ' field:
> 
> ----
> grep
> ----
> [user@host]$ grep '^From ' file.email
> From p5ml@yahoogroups.com  Tue Jan  7 12:09:16 2003
> From p5ml@yahoogroups.com  Tue Jan  7 12:57:03 2003
> From p5ml@yahoogroups.com  Tue Jan  7 13:27:08 2003
> From rt-users-admin@lists.fsck.com  Tue Jan  7 13:52:02 2003
> From rt-users-admin@lists.fsck.com  Tue Jan  7 14:57:20 2003
> From owner-belfast-pm@pm.org  Tue Jan  7 15:44:22 2003
> From owner-belfast-pm@pm.org  Tue Jan  7 16:21:03 2003
> From owner-belfast-pm@pm.org  Tue Jan  7 16:38:00 2003
> From p5ml@yahoogroups.com  Tue Jan  7 20:34:20 2003
> From p5ml@yahoogroups.com  Wed Jan  8 00:19:39 2003
> 
> -------------------
> todays from headers
> -------------------
> 
> From: "Nathan" <user@host.com>
> 
> 
> ----------------------
> trying to fix the code
> ----------------------
> I noted that there is the line if(/^From / ...) 
> I figured I might be able to change it to fit the newer "From" headers, 
> after changing it to if(/^From: / ...) the script fails with the error 
> message:
> 
> attempt to thread message with no id at 
> /usr/lib/perl5/site_perl/5.8.4/Mail/Thread.pm line 46, <FH> line 1061.

You are mixing up "From " and "From: ".  The first one is a separator that
shows where a new mail message begins, so it *must* be the first line of
a message.  It is *not* a header, and the format hasn't changed in decades. 
"From: " is a standard header (with a different format) and can appear
anywhere in the header section.  You can't exchange one for the other
and expect things to work.

Anno


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

Date: 6 Jan 2005 03:13:45 -0800
From: "daveyand" <andrew.davey@gmail.com>
Subject: Re: Multiple lines of html store in variable non messy way
Message-Id: <1105010025.628407.209850@z14g2000cwz.googlegroups.com>

hey guys thanks for the help, what i posted was what i tried, didnt
think about the =.

The reason i am doing this is i am trying to send an html email to
myself.  The idea above was to try and add css to the email but turns
out i cant do that, or at least i havent l;ooked into it properly.

As for the end result, i am using a function to create a template per
se when creating the main body of the email.  This is what the main
body now looks like:

my $mainbody  = <<EndOfHTML;
<table border="1" cellpadding="5" cellspacing="5" width="80%">
<tr>
<td>Ticker</td>
<td>Price</td>
<td>Change</td>
<td>Percentage</td>
<td>Start</td>
<td>Highest</td>
<td>Lowest</td>
<td>Time</td>
</tr>
<tr>
<td>$csv_stockinfo{"ticket"}</td>
<td>$csv_stockinfo{"price"}</td>
<td>$csv_stockinfo{"change"}</td>
<td>$csv_stockinfo{"percent"}</td>
<td>$csv_stockinfo{"start"}</td>
<td>$csv_stockinfo{"highest"}</td>
<td>$csv_stockinfo{"lowest"}</td>
<td>$csv_stockinfo{"time"}</td>
</tr>
<tr bgcolor="#ff2120">
<td colspan="2">&nbsp;</td>
<td>Quantity</td>
<td>Vesting Price</td>
<td>XCNG Rate</td>
<td>Sell All</td>
<td>Returns<td>Pounds</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
<td>$ShareAmount</td>
<td>\$$Initial_Price</td>
<td>$ExchangeRate</td>
<td>\$$Sell_Returns</td>
<td>\$$returns_minus_initial</td>
<td>&pound;$Final_Earnings</td>
</tr>
</table>
EndOfHTML

I get the error:

Can't find string terminator "EndOfHTML" anywhere before EOF at
 ./calstockreturns.pl line 183.

What am i doing wrong??



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

Date: 6 Jan 2005 03:34:33 -0800
From: "daveyand" <andrew.davey@gmail.com>
Subject: Re: Multiple lines of html store in variable non messy way
Message-Id: <1105011273.254583.188270@f14g2000cwb.googlegroups.com>

fixed it, turns out and i didnt know this, but the EndOfHTML needs to
be not indented.

On a side not, how can i get the code to be indented properly when i
paste it up, as i think you guys would have seen this originally if it
had kept my indentation



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

Date: Thu, 06 Jan 2005 06:46:36 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Multiple lines of html store in variable non messy way
Message-Id: <Jbedndndxc6BuEDcRVn-uA@adelphia.com>

daveyand wrote:

> On a side not, how can i get the code to be indented properly when i
> paste it up

Use a real news reader (Thunderbird, Gnus, Agent, etc.) instead of 
Google's web-based interface. Usenet is *far* older than the web, you 
know...

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Thu, 30 Dec 2004 22:51:55 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Multiple submit actions.
Message-Id: <33jclvF3vm63aU1@individual.net>

Alan J. Flavell wrote:
> I'd be interested to see a working example of a templating system 
> that's working closely with CGI.pm.  Let's say, for what I'd suppose 
> to be a typical example: redisplaying an inadequately-completed form 
> submission, with the successful inputs already filled-in for 
> resubmission (or for second thoughts by the user!), the erroneous 
> inputs flagged for correction, the mandatory fields flagged for 
> completion, and so forth.

I believe that my contact form module is a simple example of that:
http://www.gunnar.cc/contactform/readme.html

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


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

Date: Thu, 6 Jan 2005 13:21:38 +0000 (UTC)
From: Martin Kissner <news@chaos-net.de>
Subject: Net::SSH::Perl - remoteinteract.pl doesn?t work
Message-Id: <slrnctqer2.cjm.news@saturn.maki.dom>

Thereīs  an examplescript on http://search.cpan.org/src/DROLSKY/Net-SSH-
Perl-1.25/eg/remoteinteract.pl

Itīs not working with me although I have 
The "passwd" command gets send and the output of the Command on the 
remote Computer is recieved by the script (which I have proofed by 
adding additional debug-commands).
Then the script hangs.
This must be at theses lines of code:

--- snip ---
if ($str eq "(current) UNIX password: ") {
        my $packet = $ssh->packet_start(SSH_CMSG_STDIN_DATA);
        $packet->put_str($old_password);
        $packet->send;
--- snap ---

Has anyone run the "remoteinteract.pl" successfully ?
Is there any other approach to run ssh-commands interactively?


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

Date: 6 Jan 2005 13:55:13 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Net::SSH::Perl - remoteinteract.pl doesn?t work
Message-Id: <Xns95D65AC04BA15asu1cornelledu@132.236.56.8>

Martin Kissner <news@chaos-net.de> wrote in 
news:slrnctqer2.cjm.news@saturn.maki.dom:

> Thereīs  an examplescript on http://search.cpan.org/src/DROLSKY/Net-
> SSH-Perl-1.25/eg/remoteinteract.pl
> 
> Itīs not working with me although I have 

Although what?

> The "passwd" command gets send and the output of the Command on the 
> remote Computer is recieved by the script (which I have proofed by 
> adding additional debug-commands).
> Then the script hangs.
> This must be at theses lines of code:
> 
> --- snip ---
> if ($str eq "(current) UNIX password: ") {
>         my $packet = $ssh->packet_start(SSH_CMSG_STDIN_DATA);
>         $packet->put_str($old_password);
>         $packet->send;
> --- snap ---
> 
> Has anyone run the "remoteinteract.pl" successfully ?

Hint:

FreeBSD 5.2.1-RELEASE (RECEX) #1: Sun May 30 15:27:51 EDT 2004

xxx@recex:~ > passwd
Changing local password for xxx
Old Password:


-- 
A. Sinan Unur
1usa@llenroc.ude.invalid 
(remove '.invalid' and reverse each component for email address)



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

Date: Thu, 6 Jan 2005 14:50:30 +0000 (UTC)
From: Martin Kissner <news@chaos-net.de>
Subject: Re: Net::SSH::Perl - remoteinteract.pl doesn?t work
Message-Id: <slrnctqk1n.cqi.news@saturn.maki.dom>

* A. Sinan Unur wrote:
>> Itīs not working with me although I have 
>
> Although what?
 ... although I have change the skript to fit my systemīs (Mac OS X)
passwd-Command and have added values for the variables needed ($host,
$new_password etc.)

(Sorry, that i missed the line - Iīm new to the Usenet and to slrn)

>
> Hint:
>
> FreeBSD 5.2.1-RELEASE (RECEX) #1: Sun May 30 15:27:51 EDT 2004
>
> xxx@recex:~ > passwd
> Changing local password for xxx
> Old Password:
>
>
I have done it this way:

--- snip ---
 ...
if ($str =~ /Old/) {
    print "\n\tmatch 1\n";
    my $packet = $ssh->packet_start(SSH_CMSG_STDIN_DATA);
    $packet->put_str($old_password);
    $packet->send;
}
 ...
--- snap ---

I get "match 1" printed, the the skript hangs.
I suppose the $old_password soesnīt get send.

Any ideas ?

-- 
Epur Si Muove (Gallileo Gallilei)


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

Date: 6 Jan 2005 15:33:54 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Net::SSH::Perl - remoteinteract.pl doesn?t work
Message-Id: <Xns95D66B7B899EFasu1cornelledu@132.236.56.8>

Martin Kissner <news@chaos-net.de> wrote in 
news:slrnctqk1n.cqi.news@saturn.maki.dom:

> I have done it this way:
> 
> --- snip ---
> ...
> if ($str =~ /Old/) {
>     print "\n\tmatch 1\n";
>     my $packet = $ssh->packet_start(SSH_CMSG_STDIN_DATA);
>     $packet->put_str($old_password);
>     $packet->send;
> }
> ...
> --- snap ---
> 
> I get "match 1" printed, the the skript hangs.
> I suppose the $old_password soesnīt get send.

My first suggestion is to stop posting so many almost identical messages 
in such a short period of time.

I am not able to get the script to run on Win XP due to unrelated issues:

C:\Dload> remoteinteract.pl
AardvarkIV: Reading configuration data c:/Home/asu1/.ssh/config
AardvarkIV: Reading configuration data /etc/ssh_config
AardvarkIV: Connecting to xxx.xxx.xxx.xxx, port 22.
AardvarkIV: Remote protocol version 1.99, remote software version 
OpenSSH_x.x.xpx FreeBSD-20030924
AardvarkIV: Net::SSH::Perl Version 1.25, protocol version 1.5.
AardvarkIV: No compat match: OpenSSH_x.x.xpx FreeBSD-20030924.
Your vendor has not defined Fcntl macro F_SETFL, used at 
C:/Perl/site/lib/Net/SSH/Perl.pm line 214.

Now, a natural question occurs to me: Did you run the script with debug 
enabled (as it is in the version available on CPAN)?

my $ssh = Net::SSH::Perl->new($host, debug => 1);

If you did, why don't provide that information?

Please read the posting guidelines to learn how you can help those whose 
help you want.

-- 
A. Sinan Unur
1usa@llenroc.ude.invalid 
(remove '.invalid' and reverse each component for email address)



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

Date: Thu, 30 Dec 2004 18:43:23 +0100
From: Thomas Kratz <ThomasKratz@REMOVEwebCAPS.de>
Subject: Re: Newbie question on require and semaphores
Message-Id: <41d43e3b$0$776$bb690d87@news.main-rheiner.de>

Gerald Meazell wrote:
> Matt Garrish wrote:
> 
>> Sorry, I have no idea what ipc.ph is or where you found it. If this is 
>> a script you downloaded off the web, you should probably start 
>> wherever you found it.
>>
>> All I can tell you is that the ph extension is normally only used when 
>> converting C header files to perl. If you're trying to port a C 
>> program you probably have to convert features.h as well (see h2ph). If 
>> you're using a program someone else converted then you'll need to find 
>> those missing header files wherever you found this one.
> 
> 
> Remember, I'm a newbie.  I didn't download squat.  The files where 
> installed on my computer when I installed RedHat.However, you helped me 
> by forcing me to realize that h2ph is used to convert C header files to 
> perl header files so I just converted whatever files it said it was 
> missing.  Thanks!
> 
> However, although they now run, the little sample programs I downloaded 
> off the internet do not run properly so I am still in the dark as to how 
> to implement semaphores in Perl.  Googling "Perl And Semaphore" returns 
> reams of information but nothing really useful to someone like me.

Did you do the obvious and look at:

    http://search.cpan.org/search?query=semaphore&mode=all ?

Thomas


-- 
$/=$,,$_=<DATA>,s,(.*),$1,see;__END__
s,^(.*\043),,mg,@_=map{[split'']}split;{#>J~.>_an~>>e~......>r~
$_=$_[$%][$"];y,<~>^,-++-,?{$/=--$|?'"':#..u.t.^.o.P.r.>ha~.e..
'%',s,(.),\$$/$1=1,,$;=$_}:/\w/?{y,_, ,,#..>s^~ht<._..._..c....
print}:y,.,,||last,,,,,,$_=$;;eval,redo}#.....>.e.r^.>l^..>k^.-


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

Date: Thu, 06 Jan 2005 13:32:39 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Newbie question: "Get substring of line"
Message-Id: <l7kot0palnne1f0q0e5bmcccd1qot044nt@4ax.com>

On 5 Jan 2005 05:54:27 -0800, "jl_post@hotmail.com"
<jl_post@hotmail.com> wrote:

>my $bad = q!$string = $'  if "abc=xyz" =~ m/=/!;
>my $good = q!$string = $1  if "abc=xyz" =~ m/=(.*)$/!;
[snip]
>The results surprised me.  I got the following output:
>
>> Benchmark: timing 10000000 iterations of bad, good...
>> bad: 18 wallclock secs (16.42 usr + -0.03 sys = 16.39 CPU)
>>      @ 610090.90/s
>> good: 22 wallclock secs (20.73 usr +  0.00 sys = 20.73 CPU)
>>       @ 482299.60/s
>
>Apparently, the "bad" code (with $') ran faster than the "good" code!

This is not that surprising: 

(from 'perldoc perlre')

| WARNING: Once Perl sees that you need one of $&, $`, or $' anywhere in
| the program, it has to provide them for every pattern match. This may
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

| substantially slow your program. Perl uses the same mechanism to produce

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

| $1, $2, etc, so you also pay a price for each pattern that contains
  ^^^^^^
  ^^^^^^
  
>So it looks like there is a reason to learn $' after all.  And even
>if your script runs slightly slower as a result of using it, I doubt
>you'll ever notice the difference.

I think that the issues people tend to have with $' et similia only
partially have to do with optimization/performance matters.


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, 06 Jan 2005 08:21:53 -0500
From: Shawn Corey <shawn.corey@sympatico.ca>
Subject: Re: PHP in Perl
Message-Id: <lWaDd.44641$P%3.1817711@news20.bellglobal.com>

Sherm Pendley wrote:
> Well, let's look at the simplest case first. You'd produce an image with 
> PHP by putting the following in your HTML:
> 
>     <img src="/images/chart.php">
> 

Make sure that chart.php sends a "Content-type: ..." before the image, 
as in (and remember the extra blank line):

Content-type: image/png



    --- Shawn


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

Date: 6 Jan 2005 07:34:25 -0800
From: "g3000" <carlton_gregory@yahoo.com>
Subject: Re: specifying use strict
Message-Id: <1105025665.616629.299080@c13g2000cwb.googlegroups.com>

This is what I get also....
ppm> describe File-Slurp
====================
Name: File-Slurp
Version: 9999.06
Author: Uri Guttman (uri@sysarch.com)
Title: File-Slurp
Abstract: Efficient Reading/Writing of Complete Files
Location: ActiveState PPM2 Repository
Available Platforms:
1. MSWin32-x86-multi-thread-5.8
====================
ppm>



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

Date: 6 Jan 2005 15:39:35 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: specifying use strict
Message-Id: <Xns95D66C726865Basu1cornelledu@132.236.56.8>

"g3000" <carlton_gregory@yahoo.com> wrote in news:1105025665.616629.299080
@c13g2000cwb.googlegroups.com:

> This is what I get also....

Please quote some context as to what you are replying to.

Also, what is your point?

You complained:

>> "g3000" <carlton_gregory@yahoo.com> wrote in 
>> news:1104976243.472021.264760@c13g2000cwb.googlegroups.com:

>>> I usually use active states ppm3 but I couldnt find a .ppd file that
>>> was for the latest version of File::Slurp.
>>> Ill look again. The one active state has is from Nov 2001.

Now you say you have the latest version:

> ppm> describe File-Slurp
> ====================
> Name: File-Slurp
> Version: 9999.06
> Author: Uri Guttman (uri@sysarch.com)
> Title: File-Slurp
> Abstract: Efficient Reading/Writing of Complete Files
> Location: ActiveState PPM2 Repository
> Available Platforms:
> 1. MSWin32-x86-multi-thread-5.8
> ====================
> ppm>

I ask again, what was the point of your post?

-- 
A. Sinan Unur
1usa@llenroc.ude.invalid 
(remove '.invalid' and reverse each component for email address)



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

Date: Thu, 6 Jan 2005 07:11:47 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: trouble with passing reference of hash.
Message-Id: <slrnctqe8j.8p7.tadmc@magna.augustmail.com>

sam <sam.wun@authtec.com> wrote:

>  and get rid of the strict and 
> warings. 


You are on your own until you put them back in.

Good luck!


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Thu, 6 Jan 2005 07:13:34 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: trouble with passing reference of hash.
Message-Id: <slrnctqebu.8p7.tadmc@magna.augustmail.com>

Bernard El-Hagin <bernard.el-haginDODGE_THIS@lido-tech.net> wrote:

> Please *please* read about local(). You don't seem to understand what 
> it's for.


See also:


   "Coping with Scoping":

      http://perl.plover.com/FAQs/Namespaces.html


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 6 Jan 2005 11:22:02 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Trouble with returning data from recursive sub
Message-Id: <crj70q$esv$1@mamenchi.zrz.TU-Berlin.DE>

sabio62 <sabio62@yahoo.com> wrote in comp.lang.perl.misc:
> G'Day,
> 
> I've got some trouble with not being able to access the  data being
> returned from a sub; the sub in question is supposed to return a
> reference to an array of Multinode::Tree::Handle objects.
> The problem is evident inside the sub itself. The sub contains a
> recursive sub which in turn is updating an array beloning to the main
> sub ...
> 
> I'd greatly appreciate if you can take a look at it and let me know
> what to do get the handles properly ...
> 
> You may access the source code from this link:
> 
> http://www.geocities.com/sabio62/perl/build_categories_tree_with_a_hash_as_values_01.pl.txt

Ugh.  That's 290 lines of Perl.  The problem should be demonstrable in
20 lines of code or less if you properly isolate it.  Do that, and if
the process doesn't clear up the problem for you (it often does), then
post it and we can talk.

Anno


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

Date: Thu, 06 Jan 2005 15:10:05 -0000
From: hymie@lactose.smart.net (hymie!)
Subject: unix commands project?
Message-Id: <10tql6dnq5spc24@corp.supernews.com>

Greetings.

I could have sworn that there was a project at one point to replace
the "basic" Unix commands (ls, mv, cp, stuff like that) with perl
scripts.

Can somebody remind me if this project still exists, and where I might
find it?

(My google and yahoo searches all came up empty, but I don't have the
magic touch that lets me craft the proper search request.)

hymie!          http://www.smart.net/~hymowitz          hymie@lactose.smart.net
===============================================================================


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

Date: Thu, 06 Jan 2005 15:59:51 GMT
From: peter@PSDT.com (Peter Scott)
Subject: Re: unix commands project?
Message-Id: <XfdDd.716526$Pl.3183@pd7tw1no>

In article <10tql6dnq5spc24@corp.supernews.com>,
 hymie@lactose.smart.net (hymie!) writes:
>I could have sworn that there was a project at one point to replace
>the "basic" Unix commands (ls, mv, cp, stuff like that) with perl
>scripts.
>
>Can somebody remind me if this project still exists, and where I might
>find it?

http://ppt.perl.org/

-- 
Peter Scott
http://www.perldebugged.com/
*** NEW *** http://www.perlmedic.com/


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

Date: 30 Dec 2004 22:18:57 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Why does this work?
Message-Id: <slrnct8vmh.h3.abigail@alexandra.abigail.nl>

Bart Lateur (bart.lateur@pandora.be) wrote on MMMMCXXXIX September
MCMXCIII in <URL:news:iuo7t0haa286ldaj07hkf7uqmg57bmjt6s@4ax.com>:
##  Abigail wrote:
##  
## >By design, and documented. From perlop/Symbolic Unary Operators:
## >
## >       Unary "-" performs arithmetic negation if the operand is
## >       numeric.  If the operand is an identifier, a string con­
## >       sisting of a minus sign concatenated with the identifier
## >       is returned.  Otherwise, if the string starts with a plus
## >       or minus, a string starting with the opposite sign is
## >       returned.  One effect of these rules is that -bareword is
## >       equivalent to "-bareword".
##  
##  I don't read it that way.

It's not my interpretation. I *quoted* the manual. If you read it
differently, then you read it different than the manual says, so
your expectation will be different, and you'll think "bug" when there
isn't one.

##                            For what I see, 
##  
##  	-force
##  
##  is the same as 
##  
##  	"-" . force

But it's not (as you've found out), and it's not what the manual
says. So, what's the problem?

##  It is not. Well, it is is, more or less, without use strict.
##  
##  	use strict; $_ = -force; print;
##  result:
##  	-force
##  
##  No error, no warning

Right.

##  	$_ = "-" . force; print;
##  result:
##  	Unquoted string "force" may clash with future reserved word at..
##  	-force

Right.

##  No error, but a warning.
##  
##  	use strict; $_ = "-" . force; print;
##  result:
##  	Bareword "force" not allowed while "strict subs" in use at... 
##  	Execution of test.pl aborted due to compilation errors.

Right.

Indeed. Just as:

    use strict; print STDOUT force => "\n";
result:
    force


    use warnings; print STDOUT force, "\n";
result:
    Unquoted string "force" may clash with future reserved word at ...
    force


    use strict; print STDOUT force, "\n"
result:
    Bareword "force" not allowed while "strict subs" in use at ...
    Execution of -e aborted due to compilation errors.



Abigail
-- 
#!/opt/perl/bin/perl   --   # Remove trailing newline!
BEGIN{$SIG{__WARN__}=sub{$_=pop;y-_- -;print/".*(.)"/;  
truncate$0,-1+-s$0;exec$0;}}//rekcaH_lreP_rehtona_tsuJ


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

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 7613
***************************************


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