[29627] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 871 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 20 21:14:20 2007

Date: Thu, 20 Sep 2007 18:14:13 -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, 20 Sep 2007     Volume: 11 Number: 871

Today's topics:
    Re: Question on input password on ssh prompt <mluvw47@gmail.com>
    Re: Question on input password on ssh prompt <ben@morrow.me.uk>
        sendmail issue <lerameur@yahoo.com>
    Re: sendmail issue <emschwar@pobox.com>
    Re: sendmail issue <dummy@example.com>
    Re: sendmail issue <glex_no-spam@qwest-spam-no.invalid>
    Re: sendmail issue <lerameur@yahoo.com>
    Re: sendmail issue <glennj@ncf.ca>
    Re: sendmail issue <tony_curtis32@yahoo.com>
    Re: sendmail issue <smallpond@juno.com>
    Re: sendmail issue <glennj@ncf.ca>
    Re: TimeZone calculation on Windows Vista with DateTime <ben@morrow.me.uk>
    Re: Writing a C++ Style Checker <ben@morrow.me.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 20 Sep 2007 22:12:21 -0000
From:  Mav <mluvw47@gmail.com>
Subject: Re: Question on input password on ssh prompt
Message-Id: <1190326341.045677.104860@i38g2000prf.googlegroups.com>

On Sep 19, 11:44 pm, Mav <mluv...@gmail.com> wrote:
> On Sep 19, 10:25 am, Mav <mluv...@gmail.com> wrote:
>
>
>
> > On Sep 17, 5:02 pm, Ben Morrow <b...@morrow.me.uk> wrote:
>
> > > Quoth Mav <mluv...@gmail.com>:
>
> > > > On Sep 17, 10:23 am, Ben Morrow <b...@morrow.me.uk> wrote:
> > > > > Quoth "J. Gleixner" <glex_no-s...@qwest-spam-no.invalid>:
>
> > > > > > Mav wrote:
>
> > > > > > > In fact, The actual script I am working actually first generates the
> > > > > > > public key on the PC side(for that PC), then append the public key
> > > > > > > into linux (.ssh/authorized_key) entry thru ssh command. So next time,
> > > > > > > if the PC invokes a command from the PC to linux side thru ssh, it
> > > > > > > will not prompt the password. Any suggestion?
>
> > > > > > You have to authenticate to have SSH work.  That authentication
> > > > > > can be public key or by providing the password.  You might want
> > > > > > to look at the Expect module, to automate the initial authentication
> > > > > > with the password. Probably the best route is if the ssh keys don't
> > > > > > exist, then to have the script prompt for the password when it
> > > > > > runs, and have it pass it to SSH, using Expect.
>
> > > > > No, that won't work, as Expect requires ptys, which WinXP doesn't have.
> > > > > I think the OP's best way forward is to try Net::SSH::W32Perl, which can
> > > > > log in with a password.
>
> > > > I looks into the Net::SSH::W32Perl, when I tried to use that I got the
> > > > error:
>
> > > > use Net::SSH::W32Perl;
> > > > my $ssh = new Net::SSH::W32Perl($host, protocol => 2, debug=>1);
>
> > > > The getpwuid function is unimplemented at C:/Perl/site/lib/Net/SSH/
> > > > Perl.pm line
> > > > 110.
>
> > > > line 110 on Perl.pm regarding to environment variable $HOME on PC. Do
> > > > you encounter the same problem? That means that I have to set the
> > > > $HOME in my script?
>
> > > Err... yes, looks like it. I always have %HOME% set to my profile
> > > directory anyway under Win32... I guess this could be reported as a bug
> > > in N:S:W32Perl or N:S:Perl: the correct answer would be to use
> > > File::HomeDir. You should probably put
>
> > >     use File::HomeDir;
> > >     BEGIN { $ENV{HOME} ||= File::HomeDir->my_data }
>
> > > at the top, which will cause N:S:Perl to look for its config file in
> > > Local Settings\Application Data\.ssh\config . Alternatively, if you
> > > already have an OpenSSH config file elsewhere, simply direct N:S:W32Perl
> > > at it: you will still need to set $ENV{HOME}, even though it will be
> > > ignored.
>
> > > Ben
>
> > Thanks Ben. Look like when I download the package from here:http://www.soulcage.net/ppds/
>
> > It doesn't have that problem.
>
> > Thanks,
> > Mav
>
> Well, I guess now it comes to another problem..using Par-packer(pp).
> My perl (5.8.7 Build 813) on the PC, I have got a Par-packer version
> that works with my perl version.
> The W32Perl module install on
>
> ----------
>   #This is y.pl
>   use Net::SSH::W32Perl;
>   $host = "192.168.0.101";
>   $user = "user";
>   $passwd = "passwd";
>
>  my $ssh = new Net::SSH::W32Perl($host,protocol => '2,1',debug
> =>1,options =>  ["BatchMode yes", "RhostsAuthentication no" ]);
>  $ssh->login($user, $passwd);
>  my ($out, $err, $exit) = $ssh->cmd('ls -la');
>
> ----------------
>
> The code works fine if I do.
> perl y.pl
>
> However when I tried to using pp to create a a.exe
> ----------
> c:\myperl>pp -o a.exe y.pl
>
> c:\myperl>a.exe
> pc: Reading configuration data /.ssh/config
> pc: Reading configuration data /etc/ssh_config
> pc: Connecting to 192.168.0.101, port 22.
> pc: Socket created, turning on blocking...
> pc: Remote protocol version 2.0, remote software version OpenSSH_4.3p2
> Debi
> an-9
> Can't locate Net/SSH/W32Perl/SSH2.pm in @INC (@INC contains: C:
> \DOCUME~1\Maveri
> k\LOCALS~1\Temp\par-user\cache-1190269914/inc/lib C:\DOCUME~1\user
> \LOCA
> S~1\Temp\par-user\cache-1190269914/inc CODE(0xe8d788) .) at Net/SSH/
> Perl.pm
> line 55, <GEN3> line 1.
> -----
>
> my SSH2.pm is install in
>
> C:\myperl>dir c:\perl\site\lib\Net\SSH\W32Perl\
>  Volume in drive C has no label.
>  Volume Serial Number is B04F-3453
>
>  Directory of c:\perl\site\lib\Net\SSH\W32Perl
>
> 09/18/2007  09:09 PM    <DIR>          .
> 09/18/2007  09:09 PM    <DIR>          ..
> 10/22/2002  06:16 AM               560 SSH2.pm
>
> is that something I am missing when doing pp?
>
> Thanks,
> Mav

