[29688] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 932 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 12 18:09:42 2007

Date: Fri, 12 Oct 2007 15:09:05 -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           Fri, 12 Oct 2007     Volume: 11 Number: 932

Today's topics:
        a nice little perl utility <zaxfuuq@invalid.net>
    Re: a nice little perl utility <bik.mido@tiscalinet.it>
    Re: a nice little perl utility <bill@ts1000.us>
    Re: a nice little perl utility <amphetamachine@gmail.com>
    Re: a nice little perl utility <zaxfuuq@invalid.net>
    Re: a nice little perl utility <anonymous@127.0.0.1>
    Re: Cannibal Politicians?  <zaxfuuq@invalid.net>
    Re: changing format comment char <glennj@ncf.ca>
    Re: changing format comment char <glex_no-spam@qwest-spam-no.invalid>
    Re: https access - NET::SSL or Crypt::SSLeay ?  <glex_no-spam@qwest-spam-no.invalid>
        net:scp Host key verification failed <lerameur@yahoo.com>
        net:scp Host key verification failed <lerameur@yahoo.com>
    Re: net:scp Host key verification failed <glex_no-spam@qwest-spam-no.invalid>
    Re: net:scp Host key verification failed <lerameur@yahoo.com>
    Re: net:scp Host key verification failed <lerameur@yahoo.com>
    Re: net:scp Host key verification failed <glex_no-spam@qwest-spam-no.invalid>
    Re: net:scp Host key verification failed <lerameur@yahoo.com>
    Re: newbie question <RedGrittyBrick@SpamWeary.foo>
    Re: reconnect to database was: SIG{'PIPE'} <1usa@llenroc.ude.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 12 Oct 2007 11:15:35 -0700
From: "Wade Ward" <zaxfuuq@invalid.net>
Subject: a nice little perl utility
Message-Id: <cPadnSUj6LktNpLanZ2dnUVZ_j2dnZ2d@comcast.com>

I find myself, as a perl learner on windows, always doing the same thing in 
order to get a script's output.  I finally decided to remember some dos and 
automate the process with a batch file.  You place it in the directory where 
windows always opens a dos window, go back to the root, then up to where 
perl.exe lives:
perl1.bat:
echo on
cd ..
cd ..
cd perl
cd bin

http://www.zaxfuuq.net/perl6.htm
-- 
wade ward
"Nicht verzagen, Bruder Grinde fragen."




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

Date: Fri, 12 Oct 2007 19:39:28 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: a nice little perl utility
Message-Id: <0cbvg3d3kcb4fj0m81rh1ml8m16ohu4e60@4ax.com>

On Fri, 12 Oct 2007 11:15:35 -0700, "Wade Ward" <zaxfuuq@invalid.net>
wrote:

>I find myself, as a perl learner on windows, always doing the same thing in 
>order to get a script's output.  I finally decided to remember some dos and 
>automate the process with a batch file.  You place it in the directory where 
>windows always opens a dos window, go back to the root, then up to where 
>perl.exe lives:
>perl1.bat:
>echo on
>cd ..
>cd ..
>cd perl
>cd bin

I'm ASTONISHED!! Why on hell do you need to do that?!?

>http://www.zaxfuuq.net/perl6.htm

You're assuming wrong that for all users the DOS windows will open in
that directory as you can set it to what you like. I, for one, set it
to C:\temp.

Incidentally you don't need 4 different cd's where one would suffice:

  cd \perl\bin

this is also better in that it will not depend on the starting
directory to be "C:\Documents and Settings\Merl".

But then again, why do you need it at all? Since you like screenshots
I'll show you one portraying a minimal session out of a freshly opened
DOS prompt:

http://blazar.perlmonk.org/tmp/merl01.png

(Sorry for not wrapping a html page with my .sig around it, I suppose
you can survive.)


