[24589] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6765 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jul 4 18:05:47 2004

Date: Sun, 4 Jul 2004 15:05:04 -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           Sun, 4 Jul 2004     Volume: 10 Number: 6765

Today's topics:
    Re: access ARP table in Win32 <Petri_member@newsguy.com>
    Re: My 1st question about locking (and other related is <bik.mido@tiscalinet.it>
    Re: Newbie: How do I  filter output to the screen and w (Mav)
    Re: Newbie: How do I  filter output to the screen and w <noreply@gunnar.cc>
    Re: remove carriage returns <atp5470 at fsu.edu>
    Re: Search using a variable in a Perl Script (Philip Scobie)
    Re: Search using a variable in a Perl Script <noreply@gunnar.cc>
    Re: Search using a variable in a Perl Script <gnari@simnet.is>
    Re: sending docs attached with Perl <nospam@bigpond.com>
    Re: tern an hebrew string into unicode (dana livni)
    Re: which book to learn Perl (Anno Siegel)
    Re: which book to learn Perl <lawshouse.public@btconnect.com>
    Re: which book to learn Perl <sean@sfsullivan.org>
    Re: Why is $ENV{COLUMNS} undefined inside the Perl prog <a24061@yahoo.munged>
    Re: win32::job window attributes (Cameron)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 3 Jul 2004 18:47:03 -0700
From: Petri <Petri_member@newsguy.com>
Subject: Re: access ARP table in Win32
Message-Id: <cc7nin01fft@drn.newsguy.com>

In article <ntIFc.3467$w56.509@bignews1.bellsouth.net>, perl coder says...
> I found stuff about a GetIpNetTable system call that doesn't work
> in Win95 or WinNT before sevice pack 4.

Tell me you aren't developing for those ancient platforms...

> Well at least I don't have to parse the registry. :-) :-) :-)

Why not, that would be an easy solution at this stage.

>>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iphlp/iphlp/getipnettable.asp

> Thanks.  But how come when I follow this URL with Lynx,
> Microsoft decides to hijack my browser and take me to this
> place instead: 

Why lynx if you are developing on Windows anyway?

If you really can't catch any output with backticks, then maybe you should
consider dumping the output of arp -a into a file and then opening that file in
your application?
Something like (untested):
---8<---
use strict;
use warnings;
system('arp -a > %temp%/arp.txt');
open my $arp, '<', "$ENV{TEMP}/arp.txt" or die "Can't open '$ENV{TEMP}/arp.txt':
$!";
---8<---

Unless system() doesn't work at all for you, of course.


Petri



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

Date: Sun, 04 Jul 2004 20:20:50 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: My 1st question about locking (and other related issues)
Message-Id: <kvrfe0p8faragddekgk0lt2jnfheli0oq9@4ax.com>

On 03 Jul 2004 16:22:25 -0500, Dale Henderson <nilram@hotpop.com>
wrote:

>    MD> Well, I think that *if* I have a duplicate processes
>    MD> prevention mechanism *and* if it continues until the shell it
>    MD> was started from is exited, *then* that shell will be "the
>    MD> last to be exited".
>
>     I don't follow this. Consider: 
>
>     Shell 1 starts (daemon starts)
>
>     Shell 2 starts
>     
>     Shell 1 exits (daemon stops)
>
>     Shell 2 exits
>
>     So the daemon stops with shell 1 but shell 2 is the last to exit.

Uh-Oh!!! Was I missing something hugely obvious? Yes, definitely I
was...


Michele
-- 
you'll see that it shouldn't be so. AND, the writting as usuall is
fantastic incompetent. To illustrate, i quote:
- Xah Lee trolling on clpmisc,
  "perl bug File::Basename and Perl's nature"


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

Date: 4 Jul 2004 00:47:58 -0700
From: mluvw47@yahoo.com (Mav)
Subject: Re: Newbie: How do I  filter output to the screen and writing the orginal output to a file?
Message-Id: <dfaafecd.0407032347.29749ff0@posting.google.com>

First of all, I thank for so many people reply my post. However, I
still didn't get my progam working. I think it is because I didn't
explain it correctly.
I will try on this mail:

On my perl script, I would like to execute the command:
@args = ("\"$devPath\\devenv.com\" Solution\\my.sln /build Release");
This is an Vs.net command that allow user to build the solution(my
solution) from the console. Once this command got execute, the output
will print on the SCREEN like:
 --Build Item A
 compiling a1.cpp
 compiling a2.cpp
 compiling a3.cpp

 ...
 --Build Item B
 compiling b1.cpp
 compiling b2.cpp
 compiling b3.cpp
 ...
 --Build Item C
 compiling c1.cpp
 ..
However, I don't want all the detail got print on the screen, I want
only key main being print on the SCREEN like,:

 --Build Item A
 --Build Item B
 --Build Item C

But still keep the orignal format in the a log FILE (build.log) which
will contians the
 --Build Item A
 compiling a1.cpp
 compiling a2.cpp
 compiling a3.cpp

 ...
 --Build Item B
 compiling b1.cpp
 compiling b2.cpp
 compiling b3.cpp
 ...
 --Build Item C
 compiling c1.cpp
 ..

Is that possible to do?

Thanks,
Mav


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

Date: Sun, 04 Jul 2004 10:37:51 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Newbie: How do I  filter output to the screen and writing the orginal output to a file?
Message-Id: <2kptuuF4g3bdU1@uni-berlin.de>

Mav wrote:
> I still didn't get my progam working. I think it is because I
> didn't explain it correctly.

Or you did not listen to the advices you got. ;-)