Well, I guess I find my answer:
pp -v -o a.exe --lib=C:\Perl\site\lib --module=Net/SSH/W32Perl/SSH2.pm
x.pl

Thanks,

Mav



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

Date: Thu, 20 Sep 2007 23:25:25 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Question on input password on ssh prompt
Message-Id: <lj8bs4-dv2.ln1@osiris.mauzo.dyndns.org>

[this is really a different problem: with PAR instead of with ssh, so it
would have been better to start a new thread.]

Quoth Mav <mluvw47@gmail.com>:
> 
> Well, I guess now it comes to another problem..using Par-packer(pp).
> My perl (5.8.7 Build 813) on the PC, I have got a Par-packer version
> that works with my perl version.
> The W32Perl module install on
> 
> ----------
>   #This is y.pl
>   use Net::SSH::W32Perl;
>   $host = "192.168.0.101";
>   $user = "user";
>   $passwd = "passwd";
> 
>  my $ssh = new Net::SSH::W32Perl($host,protocol => '2,1',debug
> =>1,options =>  ["BatchMode yes", "RhostsAuthentication no" ]);
>  $ssh->login($user, $passwd);
>  my ($out, $err, $exit) = $ssh->cmd('ls -la');
> 
> ----------------
> 
> The code works fine if I do.
> perl y.pl
> 
> However when I tried to using pp to create a a.exe
> ----------
> c:\myperl>pp -o a.exe y.pl
> 
> c:\myperl>a.exe
> pc: Reading configuration data /.ssh/config
                                ^^^
This is probably wrong... do you have %HOME% set to the empty string, or
is your copy of Net::SSH::Perl different?

<snip>
> Can't locate Net/SSH/W32Perl/SSH2.pm in @INC (@INC contains: C:
<snip>
> 
> my SSH2.pm is install in
<snip>
> 
> is that something I am missing when doing pp?

Well, what happened when you tried including Net::SSH::W32Perl::SSH2 in
the PAR explicitly?

    pp -o a.exe -M Net::SSH::W32Perl::SSH2 y.pl

I can't try it here as I don't have a Win32 machine on hand atm.

Ben



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

Date: Thu, 20 Sep 2007 12:02:19 -0700
From:  lerameur <lerameur@yahoo.com>
Subject: sendmail issue
Message-Id: <1190314939.343372.236720@y42g2000hsy.googlegroups.com>

HI again,

I wrote this small script to test my send mail. The script is placed
in the root directory and has the executable permission. It runs
without error, but I never received the email:

#!/usr/bin/perl -w
use strict;