Note: for those that unlike our friend do *not* like screenshots, it's
simply as follows

  Microsoft Windows XP [Versione 5.1.2600]
  (C) Copyright 1985-2001 Microsoft Corp.
  
  C:\temp>wjed merl.pl
  
  C:\temp>cat merl.pl
  #!/usr/bin/perl -l
  
  use strict;
  use warnings;
  
  my $adj=shift || 'freak';
  print "Merl iz a $adj!";
  
  __END__
  
  C:\temp>merl crank
  Merl iz a crank!
  
  C:\temp>merl
  Merl iz a freak!
  
  C:\temp>


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: Fri, 12 Oct 2007 11:31:33 -0700
From:  Bill H <bill@ts1000.us>
Subject: Re: a nice little perl utility
Message-Id: <1192213893.773687.265580@e9g2000prf.googlegroups.com>

On Oct 12, 1:39 pm, Michele Dondi <bik.m...@tiscalinet.it> wrote:
> On Fri, 12 Oct 2007 11:15:35 -0700, "Wade Ward" <zaxf...@invalid.net>
> wrote:
>
> >I find myself, as a perl learner on windows, always doing the same thing in
> >order to get a script's output.  I finally decided to remember some dos and
> >automate the process with a batch file.  You place it in the directory where
> >windows always opens a dos window, go back to the root, then up to where
> >perl.exe lives:
> >perl1.bat:
> >echo on
> >cd ..
> >cd ..
> >cd perl
> >cd bin
>
> I'm ASTONISHED!! Why on hell do you need to do that?!?
>
> >http://www.zaxfuuq.net/perl6.htm
>
> You're assuming wrong that for all users the DOS windows will open in
> that directory as you can set it to what you like. I, for one, set it
> to C:\temp.
>
> Incidentally you don't need 4 different cd's where one would suffice:
>
>   cd \perl\bin
>
> this is also better in that it will not depend on the starting
> directory to be "C:\Documents and Settings\Merl".
>
> But then again, why do you need it at all? Since you like screenshots
> I'll show you one portraying a minimal session out of a freshly opened
> DOS prompt:
>
> http://blazar.perlmonk.org/tmp/merl01.png
>
> (Sorry for not wrapping a html page with my .sig around it, I suppose
> you can survive.)
>
> Note: for those that unlike our friend do *not* like screenshots, it's
> simply as follows
>
>   Microsoft Windows XP [Versione 5.1.2600]
>   (C) Copyright 1985-2001 Microsoft Corp.
>
>   C:\temp>wjed merl.pl
>
>   C:\temp>cat merl.pl
>   #!/usr/bin/perl -l
>
>   use strict;
>   use warnings;
>
>   my $adj=shift || 'freak';
>   print "Merl iz a $adj!";
>
>   __END__
>
>   C:\temp>merl crank
>   Merl iz a crank!
>
>   C:\temp>merl
>   Merl iz a freak!
>
>   C:\temp>
>
> 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,

I solved this a long time ago on XP by just downloading the XP power
toy that lets you right click on a folder and open command window
there and being sure perl is in the path. But there are some handy
perl utilities that I have written and used perl2exe on. Simple ones
like fixnames.exe that will take all the filenames in the current
directory and make them lowercase, remove spaces, extra puncuation
things like that. Another that takes a simple text file that I create
in the current directory called from.txt and creates an HTML form with
javascript checking to be sure all required input is included.

Bill H



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

Date: Fri, 12 Oct 2007 11:48:14 -0700
From:  h3xx <amphetamachine@gmail.com>
Subject: Re: a nice little perl utility
Message-Id: <1192214894.083177.12860@q5g2000prf.googlegroups.com>