> On my perl script, I would like to execute the command:
> @args =
> ("\"$devPath\\devenv.com\" Solution\\my.sln /build Release");
> This is an Vs.net command that allow user to build the solution(my 
> solution) from the console. Once this command got execute, the
> output will print on the SCREEN like:
>  --Build Item A
>  compiling a1.cpp
>  compiling a2.cpp
>  compiling a3.cpp

<snip>

> However, I don't want all the detail got print on the screen, I
> want only key main being print on the SCREEN like,:
> 
>  --Build Item A
>  --Build Item B
>  --Build Item C
> 
> But still keep the orignal format in the a log FILE (build.log)

You may want to try something like this:

     my $output = qx(@args);
     open LOG, '>> build.log' or die $!;
     print LOG $output;
     close LOG;
     print "$1\n" while $output =~ /^(\s*--.+)/gm;

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


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

Date: Sat, 3 Jul 2004 21:55:20 -0500
From: "Andrew Palmer" <atp5470 at fsu.edu>
Subject: Re: remove carriage returns
Message-Id: <10ees8hjbi8ee0f@corp.supernews.com>


"norfernuman" <norfernuman@yahoo.com> wrote in message
news:wSXEc.82398$BP.24934@newssvr29.news.prodigy.com...
> I am trying to remove carriage returns ( and more ) from each element of
an array before
> using them to create a record for a text file. Somehow I sill keep missing
> one once in a while and a carriage return occurs in the middle of an order
record.
>
> Here is what I'm doing now.
>
> -------------
> open(FILE, ">$dump_file") or die("Couldn't open $dump_file for writing:
$!");
> while (@ary = $sth->fetchrow_array ()) {
>       for (@ary) {
>            s/\t+//g;
>            s/\r+|\n+//g;
>       }
>      print FILE (join ("\t", @ary), "\r\n");

You probably want either just "\n" or possibly "\015\012"
See perlport

> }
> close (FILE);
> ----------------
>
> Thanks,
>
> - NN




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

Date: 4 Jul 2004 01:22:18 -0700
From: philipscobie@hotmail.com (Philip Scobie)
Subject: Re: Search using a variable in a Perl Script
Message-Id: <d2c030d8.0407040022.54c96756@posting.google.com>

Okay, my code is a sloppy (I was showing the relevant bits)...my bad!

But, it works if I put a non-variable in the search parameter:


if(/\./){       <- picks up ALL the entries because it matches the "."

so why, when I put in a variable, does it match nothing.


if (/$value/){   <-picks up nothing

Again, apologies for the sloppy code.


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

Date: Sun, 04 Jul 2004 10:43:26 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Search using a variable in a Perl Script
Message-Id: <2kpu9dF4tfssU1@uni-berlin.de>

Philip Scobie wrote:
> it works if I put a non-variable in the search parameter:
> 
> if(/\./){   <- picks up ALL the entries because it matches the "."
> 
> so why, when I put in a variable, does it match nothing.
> 
> if (/$value/){   <-picks up nothing

Maybe because $value does not contain what you think it does? Have you 
tried

     print $value;

in order to check that?

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


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

Date: Sun, 4 Jul 2004 09:23:25 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: Search using a variable in a Perl Script
Message-Id: <cc8i7f$hab$1@news.simnet.is>

"Philip Scobie" <philipscobie@hotmail.com> wrote in message
news:d2c030d8.0407040022.54c96756@posting.google.com...
> Okay, my code is a sloppy (I was showing the relevant bits)...my bad!

remember, if you post sloppy code where there has been no
effort made to prove that the problem is what you claim it
to be , everyone will just assume that you are an idiot
and that you untested open is to blame.

>
> But, it works if I put a non-variable in the search parameter:
>
>
> if(/\./){       <- picks up ALL the entries because it matches the "."
>
> so why, when I put in a variable, does it match nothing.

we have no proof this variable contains what you claim.
to prove that this is indeed the problem, add this:
    $value='Perl';
just before the 'if (/$value/) {' line

you you still have problems, add a bunch of debugging
prints inside your loop, showing all relevant values
($value,$_ and the result of your test)

my guess is that $value does not contain 'Perl'

gnari






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

Date: Sun, 04 Jul 2004 11:58:00 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: sending docs attached with Perl
Message-Id: <1561035.BF61BtzJjo@GMT-hosting-and-pickle-farming>

Deen wrote:

> Hi!
> 
> I'm desperately seeking for a Perl script to send a message
> with attached documents.
> 
> Thanks for help.

http://gregorytoomey.com/index.php?option=content&task=view&id=8&Itemid=28

gtoomey


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

Date: 4 Jul 2004 02:41:22 -0700
From: dana_livni@hotmail.com (dana livni)
Subject: Re: tern an hebrew string into unicode
Message-Id: <1596f85c.0407040141.47d127d7@posting.google.com>

i'm not sure i understood your answer.

what i want to do?
i want to create a uri.
it sould look like the uri of google or vivisimo.
when you enters one of those sites and search for a word in hebrow or
any other languge both sites tern every charecter in it to an
exprision in this pattern:
%xx%xx. the first pear seam to mark the languge (in hebrow d7) and the
second the spasific letter.

i want to find a way to do the same.
i hope now it is clear enougth.


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

Date: 4 Jul 2004 11:05:14 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: which book to learn Perl
Message-Id: <cc8o9a$p0q$1@mamenchi.zrz.TU-Berlin.DE>

krakle <krakle@visto.com> wrote in comp.lang.perl.misc:

> Randal Schwartz blah..

Thank you for that insightful comment.

Anno


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

Date: Sun, 04 Jul 2004 16:14:01 +0100
From: Henry Law <lawshouse.public@btconnect.com>
Subject: Re: which book to learn Perl
Message-Id: <cd7ge0hjtmu169a4685q7kltc2r6tb517j@4ax.com>

On 4 Jul 2004 11:05:14 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
Siegel) wrote:

>krakle <krakle@visto.com> wrote in comp.lang.perl.misc:
>
>> Randal Schwartz blah..
>
>Thank you for that insightful comment.

Oh, Anno; you've let me down.  

I'd composed a reply to this something along the lines of 

  "And just what do you mean by that, sonny?  Judging by 
  your previous posting record on here, Randal has 
  forgotten more about coding in general and Perl in 
  particular than you'll ever learn."   

Then I thought "No, Anno or Uri or somebody will compose a better
reply than that" and I cancelled it. 

Henry Law       <><     Manchester, England 


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

Date: Sun, 04 Jul 2004 21:07:58 GMT
From: Sean Sullivan <sean@sfsullivan.org>
Subject: Re: which book to learn Perl
Message-Id: <Ok_Fc.17994$MT5.3411@nwrdny01.gnilink.net>

danny_isr wrote:

> 
> Hi i'm new to Perl.
> someone gave me the "Learning Perl" book from O`reilly.
> but i will have to get my own soon.
> i saw that there is another book (with the camel)"Programming Perl" . what
> the difference between them ?
> which is better for a beginner and beyond.
> i saw there the cook book as well ...
> 
> or maybe there are other out there ?
> 
> 
> Thanks Danny

An excellent book for beginners that I haven't seen mention of yet, is
Beginning Perl (Simon Cozens). The Llama book is fine if you have some
programming skills to begin with, but might be a little discouraging
otherwise. Beginning Perl is available online here:
http://learn.perl.org/library/beginning_perl/

Sean


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

Date: Sun, 04 Jul 2004 18:57:57 GMT
From: Adam <a24061@yahoo.munged>
Subject: Re: Why is $ENV{COLUMNS} undefined inside the Perl program?
Message-Id: <VqYFc.3947$mD6.33515737@news-text.cableinet.net>

On Monday 28 June 2004 13:38, Adam wrote:

> I think this will do what I need.
> 
>            use Term::ReadKey;
>            ($wchar, $hchar, $wpixels, $hpixels) = GetTerminalSize();

And indeed it does.  The only problem is that if the program is run
non-interactively (e.g. from at or cron) it halts with an error here. 
I assume there is no way to catch the error?

I'm now using the I_am_interactive subroutine from the Perl Cookbook
first and calling GetTerminalSize() only if the program seems to be
interactive -- is this the best way to handle this situation?

-- 
Thanks,
Adam


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

Date: 4 Jul 2004 12:45:41 -0700
From: cam@ntwk.net (Cameron)
Subject: Re: win32::job window attributes
Message-Id: <e4dad21a.0407041145.6b703bea@posting.google.com>

"MrReallyVeryNice" <MrReallyVeryNice.NOVIRUS@NoSpam.yahoo.com> wrote in message news:<2LidnU4-VY1iz3rdRVn-jw@comcast.com>...
> Hello again,
> 
> In addition to trying SendKeys as suggested by Petri, you might also
> validate if your application (Link32.exe) has not been built/compiled with
> the wrong switch. In which case no matter what you try, you will not be able
> to minimize/hide it.
> 
> In the spirit of helping you debugging this problem, and certainly not
> trying to drive you away from Perl, I would suggest that you take a look at:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/pla
> tform/shell/reference/objects/ishelldispatch2/shellexecute.asp. If you
> create a small VBScript, you will have a second data point. If you are
> successful with a VBScript then you can decide to debug Win32::Job or try to
> find another Perl module.
> 
> Here is a little untested sample program with Link32:
> === Beginning Script ===
> Option Explicit
> fnShellExecuteVB()
> 
> function fnShellExecuteVB()
>     dim objShell
>     set objShell = CreateObject("Shell.Application")
>     objShell.ShellExecute "Link32.exe", "", "D:\Link32", "open", 2
>     set objShell = nothing
> end function
> === End Script ===
> 
> As earlier, please report your failures/successes.
> MrReallyVeryNice


Thanks to both of you ..... what I finally decoded to do was to
execute the
wIntegrate scripting command "Session Show 3" as soon as the app opens
which basically accomplishes the same thing. I'm a bit disapointed
that I couldn't do it with Perl, but I can waste too much time on it.

Cheers,

Cameron


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

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


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