open ( MAIL, "| /usr/lib/sendmail -t" );
print MAIL "From: email address\n";
print MAIL "To: lerameur\@yahoo.com\n";
print MAIL "Subject: Something here \n\n";
close ( MAIL );


k



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

Date: 20 Sep 2007 13:09:35 -0600
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: sendmail issue
Message-Id: <87odfxrw5s.fsf@pobox.com>

lerameur <lerameur@yahoo.com> writes:
> I wrote this small script to test my send mail. The script is placed
> in the root directory and has the executable permission. It runs
> without error, but I never received the email:

If that's the case, then your problem isn't in your perl script; it's
in your mail server.  I recommend finding a newsgroup related to your
mail server, and asking about it there.

-=Eric



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

Date: Thu, 20 Sep 2007 19:16:14 GMT
From: "John W. Krahn" <dummy@example.com>
Subject: Re: sendmail issue
Message-Id: <2GzIi.3664$nO3.2235@edtnps90>

lerameur wrote:
> 
> I wrote this small script to test my send mail. The script is placed
> in the root directory and has the executable permission. It runs
> without error,

Because you ignore any errors that may be generated.

> but I never received the email:
> 
> #!/usr/bin/perl -w
> use strict;
> 
> open ( MAIL, "| /usr/lib/sendmail -t" );
> print MAIL "From: email address\n";
> print MAIL "To: lerameur\@yahoo.com\n";
> print MAIL "Subject: Something here \n\n";
> close ( MAIL );

open my $MAIL, '|-', '/usr/lib/sendmail', '-t'
     or die "Cannot open pipe to sendmail: $!";

print $MAIL <<'MAIL' or warn "Cannot print to sendmail: $!";
From: email address
To: lerameur@yahoo.com
Subject: Something here

MAIL

close $MAIL
     or warn $! ? "Error closing sendmail pipe: $!"
                : "Exit status $? from sendmail";



John
-- 
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall


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

Date: Thu, 20 Sep 2007 14:17:49 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: sendmail issue
Message-Id: <46f2c75d$0$504$815e3792@news.qwest.net>

lerameur wrote:
> HI again,
> 
> I wrote this small script to test my send mail. The script is placed
> in the root directory and has the executable permission. It runs
> without error, 
How do you know?  You don't handle any errors.



>but I never received the email:
> 
> #!/usr/bin/perl -w
> use strict;
> 
> open ( MAIL, "| /usr/lib/sendmail -t" );
> print MAIL "From: email address\n";
> print MAIL "To: lerameur\@yahoo.com\n";
> print MAIL "Subject: Something here \n\n";
> close ( MAIL );

Does it work via the command line?


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

Date: Thu, 20 Sep 2007 12:41:59 -0700
From:  lerameur <lerameur@yahoo.com>
Subject: Re: sendmail issue
Message-Id: <1190317319.708643.317440@w3g2000hsg.googlegroups.com>

I wrote this with the die command

#!/usr/bin/perl -w
use strict;