On Oct 12, 12:39 pm, Michele Dondi <bik.m...@tiscalinet.it> wrote:
> On Fri, 12 Oct 2007 11:15:35 -0700, "Wade Ward" <zaxf...@invalid.net>
> wrote:
>
> >I find myself, as a perl learner on windows, always doing the same thing in
> >order to get a script's output.  I finally decided to remember some dos and
> >automate the process with a batch file.  You place it in the directory where
> >windows always opens a dos window, go back to the root, then up to where
> >perl.exe lives:
> >perl1.bat:
> >echo on
> >cd ..
> >cd ..
> >cd perl
> >cd bin
>
> I'm ASTONISHED!! Why on hell do you need to do that?!?
>
> >http://www.zaxfuuq.net/perl6.htm
>
> You're assuming wrong that for all users the DOS windows will open in
> that directory as you can set it to what you like. I, for one, set it
> to C:\temp.
Actually in Windows, if you have a bare batch file and you call it
either from Explorer or the "Run..." prompt, it executes from the
directory it's placed into. If you open the Properties dialog (right-
click menu in Explorer) you can change its default working directory
from there. Then all commands will execute relative to that directory.
>
> Incidentally you don't need 4 different cd's where one would suffice:
>
>   cd \perl\bin
Or, as mentioned above, you could change the working directory of the
batch file using the Properties dialog to "C:\perl\bin" or whatever
drive you have it on. Heh. Drive letters.
>
> this is also better in that it will not depend on the starting
> directory to be "C:\Documents and Settings\Merl".
>
> But then again, why do you need it at all? Since you like screenshots
> I'll show you one portraying a minimal session out of a freshly opened
> DOS prompt:
>
> http://blazar.perlmonk.org/tmp/merl01.png
>
> (Sorry for not wrapping a html page with my .sig around it, I suppose
> you can survive.)
>
> Note: for those that unlike our friend do *not* like screenshots, it's
> simply as follows
>
>   Microsoft Windows XP [Versione 5.1.2600]
>   (C) Copyright 1985-2001 Microsoft Corp.
>
>   C:\temp>wjed merl.pl
>
>   C:\temp>cat merl.pl
>   #!/usr/bin/perl -l
>
>   use strict;
>   use warnings;
>
>   my $adj=shift || 'freak';
>   print "Merl iz a $adj!";
>
>   __END__
This last line is unnecessary. You'll hardly EVER see it unless
there's a data section below it, which I haven't seen but once.
>
>   C:\temp>merl crank
>   Merl iz a crank!
>
>   C:\temp>merl
>   Merl iz a freak!
>
>   C:\temp>
>
> 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: Fri, 12 Oct 2007 14:44:20 -0700
From: "Wade Ward" <zaxfuuq@invalid.net>
Subject: Re: a nice little perl utility
Message-Id: <dJSdnfsYAdAAQZLanZ2dnUVZ_gqdnZ2d@comcast.com>




"Michele Dondi" <bik.mido@tiscalinet.it> wrote in message 
news:0cbvg3d3kcb4fj0m81rh1ml8m16ohu4e60@4ax.com...
> On Fri, 12 Oct 2007 11:15:35 -0700, "Wade Ward" <zaxfuuq@invalid.net>
> wrote:
>
> I'm ASTONISHED!! Why on hell do you need to do that?!?
Here, on hell, I found myself doing the same things time and time again.  It 
saves 35 keystrokes to get to where my command window has to be.

> You're assuming wrong that for all users the DOS windows will open in
> that directory as you can set it to what you like. I, for one, set it
> to C:\temp.
No.  My soln was to use cd .. to get to the root.  Yours is obviously 
better.  I had forgotten that dos syntax.

>  C:\temp>wjed merl.pl
>
>  C:\temp>cat merl.pl
How do you get perl.exe to interpret these commands.  Is temp in a child 
directory?

>  #!/usr/bin/perl -l
I take it, this is the appropriate shebang line for xp?

>  C:\temp>merl crank
>  Merl iz a crank!
>
>  C:\temp>merl
>  Merl iz a freak!
I'll take that as a compliment.
-- 
wade ward
"Nicht verzagen, Bruder Grinde fragen." 




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

Date: Fri, 12 Oct 2007 17:27:00 -0400
From: "Jim Carlock" <anonymous@127.0.0.1>
Subject: Re: a nice little perl utility
Message-Id: <470fe6ac$0$5006$4c368faf@roadrunner.com>

(1) Create a shortcut to the cmd.exe prompt.
(2) Set the Target: to, C:\WINDOWS\system32\cmd.exe /K CD /D
(3) It doesn't matter what you put in the Start in: box.
(4) Move the shortcut to the %userprofile%\sendto\.
(5) Right click inside any Explorer window on a folder, then
    click upon SendTo..., then upon the newly created shortcut.

