[28595] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9959 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 13 03:05:43 2006

Date: Mon, 13 Nov 2006 00:05:08 -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           Mon, 13 Nov 2006     Volume: 10 Number: 9959

Today's topics:
        compare two string and make some operation on it? <moreno@tututico.it>
    Re: count lines,words,punctuations and characters in pe <angel_dsgs@yahoo.com>
    Re: count lines,words,punctuations and characters in pe <tadmc@augustmail.com>
    Re: How to check ? <critterstown@googlemail.com>
    Re: IPC::Open3 xhoster@gmail.com
        MSI file installation <hara.acharya@gmail.com>
        new CPAN modules on Mon Nov 13 2006 (Randal Schwartz)
    Re: open and STDERR <cdalten@gmail.com>
    Re: open and STDERR <eric-amick@comcast.net>
    Re: open and STDERR <joe@inwap.com>
    Re: open and STDERR <cdalten@gmail.com>
    Re: open and STDERR <joe@inwap.com>
    Re: perl threading; ->join; best method? xhoster@gmail.com
    Re: rewrite a printed line <joe@inwap.com>
    Re: SOAP::LITE neil.holmes@zoom.co.uk
        SSH Module: Accessing CLI box using SSH and not getting <deepika.mediratta@gmail.com>
        String Manipulation dao@snakebrook.com
    Re: String Manipulation <wahab@chemie.uni-halle.de>
    Re: String Manipulation <rvtol+news@isolution.nl>
    Re: String Manipulation <someone@example.com>
    Re: String Manipulation <tadmc@augustmail.com>
    Re: Threads and sockets xhoster@gmail.com
    Re: Threads and sockets <m@remove.this.part.rtij.nl>
    Re: Win32::Internet fetch url question <joe@inwap.com>
        Win32::OLE error in thread (ActiveSatate 5.8) on XP <lev.weissman@creo.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 13 Nov 2006 08:44:22 +0100
From: "Tutico" <moreno@tututico.it>
Subject: compare two string and make some operation on it?
Message-Id: <ej97oq$5ep$1@ss408.t-com.hr>

I need to compare two string and make some operation on it?
Boot strings are same size length. In real world they are much longer then
10 characters, lenght of strings (files) is aprox 1 milion characters (1
MB). I need fastest way to compare stings and make result. If I make
comparing character by character and making operatin on string character by
character, computing is to slow to be realy usefull.

Eq.
----------------------------------------------------
# 1234567890
$a= "a...my....";
$b= "..mom....w";
$result="a.momy...w"; # operation is "OK"

but:
# 1234567890
$a= "a...my....";
$b= "..mox....w";
$result="a...my...."; # result is first string $a and operation is "NOK"
----------------------------------------------------

If is problem to use "." as empty character in Perl it is possible to use
some other caracter like "?" , space " " , "*" , "_" , "-" or some other
character.

Please help.
Thanks




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

Date: 12 Nov 2006 17:55:01 -0800
From: "angel" <angel_dsgs@yahoo.com>
Subject: Re: count lines,words,punctuations and characters in perl script
Message-Id: <1163382901.713610.215810@h48g2000cwc.googlegroups.com>

Hey, didle,didle,
> The cat cat and the fiddle,
> The cow jumped over the moon.
> The little dog laughed
> To see such sport,
> And the dish ran away with the spoon.

Output:
lines: 6
words: 30
characters: 154

i did some program but the output is different.

i tried this:

open(READFILE, "Stringtext.txt") || die "couldn't open files:$!";

@_ = <READFILE>;
$_ = join("",@_);
$l_count = tr/\n//;
$w_count = tr/A-Za-z//;
$c_count = tr///cd;
chomp($l_count);
print("lines:" .$l_count,"\n");
chomp($w_count);
print("words:" .$w_count,"\n");
chomp($l_count);
print("characters:" .$c_count,"\n");

close(READFILE);

the output that i got when i run that program is:

Output
lines: 7    #should be 6
words:116   # should be 30
characters:152  # should be 154

i dont know how it turned up that way...i need help..thanks




grocery_stocker wrote:
> angel wrote:
> > hello im a perl beginner. is there anybody who can help me by giving me
> > simple perl script? i need to know on how to count lines, words,
> > punctuations and characters of a pharagraph. pls i really need help
> > thanks a lot. i would really appreciate your help thanks!
>
> Two seconds of google yielded the following:
> 
> http://www.stonehenge.com/merlyn/UnixReview/col02.html



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