open ( MAIL, "| /usr/lib/sendmail -t" ) or die ("Cannot open pipe to
sendmail: $!");
print MAIL "From: email address\n";
print MAIL "To: lerameur\@yahoo.com\n";
print MAIL "Subject: Something here \n\n";
close ( MAIL ) or die ("Cannot close sendmail: $!");

no errors, no mail receives


k



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

Date: 20 Sep 2007 19:58:56 GMT
From: Glenn Jackman <glennj@ncf.ca>
Subject: Re: sendmail issue
Message-Id: <slrnff5k81.db8.glennj@smeagol.ncf.ca>

At 2007-09-20 03:41PM, "lerameur" wrote:
>  I wrote this with the die command
>  
>  #!/usr/bin/perl -w
>  use strict;
>  
>  open ( MAIL, "| /usr/lib/sendmail -t" ) or die ("Cannot open pipe to
>  sendmail: $!");
>  print MAIL "From: email address\n";
>  print MAIL "To: lerameur\@yahoo.com\n";
>  print MAIL "Subject: Something here \n\n";
>  close ( MAIL ) or die ("Cannot close sendmail: $!");
>  
>  no errors, no mail receives

Ask your sysadmin to see what's happening in sendmail's log file, or
look in /var/adm or /var/log

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


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

Date: Thu, 20 Sep 2007 15:54:47 -0400
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: sendmail issue
Message-Id: <fcuj68$eqf$1@knot.queensu.ca>

lerameur wrote:
> I wrote this with the die command
> 
> #!/usr/bin/perl -w
> use strict;
> 
> open ( MAIL, "| /usr/lib/sendmail -t" ) or die ("Cannot open pipe to
> sendmail: $!");
> print MAIL "From: email address\n";
> print MAIL "To: lerameur\@yahoo.com\n";
> print MAIL "Subject: Something here \n\n";
> close ( MAIL ) or die ("Cannot close sendmail: $!");
> 
> no errors, no mail receives

then, as someone previously pointed out, the problem must be somewhere 
outside of perl, e.g. your local sendmail setup.

hth
t


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

Date: Thu, 20 Sep 2007 13:14:27 -0700
From:  smallpond <smallpond@juno.com>
Subject: Re: sendmail issue
Message-Id: <1190319267.644446.222240@y42g2000hsy.googlegroups.com>

On Sep 20, 3:02 pm, lerameur <leram...@yahoo.com> wrote:
> HI again,
>
> I wrote this small script to test my send mail. The script is placed
> in the root directory and has the executable permission. It runs
> without error, but I never received the email:
>
> #!/usr/bin/perl -w
> use strict;
>
> open ( MAIL, "| /usr/lib/sendmail -t" );
> print MAIL "From: email address\n";
> print MAIL "To: lerameur\@yahoo.com\n";
> print MAIL "Subject: Something here \n\n";
> close ( MAIL );
>
> k


Because you never gave it the end of the email, which
is defined as a "." on a line by itself.



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

Date: 20 Sep 2007 20:31:16 GMT
From: Glenn Jackman <glennj@ncf.ca>
Subject: Re: sendmail issue
Message-Id: <slrnff5m4l.db8.glennj@smeagol.ncf.ca>

At 2007-09-20 04:14PM, "smallpond" wrote:
>  On Sep 20, 3:02 pm, lerameur <leram...@yahoo.com> wrote:
> > open ( MAIL, "| /usr/lib/sendmail -t" );
> > print MAIL "From: email address\n";
> > print MAIL "To: lerameur\@yahoo.com\n";
> > print MAIL "Subject: Something here \n\n";
> > close ( MAIL );
>  
>  Because you never gave it the end of the email, which
>  is defined as a "." on a line by itself.

Although the sendmail man page does say "sendmail reads its standard
input _up to an EOF_, or a line with a single dot".


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


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

Date: Thu, 20 Sep 2007 23:36:38 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: TimeZone calculation on Windows Vista with DateTime::TimeZone
Message-Id: <m89bs4-dv2.ln1@osiris.mauzo.dyndns.org>


Quoth Ami <ver_amitabh@yahoo.com>:
> Hi All,
>    I am using Windows Vista with ActivePerl 5.8.8.822. I have
> downloaded the latest DateTime::TimeZone package from CPAN (DateTime-
> TimeZone-0.67). When I write a small script to work with it, I always
> get error stating that "Cannot determine local time zone.". After
> debugging, I came to know that DateTime package of Perl reads the
> "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
> \TimeZoneInformation\StandardName" to access this information which is
> supposed to contain a Windows name for the time zone (e.g.) but in
> Windows Vista, it contains some dll entry point information
> (@tzres.dll,-492).
> 
> The code snippet with which I am trying to work is as follows:
> 
> use DateTime::TimeZone;
> my $tz = DateTime::TimeZone->new( name => 'local' );
> $tz = DateTime::TimeZone::Local->TimeZone();
> 
> Can any one help me to make it working on Windows Vista?

This is clearly a bug in DateTime::TimeZone, or rather an
incompatibility with Vista. It's probably worth filing a bug report on
rt.cpan.org.

About the only workaround is to pick the appropriate timezone from the
list returned by DateTime::TimeZone->all_names and set %TZ% in the
environment to that value.

Ben



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

Date: Thu, 20 Sep 2007 23:10:59 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Writing a C++ Style Checker
Message-Id: <jo7bs4-dv2.ln1@osiris.mauzo.dyndns.org>


Quoth ids <ishan.desilva@gmail.com>:
> 
> In a BNF grammar we can define a function using something similar to
> the following.
> 
>     func_impl : type_spec IDENTIFIER '(' opt_param_list ')' block ;
> 
>     block : '{' opt_statement_list '}' ;
> 
>     // define the other non terminals here
> 
> In order to do this, you need to *build state* as and when you scan
> through. i.e. you need to remember that you saw the opening brace in a
> previous line and you find the matching end brace in another line
> below. This gets even difficult because of nested blocks. So you need
> to keep pushing and popping braces.

There are several parser modules on CPAN. Parse::RecDescent is very
flexible but rather slow; Parse::Yapp is a direct clone of yacc, which
it sounds like you're familiar with. The grammar in Inline::CPP is
written with P::RD, and may well be sufficient for your needs.

Ben



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

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


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