It will ALWAYS open in the folder that you tell it to open in.
If you want a default folder in case you don't click upon such,
then fill in the Start in: textbox.

The /D is a switch for the CHDIR command. It tells it to log on
to the drive first, in case you want to open a prompt on another
drive.

Hope this helps.

-- 
Jim Carlock
Swimming Pool, Spa And Water Feature Builders
http://www.aquaticcreationsnc.com/





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

Date: Fri, 12 Oct 2007 10:28:15 -0700
From: "Wade Ward" <zaxfuuq@invalid.net>
Subject: Re: Cannibal Politicians? 
Message-Id: <U-GdneQ_e_MFPZLanZ2dnUVZ_oKhnZ2d@comcast.com>


> Maybe, but Max is still a bastard.
>
> AC
>

news:JdqdnQkwELhWAJLanZ2dnUVZ_u6rnZ2d@comcast.com...

I've never seen a post quite like this before.  I set the follow-up to
misc.news.internet.discuss.
-- 
wade ward
"Nicht verzagen, Bruder Grinde fragen."





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

Date: 12 Oct 2007 16:34:52 GMT
From: Glenn Jackman <glennj@ncf.ca>
Subject: Re: changing format comment char
Message-Id: <slrnfgv8hd.440.glennj@smeagol.ncf.ca>

At 2007-10-11 05:21PM, "Time Waster" wrote:
>  I wanted to use the format statement to create a script for a
>  different language:
>  
>      if (open(FP,">$SOMEFNAME")) {
>          format FP =
>  #!/usr/bin/expect 
>  spawn some-commnd
>  expect -re "some string"
>  more here of course
>  .
>          write FP;
>          close FP;
>      }
>  
>  ..but that doesn't work because the '#' means comment, and I can't
>  seem to escape it.  I will continue reading about this feature,
>  but anyone know offhand if there's a way around this?

In addition to all the other suggestions, you can use the __DATA__
section of your script.  I do this often when I want to include some
code for another language:

    #!/usr/bin/perl
    my $expect_script = join '', <DATA>;
    ...

    __DATA__
    #!/usr/bin/exprct
    ...


-- 
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry


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

Date: Fri, 12 Oct 2007 11:35:11 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: changing format comment char
Message-Id: <470fa23f$0$10309$815e3792@news.qwest.net>

Time Waster wrote:
> Nice!
> 
> Thanks everyone, i'm using the simple redirect from inline now.

Whatever that means.


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

Date: Fri, 12 Oct 2007 11:30:25 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: https access - NET::SSL or Crypt::SSLeay ? 
Message-Id: <470fa121$0$10309$815e3792@news.qwest.net>

- Bob - wrote:
> On Thu, 11 Oct 2007 12:12:38 -0500, "J. Gleixner"
> <glex_no-spam@qwest-spam-no.invalid> wrote:
> 
>> If you can 'pull a page' for a non-SSL URL, you can 'pull a page'
>> for a SSL URL, if Crypt::SSLeay is installed. The only
>> difference in the script is 'https' vs 'http'.  You don't use
>> Crypt::SSLeay directly, LWP::* handles that for you.
>>
>> To see how to 'pull a page', first try the documentation:
>>
>> perldoc lwpcook
>> perldoc LWP::UserAgent
>>
>> Or you could simply use the lwp-download script that might have
>> been installed as part of LWP.  You could also use your favorite
>> search engine and find many pages on the Internet, instead
>> of waiting for someone to respond in the newsgroup.
> 
> Thanks. I hacked around with it last night and figured it out. What's
> confusing is the relationship between Net::SSL and/or Crypt::SSLeay -
> but as you noted, once you figure it out, you realize it doesn't
> matter. 

Read through the documentation for Crypt::SSLeay:

perldoc Crypt::SSLeay

The 3rd paragraph gives an indication.


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

Date: Fri, 12 Oct 2007 09:27:06 -0700
From:  lerameur <lerameur@yahoo.com>
Subject: net:scp Host key verification failed
Message-Id: <1192206426.030184.133990@q3g2000prf.googlegroups.com>