Date: Sun, 12 Nov 2006 21:43:22 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: count lines,words,punctuations and characters in perl script
Message-Id: <slrnelfqeq.7lo.tadmc@tadmc30.august.net>

angel <angel_dsgs@yahoo.com> wrote:

> @_ = <READFILE>;
> $_ = join("",@_);


You can replace that code with:

   $_ = do { local $/; <READFILE> };


> $w_count = tr/A-Za-z//;


tr/// works on _characters_, not on "words".

You need a different operator.


> chomp($w_count);


Why do you expect a newline at the end of $w_count's value?

If you don't expect a newline, then why are you trying to remove one?


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


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

Date: Mon, 13 Nov 2006 00:06:44 +0100
From: Richard <critterstown@googlemail.com>
Subject: Re: How to check ?
Message-Id: <ej89jf$h5$1@online.de>

Rakesh schrieb:
> Any body know perl program for Check wether IIS is installed or not ?
> 

I think the easiest is to use sc.exe(:\Windows\system32\sc.exe to check
wheter IISAdmin is registered as a service:

sc.exe query IISAdmin

Will return the state etc. about IISAdmin. If IIS is installed you will
find the service even if it is not in running state.


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

Date: 12 Nov 2006 23:12:31 GMT
From: xhoster@gmail.com
Subject: Re: IPC::Open3
Message-Id: <20061112181450.012$oD@newsreader.com>

ed <ed@noreply.com> wrote:
> is it possible to get the exit status of a program that is started using
> IPC::Open3?
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
> use IPC::Open3;
>
> my $bpid = open3( my $bwr, my $brd, my $ber, "ls -al /fdsfsdfsfs" );
> close($bwr);
> close($brd);
> print( $? );
>
> this should close with exit 2 on my system, but i cannot seem to capture
> the exit code at all.

from the IPC::Open3 doc:

       open3() does not wait for and reap the child process after
       it exits.  Except for short programs where it's acceptable
       to let the operating system take care of this, you need to
       do this yourself.  This is normally as simple as calling
       "waitpid $pid, 0" when you're done with the process.

waitpid will set $?.


Xho

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


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

Date: 12 Nov 2006 20:48:08 -0800
From: "king" <hara.acharya@gmail.com>
Subject: MSI file installation
Message-Id: <1163393288.430984.233060@k70g2000cwa.googlegroups.com>

Hi,

I want to install a *.msi file using perl. If i am installing it
manually it takes some 50 to 55 minutes.

And a lot of user interactions are also there in between the
installation.

So i want to know whether is there any module in perl which i can use
to make this automated or how to start with to install this in the
background using perl.

One idea which I am thinking of is the user interaction things I will
keep on a text file and get the user interaction things being
transfered at the time of instalation.



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

Date: Mon, 13 Nov 2006 05:42:10 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Mon Nov 13 2006
Message-Id: <J8nMIA.1FEs@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Algorithm-Line-Bresenham-0.11
http://search.cpan.org/~osfameron/Algorithm-Line-Bresenham-0.11/
simple pixellated line-drawing algorithm
----
B-Generate-1.06_2
http://search.cpan.org/~mschwern/B-Generate-1.06_2/
Create your own op trees.
----
CGI-Application-Plugin-ProtectCSRF-0.01
http://search.cpan.org/~holly/CGI-Application-Plugin-ProtectCSRF-0.01/
Plug-in protected from CSRF
----
CPAN-Test-Dummy-Perl5-Make-Expect-1.00
http://search.cpan.org/~andk/CPAN-Test-Dummy-Perl5-Make-Expect-1.00/
CPAN Test Dummy
----
Color-Calc-1.01
http://search.cpan.org/~cfaerber/Color-Calc-1.01/
Simple calculations with RGB colors.
----
Convert-Bencode_XS-0.06
http://search.cpan.org/~iwade/Convert-Bencode_XS-0.06/
Faster conversions to/from Bencode format
----
Crypt-Rijndael-0.06_01
http://search.cpan.org/~bdfoy/Crypt-Rijndael-0.06_01/
Crypt::CBC compliant Rijndael encryption module
----
Crypt-Rijndael-0.06_02
http://search.cpan.org/~bdfoy/Crypt-Rijndael-0.06_02/
Crypt::CBC compliant Rijndael encryption module
----
FreeMind-Convert-0.03
http://search.cpan.org/~takeo/FreeMind-Convert-0.03/
FreeMind .mm File Convert to wiki Format
----
HTML-Tree-3.23
http://search.cpan.org/~petek/HTML-Tree-3.23/
overview of HTML::TreeBuilder et al
----
Handel-0.99_15
http://search.cpan.org/~claco/Handel-0.99_15/
A cart/order/checkout framework with AxKit/TT/Catalyst support
----
KinoSearch-0.14
http://search.cpan.org/~creamyg/KinoSearch-0.14/
search engine library
----
Mail-GPG-1.0.5
http://search.cpan.org/~jred/Mail-GPG-1.0.5/
Handling of GnuPG encrypted / signed mails
----
Module-Build-Convert-0.43
http://search.cpan.org/~schubiger/Module-Build-Convert-0.43/
Makefile.PL to Build.PL converter
----
Net-Analysis-0.06
http://search.cpan.org/~worrall/Net-Analysis-0.06/
Modules for analysing network traffic
----
Net-Packet-3.20
http://search.cpan.org/~gomor/Net-Packet-3.20/
a framework to easily send and receive frames from layer 2 to layer 7
----
Net-Packet-Shell-0.10
http://search.cpan.org/~gomor/Net-Packet-Shell-0.10/
Scapy like implementation using Net::Packet, just to prove it
----
PAR-0.959
http://search.cpan.org/~smueller/PAR-0.959/
Perl Archive Toolkit
----
Parse-Win32Registry-0.25
http://search.cpan.org/~jmacfarla/Parse-Win32Registry-0.25/
Parse Windows Registry Files
----
Pod-HtmlEasy-0.08_02
http://search.cpan.org/~gleach/Pod-HtmlEasy-0.08_02/
Generate easy and personalized HTML from PODs, without extra modules and on "the flight".
----
Socialtext-Resting-0.06
http://search.cpan.org/~synedra/Socialtext-Resting-0.06/
module for accessing Socialtext REST APIs
----
Tk-DiffText-0.10
http://search.cpan.org/~mjcarman/Tk-DiffText-0.10/
Perl/Tk composite widget for colorized diffs.
----
Tk-FontDialog-0.12
http://search.cpan.org/~srezic/Tk-FontDialog-0.12/
a font dialog widget for perl/Tk
----
WWW-IndexParser-0.7
http://search.cpan.org/~jeb/WWW-IndexParser-0.7/
Fetch and parse the directory index from a web server
----
WebService-Trynt-PDF-0.01
http://search.cpan.org/~edipreto/WebService-Trynt-PDF-0.01/
Easy Interface for Trynt PDF Web Services
----
Wx-0.61
http://search.cpan.org/~mbarbon/Wx-0.61/
interface to the wxWidgets cross-platform GUI toolkit
----
Wx-Demo-0.04
http://search.cpan.org/~mbarbon/Wx-Demo-0.04/
the wxPerl demo
----
XML-Writer-0.602
http://search.cpan.org/~josephw/XML-Writer-0.602/
Perl extension for writing XML documents.
----
warnings-compat-0.03
http://search.cpan.org/~saper/warnings-compat-0.03/
warnings.pm emulation for pre-5.6 Perls


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: 12 Nov 2006 15:16:08 -0800
From: "grocery_stocker" <cdalten@gmail.com>
Subject: Re: open and STDERR
Message-Id: <1163373368.567739.172310@b28g2000cwb.googlegroups.com>


anno4000@radom.zrz.tu-berlin.de wrote:
> grocery_stocker <cdalten@gmail.com> wrote in comp.lang.perl.misc:
> > "Found in /usr/lib/perl5/5.8.3/pod/perlfaq8.pod
> >        How can I capture STDERR from an external command?
> >
> >        There are three basic ways of running external commands:
> >
> >            system $cmd;                # using system()
> >            $output =3D =E2=80=98$cmd=E2=80=98;           # using backti=
cks (=E2=80=98=E2=80=98)
> >            open (PIPE, "cmd =E2=94=82");       # using open()
> >
> >        With system(), both STDOUT and STDERR will go the same
> >        place as the script=E2=80=99s STDOUT and STDERR, unless the sys=
=C2=AD
> >        tem() command redirects them.  Backticks and open() read
> >        only the STDOUT of your command."
> >
> > If open() reads only to STDOUT, Then how when I do something like the
> > following:
> >
> > #!/usr/bin/perl -w
> >
> > open(STDERR, "whore.txt") or die "Cant: $! \n";
>
> That tries to open "whore.txt" for reading, which fails unless the
> file already exists.
>
> > I get:
> > miss_xtc@linux:~/perl> ./op.pl
> > Cant: No such file or directory
> >
> > Wouldn't this be writing to STDERR in this case?
>
> Why should it?  You have to open the file for writing:
>
>     open STDERR, '>', 'whore.txt' or die "Can't create 'whore.txt': $!";
>
> Anno

If I understand the faq, something like
$output =3D `$cmd`;

Reads only the STDOUT. Where is STDERR going in this case?



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

Date: Sun, 12 Nov 2006 20:30:47 -0500
From: Eric Amick <eric-amick@comcast.net>
Subject: Re: open and STDERR
Message-Id: <m3ifl293o9sl4jdobjhovsis8lntrpiiv3@4ax.com>

On 12 Nov 2006 15:16:08 -0800, "grocery_stocker" <cdalten@gmail.com>
wrote:

>If I understand the faq, something like
>$output = `$cmd`;
>
>Reads only the STDOUT. Where is STDERR going in this case?

Nowhere, i.e., the bit bucket. If you want it to go somewhere, redirect
stderr in the command according to the command shell's conventions. For
example,

$output = `$cmd 2>/some/file/or/other`

on *nix sends stderr to /some/file/or/other. (This is all in perlop.)
-- 
Eric Amick
Columbia, MD


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

Date: Sun, 12 Nov 2006 19:01:28 -0800
From: Joe Smith <joe@inwap.com>
Subject: Re: open and STDERR
Message-Id: <4N-dnXTm0JnAfcrYnZ2dnUVZ_vCdnZ2d@comcast.com>

grocery_stocker wrote:

> If I understand the faq, something like
> $output = `$cmd`;
> 
> Reads only the STDOUT. Where is STDERR going in this case?

STDERR from $cmd goes to the same place that your perl program's
STDERR is going.  Use

   $output = `$cmd 2>&1`;

if you want STDERR to go to the same place as STDOUT.  In that
case, $output will have both, and your program may have to
search for and/or remove the error messages from it.
	-Joe


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

Date: 12 Nov 2006 19:18:01 -0800
From: "grocery_stocker" <cdalten@gmail.com>
Subject: Re: open and STDERR
Message-Id: <1163387881.586867.191910@m7g2000cwm.googlegroups.com>


Joe Smith wrote:
> grocery_stocker wrote:
>
> > If I understand the faq, something like
> > $output = `$cmd`;
> >
> > Reads only the STDOUT. Where is STDERR going in this case?
>
> STDERR from $cmd goes to the same place that your perl program's
> STDERR is going.  Use
>
>    $output = `$cmd 2>&1`;
>
> if you want STDERR to go to the same place as STDOUT.  In that
> case, $output will have both, and your program may have to
> search for and/or remove the error messages from it.
> 	-Joe

Further down the perl faq, they give the following solution
To capture a program's STDOUT, but discard its STDERR:

           use IPC::Open3;
           use File::Spec;
           use Symbol qw(gensym);
           open(NULL, ">", File::Spec->devnull);
           my $pid = open3(gensym, \*PH, ">&NULL", "cmd");
           while( <PH> ) { }
           waitpid($pid, 0);

they don't use
$output = `$cmd 2>&1`;

I'm assuming the solution is perl faq done for portability purposes. I
don't have a Windows box,
otherwise I would I would see if something like

$output = `$cmd 2>&1`;

would have worked in Windows XP



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

Date: Sun, 12 Nov 2006 22:54:59 -0800
From: Joe Smith <joe@inwap.com>
Subject: Re: open and STDERR
Message-Id: <HNidnfDHSceFisXYnZ2dnUVZ_tOdnZ2d@comcast.com>

grocery_stocker wrote:
> don't have a Windows box,
> otherwise I would I would see if something like
> 
> $output = `$cmd 2>&1`;
> 
> would have worked in Windows XP

It does.

C:\>perl -le "$_=`net file 2>&1`;s/\s*$//;print'>>>',$_,'<<<'"
 >>>There are no entries in the list.<<<

	-Joe



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

Date: 12 Nov 2006 23:18:31 GMT
From: xhoster@gmail.com
Subject: Re: perl threading; ->join; best method?
Message-Id: <20061112182050.498$t6@newsreader.com>

Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
>
> > if you read my original post you'll see that I stated that:
> >
> >     $_->join() foreach threads->list();
>
> This assumes that threads->list() returns only joinable threads,

Isn't that exactly what it does?

> and
> that they all return in a suitable order.

From the original post, there was no order dependent code.  So any
order is suitable.

Xho

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


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

Date: Sun, 12 Nov 2006 19:07:04 -0800
From: Joe Smith <joe@inwap.com>
Subject: Re: rewrite a printed line
Message-Id: <RpWdnTfWBb8zfMrYnZ2dnUVZ_rGdnZ2d@comcast.com>

shay.rozen@gmail.com wrote:

> My question is can i go up my output on the screen, like print a line,
> and then go with the "curser" back to this line and rewrite it by
> another print.

I use this statement in the middle of a loop:

   print "Estimated $total in $count files\r" if ++$count % 1000 == 0;

	-Joe


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

Date: 12 Nov 2006 22:48:02 -0800
From: neil.holmes@zoom.co.uk
Subject: Re: SOAP::LITE
Message-Id: <1163400482.559429.310350@m73g2000cwd.googlegroups.com>

Thanks for this. I have 0.60 on both Windows and Linux.

I have added debug to my script :-

#!perl -w
  use SOAP::Lite +trace =>
  qw(debug);
  print SOAP::Lite
    -> service('http://neilvmes3:8082/ws/EcsAddEntry?wsdl')
    -> TK_ADD_ENTRY("Neil Holmes",'Greatest
Hits','CD','9.99','www.proiv.com');

And the output is as follows :-

SOAP::Transport::HTTP::Client::send_receive: POST
http://neilvmes3:8082/ws/EcsAddEntry HTTP/1.1
Accept: text/xml
Accept: multipart/*
Content-Length: 679
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://neilvmes3:8082/ws/EcsAddEntry"

<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><TK_ADD_ENTRY
xmlns=""><parameters>Neil Holmes</parameters><c-gensym4
xsi:type="xsd:string">Greatest Hits</c-gensym4><c-gensym6
xsi:type="xsd:string">CD</c-gensym6><c-gensym8
xsi:type="xsd:float">9.99</c-gensym8><c-gensym10
xsi:type="xsd:string">www.proiv.com</c-gensym10></TK_ADD_ENTRY></SOAP-ENV:Body></SOAP-ENV:Envelope>
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK
Connection: close
Date: Mon, 13 Nov 2006 06:25:56 GMT
Server: Jetty/5.1.10 (Linux/2.4.21-4.EL i386 java/1.5.0_03
Content-Length: 413
Content-Type: text/xml; charset=utf-8
Client-Date: Mon, 13 Nov 2006 06:25:56 GMT
Client-Response-Num: 1
SOAPAction: ""

<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Client</faultcode><faultstring>Error
identifying Web Service: class
com.northgateis.proiv.ws.servlet.WebServiceIdentificationException:
Parameter ARTIST had 0 entry in the message part.  Expecting
1.</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>

This seems to be telling me that there is no value in the Parameter
(the first value in the Method). How can this be ? I am particularly
puzzled as there clearly is on Windows.

Your advise is much appreciated.

Many Thanks

Neil



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

Date: 12 Nov 2006 20:44:58 -0800
From: "Deepika" <deepika.mediratta@gmail.com>
Subject: SSH Module: Accessing CLI box using SSH and not getting the return output??
Message-Id: <1163393098.032614.49030@h48g2000cwc.googlegroups.com>

Hi Everyone,

I am trying to write a perl code to access and run few commands on a
Secure CLI-Box using SSH module in Perl.After installing the Perl
module with a lot of difficulty I am facing the following issue. I am
able to log-into the box but I don't get any results back for the
commands I am trying to run on the box.
If I use the same perl code to log-into another linux machine and do
an"ls" I get the result back with no problems at all. Here is the debug
message while trying to access the CLI-box and running the commands.

Any Help will be really appreciated. I have been struck at the same
issue for about a month and my code is due soon and I have no clue how
to fix it.

[root@deepika-linux ~]# cd rnc
[root@deepika-linux rnc]# perl ss.pl
deepika-linux: Reading configuration data /root/.ssh/config
deepika-linux: Reading configuration data /etc/ssh_config
deepika-linux: Allocated local port 1023.
deepika-linux: Connecting to xx.xx.xx.xx, port 22.
deepika-linux: Remote version string: SSH-2.0-OpenSSH_3.5p1

deepika-linux: Remote protocol version 2.0, remote software version
OpenSSH_3.5p1
deepika-linux: Net::SSH::Perl Version 1.30, protocol version 2.0.
deepika-linux: No compat match: OpenSSH_3.5p1.
deepika-linux: Connection established.
deepika-linux: Sent key-exchange init (KEXINIT), wait response.
deepika-linux: Algorithms, c->s: 3des-cbc hmac-sha1 none
deepika-linux: Algorithms, s->c: 3des-cbc hmac-sha1 none
deepika-linux: Entering Diffie-Hellman Group 1 key exchange.
deepika-linux: Sent DH public key, waiting for reply.
deepika-linux: Received host key, type 'ssh-dss'.
deepika-linux: Host 'xx.xx.xx.xx' is known and matches the host key.
deepika-linux: Computing shared secret key.
deepika-linux: Verifying server signature.
deepika-linux: Waiting for NEWKEYS message.
deepika-linux: Enabling incoming encryption/MAC/compression.
deepika-linux: Send NEWKEYS, enable outgoing
encryption/MAC/compression.
deepika-linux: Sending request for user-authentication service.
deepika-linux: Service accepted: ssh-userauth.
deepika-linux: Trying empty user-authentication request.
deepika-linux: Authentication methods that can continue: password.
deepika-linux: Next method to try is password.
deepika-linux: Trying password authentication.

 value of stdout = 1

 value of stderr =

 value of exitt =
deepika-linux: channel 0: new [client-session]
deepika-linux: Requesting channel_open for channel 0.
deepika-linux: Entering interactive session.
deepika-linux: Sending command: ?
deepika-linux: Requesting service exec on channel 0.
deepika-linux: channel 0: open confirm rwindow 0 rmax 32768

 value of stdout =
value of stderr =
value of exitt =
[root@deepika-linux rnc]#

Thanks and will wait for the response.



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

Date: 12 Nov 2006 15:16:27 -0800
From: dao@snakebrook.com
Subject: String Manipulation
Message-Id: <1163373387.169855.173300@b28g2000cwb.googlegroups.com>



Hi, I am kina a perl-newbie and have both the learning perl book an the
programming perl book, but can't find the information I'm looking for
in either of them. What I need to do is as follows:

I have a string:     AaaSmmmRiiiW

And I need to recognize te capital letters and turn the string into the
following: Aaa Smmm Riii W

Basically, every Capital needs to be preceeded by a space. I can't
figure out how to do it in perl.

I lloked at the FAQ at perl.org and came up empty there as well. I know
it can be done, I just can't figure it out.

Any help appreciated.


Thanks, Jack



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

Date: Mon, 13 Nov 2006 00:47:50 +0100
From: Mirco Wahab <wahab@chemie.uni-halle.de>
Subject: Re: String Manipulation
Message-Id: <ej8dau$6gc$1@mlucom4.urz.uni-halle.de>

Thus spoke dao@snakebrook.com (on 2006-11-13 00:16):
> I have a string:     AaaSmmmRiiiW
> 
> And I need to recognize te capital letters and turn the string into the
> following: Aaa Smmm Riii W
> 
> Basically, every Capital needs to be preceeded by a space. I can't
> figure out how to do it in perl.

You could use a regular expression substitution:

   my $str = 'AaaSmmmRiiiW';

   $str =~ s/(?<!^)([A-Z])/ $1/g;

which uses a 'negative lookbehind assertion'
=> (?<! ) on a 'line begin' => ^
and then simply substitutes an uppercase [A-Z]
by a space and the same (captured) character.

The 'negative lookbehind' mainly doesn't allow
a space on the begin of a string (before the
very first character).

In your example above, a 'negated word boundary' \B
would have the same effect:

   $str =~ s/\B([A-Z])/ $1/g;

What you have to exactly depends on what
your "real data" looks like ...



Regards

Mirco


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

Date: Mon, 13 Nov 2006 01:50:00 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: String Manipulation
Message-Id: <ej8j89.1ok.1@news.isolution.nl>

Mirco Wahab schreef:
> dao:

>> I have a string:     AaaSmmmRiiiW
>> 
>> And I need to recognize te capital letters and turn the string into
>> the following: Aaa Smmm Riii W
>> 
>> Basically, every Capital needs to be preceeded by a space. I can't
>> figure out how to do it in perl.
> 
> 
> You could use a regular expression substitution:
> 
>    my $str = 'AaaSmmmRiiiW';
> 
>    $str =~ s/(?<!^)([A-Z])/ $1/g;

Variant without capturing:

perl -wle'
    $_="AaaSmmmRiiiW";

    s/(?<!^)(?=[A-Z])/ /g;

    print
'

-- 
Affijn, Ruud

"Gewoon is een tijger."


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

Date: Mon, 13 Nov 2006 01:38:32 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: String Manipulation
Message-Id: <s0Q5h.2672$_Z2.1582@edtnps89>

dao@snakebrook.com wrote:
> 
> Hi, I am kina a perl-newbie and have both the learning perl book an the
> programming perl book, but can't find the information I'm looking for
> in either of them. What I need to do is as follows:
> 
> I have a string:     AaaSmmmRiiiW
> 
> And I need to recognize te capital letters and turn the string into the
> following: Aaa Smmm Riii W
> 
> Basically, every Capital needs to be preceeded by a space. I can't
> figure out how to do it in perl.
> 
> I lloked at the FAQ at perl.org and came up empty there as well. I know
> it can be done, I just can't figure it out.
> 
> Any help appreciated.

$ perl -le'$_ = q[AaaSmmmRiiiW]; print; s/(?=[[:upper:]])(?!\A)/ /g; print;'
AaaSmmmRiiiW
Aaa Smmm Riii W




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: Sun, 12 Nov 2006 21:31:12 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: String Manipulation
Message-Id: <slrnelfpo0.7lo.tadmc@tadmc30.august.net>

dao@snakebrook.com <dao@snakebrook.com> wrote:

> I have a string:     AaaSmmmRiiiW
>
> And I need to recognize te capital letters and turn the string into the
> following: Aaa Smmm Riii W
>
> Basically, every Capital needs to be preceeded by a space. 


Or, every run of lower case chars need to be succeeded by a space:


   s/([a-z]+)/$1 /g;


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


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

Date: 12 Nov 2006 23:38:29 GMT
From: xhoster@gmail.com
Subject: Re: Threads and sockets
Message-Id: <20061112184047.910$yS@newsreader.com>

Martijn Lievaart <m@remove.this.part.rtij.nl> wrote:
> Hi,
>
> Sorry, no code. Normally I just code something up and work it out from
> there. I want to get a grasp on the basic concepts before starting to
> code for this one.
>
> I've written a small server that listens for UDP packets or TCP
> connections, computes an answer and returns the result. The trouble is
> that computing the answer may be almost instantanious, or may take
> several seconds.

Do you know which ahead of time?  If so, I would just answer directly if it
is instantaneous and fork if it is not, rather than using threads
(assuming linux or similar system).

> I want to make the server concurrent by using ithreads,
> creating n threads and distributing the requests over the threads using
> Threads::Queue. The thread itself should send back the result to the
> client.

Why not just use another Thread::Queue to put the answer in, and have the
main thread send all the responses?

> Now I understand the basics of :shared. I just cannot wrap this around to
> sockets.
>
> For TCP: Can I just enqueue a socket and use it in the thread that
> dequeues it?

I don't think so.  You can't enqueue objects.  You could enqueue some kind
of index or key that could be used to point to the socket residing in some
other variable.

> Or should the socket be marked shared?

I get an error message "Cannot share globs yet" when I try.

> Or will this not work
> at all? Or depending on the OS (I'm using Linux).

In my experience on linux, file handles (including sockets) don't need to
be shared.  When you create a new thread, a new Perl variable is created
for the handle, but it points to the same underlying C/OS structure as the
old one, so the socket is implicitly shared by all threads which are
"downstream" from the thread that initiated the socket.  You may need to
create a shared (and hence lockable) sentinel variable to control access to
the real socket, if such serialized control is necessary.

>
> What would be an appropriate model for UDP? I probably can just create a
> UDP socket per thread and use that to send the answer,

To the extent that that would work in unthreaded code, I don't see why it
would stop working in threaded code.

Xho

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


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

Date: Mon, 13 Nov 2006 08:18:49 +0100
From: Martijn Lievaart <m@remove.this.part.rtij.nl>
Subject: Re: Threads and sockets
Message-Id: <pan.2006.11.13.07.18.48.870816@remove.this.part.rtij.nl>

On Sun, 12 Nov 2006 23:38:29 +0000, xhoster wrote:

>> I've written a small server that listens for UDP packets or TCP
>> connections, computes an answer and returns the result. The trouble is
>> that computing the answer may be almost instantanious, or may take
>> several seconds.
> 
> Do you know which ahead of time?  If so, I would just answer directly if it
> is instantaneous and fork if it is not, rather than using threads
> (assuming linux or similar system).

No I don't. Otherwise there would be no problem.

>> I want to make the server concurrent by using ithreads,
>> creating n threads and distributing the requests over the threads using
>> Threads::Queue. The thread itself should send back the result to the
>> client.
> 
> Why not just use another Thread::Queue to put the answer in, and have the
> main thread send all the responses?

Because I don't see how I can both select() and dequeue() in the main
thread. Or do you see another solution?

I thought of another solution. I could use fork instead of threads and
communicate over sockets or pipes. That way I can simply use select in the
main thread to get both new requests and answers.

This has another advantage. It makes signal handling much simpler. I think
signals and threads cannot be used (simple) together so this is probably a
better solution overall.

The problem here is that I also want some kind of caching, that is why I
looked at threads in the first place. Oh well, I can use an on disk cache
as well.

>> Now I understand the basics of :shared. I just cannot wrap this around to
>> sockets.
>>
>> For TCP: Can I just enqueue a socket and use it in the thread that
>> dequeues it?
> 
> I don't think so.  You can't enqueue objects.  You could enqueue some kind

I could not find that in the docs, do you have a pointer?

> of index or key that could be used to point to the socket residing in some
> other variable.

Yes. Of course. Slaps forehead.

>> Or will this not work
>> at all? Or depending on the OS (I'm using Linux).
> 
> In my experience on linux, file handles (including sockets) don't need to
> be shared.  When you create a new thread, a new Perl variable is created
> for the handle, but it points to the same underlying C/OS structure as the
> old one, so the socket is implicitly shared by all threads which are
> "downstream" from the thread that initiated the socket.  You may need to
> create a shared (and hence lockable) sentinel variable to control access to
> the real socket, if such serialized control is necessary.

Slaps forehead again. Of course. I should not have searched the perl docs
but the Linux docs.
 
>> What would be an appropriate model for UDP? I probably can just create
>> a UDP socket per thread and use that to send the answer,
> 
> To the extent that that would work in unthreaded code, I don't see why
> it would stop working in threaded code.

Slaps forehead yet again.

Thanks. This makes it much clearer.

M4
-- 
Redundancy is a great way to introduce more single points of failure.



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

Date: Sun, 12 Nov 2006 23:10:46 -0800
From: Joe Smith <joe@inwap.com>
Subject: Re: Win32::Internet fetch url question
Message-Id: <ZPGdnavPfJ5Qh8XYnZ2dnUVZ_u2dnZ2d@comcast.com>

EL34 wrote:

> All I was asking for was a working example, nothing more.

The reply dated 11/10/2006 12:59 PM did have a link
to a working example, so there was no need for obscenities.

> RTFM is not what I was asking for in my original post.

However, if TFM has the exact answer to the question, then
referring to it is appropriate.


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

Date: 12 Nov 2006 23:29:12 -0800
From: "MoshiachNow" <lev.weissman@creo.com>
Subject: Win32::OLE error in thread (ActiveSatate 5.8) on XP
Message-Id: <1163402952.294252.274780@m7g2000cwm.googlegroups.com>

HI,

The code is :
$thr = threads->new(\&THREAD,"$computer");
sub THREAD {
		use Win32::OLE qw( in with );
		my $computer=shift;
		$objWMIService =
Win32::OLE->GetObject("winmgmts:\\\\$computer\\root\\CIMV2") ||
&disp("WMI connection failed.\n",'RED');
   		$colItems = $objWMIService->ExecQuery("SELECT * FROM
Win32_Product", "WQL",
                  wbemFlagReturnImmediately | wbemFlagForwardOnly);
}
$thr->join();



The error is :

Win32::OLE(0.1703) error 0x800401e4: "Invalid syntax"
    after character 0 in "winmgmts:\\26842CILXP\root\CIMV2" at
D:\DOcuments\Ripro\AIX\mysc
ripts\pod_check.pl line 977
        eval {...} called at
D:\DOcuments\Ripro\AIX\myscripts\pod_check.pl line 977
        main::THREAD('26842CILXP') called at
D:\DOcuments\Ripro\AIX\myscripts\pod_check.pl
 line 973
        eval {...} called at
D:\DOcuments\Ripro\AIX\myscripts\pod_check.pl line 973 (#12)
Win32::OLE(0.1703) error 0x800401e4: "Invalid syntax"

Appreciate ideas.
Thanks



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

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


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