hello,

I am using ftp in perl script with no problem. I want to use SCP
instead of ftp but I am not having any luck. Do I need a key on the
receiving end??. The script uses the put command and gives me an error
when it cannot use this command:

 ....
$SCP->cwd($directory) or $newerr=1; 					#getting into the directory
  push @ERRORS, "Can't cd  $!\n" if $newerr;
  myerr() if $newerr;
  $SCP->quit if $newerr;

   $SCP->put("$file_to_put") or die $SCP->{errstr};
   print "Putting file and quitting \n";

$SCP->quit;

Here the error message:
Connected
Getting file list
Logged in
unable to initialize mechanism library [/usr/lib/gss/gl/mech_krb5.so]
Host key verification failed.
lost connection



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

Date: Fri, 12 Oct 2007 09:33:17 -0700
From:  lerameur <lerameur@yahoo.com>
Subject: net:scp Host key verification failed
Message-Id: <1192206797.108721.157850@i13g2000prf.googlegroups.com>

hello,

I am using ftp in perl script with no problem. I want to use SCP
instead of ftp but I am not having any luck. Do I need a key on the
receiving end??. The script uses the put command and gives me an error
when it cannot use this command:

 ....
$SCP->cwd($directory) or $newerr=1; 					#getting into the directory
  push @ERRORS, "Can't cd  $!\n" if $newerr;
  myerr() if $newerr;
  $SCP->quit if $newerr;

   $SCP->put("$file_to_put") or die $SCP->{errstr};
   print "Putting file and quitting \n";

$SCP->quit;

Here the error message:
Connected
Getting file list
Logged in
unable to initialize mechanism library [/usr/lib/gss/gl/mech_krb5.so]
Host key verification failed.
lost connection



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

Date: Fri, 12 Oct 2007 13:08:02 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: net:scp Host key verification failed
Message-Id: <470fb802$0$499$815e3792@news.qwest.net>

lerameur wrote:
> hello,
> 
> I am using ftp in perl script with no problem. I want to use SCP
> instead of ftp but I am not having any luck. Do I need a key on the
> receiving end??. The script uses the put command and gives me an error
> when it cannot use this command:
> 
> ....
> $SCP->cwd($directory) or $newerr=1; 

What is $SCP???.. I'm guessing it's Net::SCP, but yes
you need to set up the authorized_keys file appropriately on the
destination machine.

First, get ssh working from the command line, then
Net::SCP should work.

  perldoc Net::SCP

FREQUENTLY ASKED QUESTIONS

Q: How do you supply a password to connect with ssh within a perl script 
using the Net::SSH module?

A: You don't. Use RSA or DSA keys. See the ssh-keygen(1) manpage.


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

Date: Fri, 12 Oct 2007 11:47:08 -0700
From:  lerameur <lerameur@yahoo.com>
Subject: Re: net:scp Host key verification failed
Message-Id: <1192214828.721176.17810@y27g2000pre.googlegroups.com>

On Oct 12, 2:08 pm, "J. Gleixner" <glex_no-s...@qwest-spam-no.invalid>
wrote:
> lerameur wrote:
> > hello,
>
> > I am using ftp in perl script with no problem. I want to use SCP
> > instead of ftp but I am not having any luck. Do I need a key on the
> > receiving end??. The script uses the put command and gives me an error
> > when it cannot use this command:
>
> > ....
> > $SCP->cwd($directory) or $newerr=1;
>
> What is $SCP???.. I'm guessing it's Net::SCP, but yes
> you need to set up the authorized_keys file appropriately on the
> destination machine.
>
> First, get ssh working from the command line, then
> Net::SCP should work.
>
>   perldoc Net::SCP
> in and getting a different error message:

> FREQUENTLY ASKED QUESTIONS
>
> Q: How do you supply a password to connect with ssh within a perl script
> using the Net::SSH module?
>
> A: You don't. Use RSA or DSA keys. See the ssh-keygen(1) manpage.

yes it is the net::scp module.
I tryed using ssh session manually, worked..Tried the ftp agained and
obtained a different error message:
how do I set the key properly

Connected
Getting file list
Logged in
unable to initialize mechanism library [/usr/lib/gss/gl/mech_krb5.so]
Permission denied (publickey,password,keyboard-interactive).
lost connection



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

Date: Fri, 12 Oct 2007 12:11:48 -0700
From:  lerameur <lerameur@yahoo.com>
Subject: Re: net:scp Host key verification failed
Message-Id: <1192216308.797488.222470@q5g2000prf.googlegroups.com>

On Oct 12, 2:47 pm, lerameur <leram...@yahoo.com> wrote:
> On Oct 12, 2:08 pm, "J. Gleixner" <glex_no-s...@qwest-spam-no.invalid>
> wrote:
>
>
>
> > lerameur wrote:
> > > hello,
>
> > > I am using ftp in perl script with no problem. I want to use SCP
> > > instead of ftp but I am not having any luck. Do I need a key on the
> > > receiving end??. The script uses the put command and gives me an error
> > > when it cannot use this command:
>
> > > ....
> > > $SCP->cwd($directory) or $newerr=1;
>
> > What is $SCP???.. I'm guessing it's Net::SCP, but yes
> > you need to set up the authorized_keys file appropriately on the
> > destination machine.
>
> > First, get ssh working from the command line, then
> > Net::SCP should work.
>
> >   perldoc Net::SCP
> > in and getting a different error message:
> > FREQUENTLY ASKED QUESTIONS
>
> > Q: How do you supply a password to connect with ssh within a perl script
> > using the Net::SSH module?
>
> > A: You don't. Use RSA or DSA keys. See the ssh-keygen(1) manpage.
>
> yes it is the net::scp module.
> I tryed using ssh session manually, worked..Tried the ftp agained and
> obtained a different error message:
> how do I set the key properly
>
> Connected
> Getting file list
> Logged in
> unable to initialize mechanism library [/usr/lib/gss/gl/mech_krb5.so]
> Permission denied (publickey,password,keyboard-interactive).
> lost connection

I also ran the ssh-keygen -t rsa  command.
This created a key on one server. I copied this key on the other
server, still do not work

k



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

Date: Fri, 12 Oct 2007 15:10:13 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: net:scp Host key verification failed
Message-Id: <470fd4a6$0$502$815e3792@news.qwest.net>

lerameur wrote:
[...]
> I also ran the ssh-keygen -t rsa  command.
> This created a key on one server. I copied this key on the other
> server, still do not work

"Still do not work" isn't very helpful.  How did you get it to work
on the command line?

Regardless, this isn't related to perl so I suggest you learn
about ssh/scp by searching/reading/trial and error/whatever and
post questions to a more appropriate ssh, scp, or OS related
newsgroup.

In short:

man ssh
man scp

Basically you copy the id_rsa.pub, or whatever public key
you created, to the destination machine, into that login's
$HOME/.ssh/authorized_keys2 file.

Then you should be able to test it by running "date" on
the remote host.

ssh remote.host.name date

if that works then scp will work.

scp file remote.host.net:remote_file_name

and Net::SCP should work.


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

Date: Fri, 12 Oct 2007 13:16:00 -0700
From:  lerameur <lerameur@yahoo.com>
Subject: Re: net:scp Host key verification failed
Message-Id: <1192220160.568378.145960@i13g2000prf.googlegroups.com>

On Oct 12, 4:10 pm, "J. Gleixner" <glex_no-s...@qwest-spam-no.invalid>
wrote:
> lerameur wrote:
>
> [...]
>
> > I also ran the ssh-keygen -t rsa  command.
> > This created a key on one server. I copied this key on the other
> > server, still do not work
>
> "Still do not work" isn't very helpful.  How did you get it to work
> on the command line?
>
> Regardless, this isn't related to perl so I suggest you learn
> about ssh/scp by searching/reading/trial and error/whatever and
> post questions to a more appropriate ssh, scp, or OS related
> newsgroup.
>
> In short:
>
> man ssh
> man scp
>
> Basically you copy the id_rsa.pub, or whatever public key
> you created, to the destination machine, into that login's
> $HOME/.ssh/authorized_keys2 file.
>
> Then you should be able to test it by running "date" on
> the remote host.
>
> ssh remote.host.name date
>
> if that works then scp will work.
>
> scp file remote.host.net:remote_file_name
>
> and Net::SCP should work.

ok good, I copied the key into the accepting server and it now works.

now I get an error  when I am quitting:

Can't locate object method "quit" via package "Net::SCP" (perhaps you
forgot to load "Net::SCP"?) at ./ftptest.pl line 36.
line 36:  $scp->quit;



this looks like a valid command from http://perldoc.net/Net/SCP.pm
there is also a nice tutorial on generating the keys at
http://rcsg-gsir.imsb-dsgi.nrc-cnrc.gc.ca/documents/internet/node31.html

k



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

Date: Fri, 12 Oct 2007 21:38:02 +0100
From: RedGrittyBrick <RedGrittyBrick@SpamWeary.foo>
Subject: Re: newbie question
Message-Id: <KJ6dnbQPtrWtRpLa4p2dnAA@bt.com>

andrew_nuss@yahoo.com wrote:
> 
> How do you apply a regexp directly to a stream rather than a string?
> 

This looks to me like the sort of post where the OP never replies to 
comments (perhaps never reads them).

As others have pointed out, your question is too vague to answer 
properly, but I wondered if you meant something like

C:\> dir | perl -ne "print if m!0[123]/2007!"

where the string is implicit rather than explicit and the "stream" 
refers to what some might call a piped input stream STDIN.

http://en.wikipedia.org/wiki/Standard_streams
http://en.wikipedia.org/wiki/Stream_%28computer%29
http://en.wikipedia.org/wiki/Streams_%28networking_API%29


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

Date: Fri, 12 Oct 2007 21:56:42 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: reconnect to database was: SIG{'PIPE'}
Message-Id: <Xns99C7B68AF64ABasu1cornelledu@127.0.0.1>

"Petr Vileta" <stoupa@practisoft.cz> wrote in
news:febkd1$1n9f$1@ns.felk.cvut.cz: 

> On the hosting a MySQL server is running but is limited to keep
> connection max to 10 seconds. Idea of my script is this:
> 
> 1) connect to database server ($dbh is "our" variable)
> 2) define sql commands e.g.:
>         our $findit=$dbh->prepare("select max(myid) from table";
>         our $storeit=$dbh->prepare("insert into table set myid=?,
>         text=?"); 

I am guessing you are using integer primary keys. In general, this is a 
bad idea. (E.g., this method will allow you to insert duplicates that 
differ only in the meaningless integer key.) 

It is even a worse idea to try to generate to integer ids yourself using 
your method.

Use a meaningful primary key. I am not going to discuss this any further 
as this is not a SQL group.


> 3) download some web page using LWP module
> 4) parse data
> 5) store data to tables e.g.
>     $storeit->execute($myid,$sometext);

It seems obvious to me that the script should wait until it actually 
needs to access the database to connect to the database.

 ...

> I define
>     our $testdb=$dbh->prepare("select 1");
> and sub recon()
> 
> sub recon
> {
> my $ok=1;
> $testdb->execute() or $ok=0;
> unless($ok)
>     {
>     $dbh=DBI->connect("DBI:mysql:$db:$dbhost",$dbuser,$dbpassword);
>     }
> }
> 
> Have somebody some idea how to resolve it? I not need to do something
> like this
> connect db
> prepare sql command
> execute sql
> disconnect
> do some non-db operations
> connect to db
> ...
> 
> I use about 30 different sql commands and I thought that is good idea
> to define all command in one sub and use execute() commands in script
> only. 

I smell premature optimization. I would go ahead and attempt to 
communicate with the database and if that fails just attempt to re-
connect. So:

* Download web page
* Parse web page
* Connect to database and store data

Sinan


-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
clpmisc guidelines: <URL:http://www.augustmail.com/~tadmc/clpmisc.shtml>



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

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


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