RE: Regular expression for an IPv4 address

2002-01-16 Thread Bullock, Howard A.

I am sure one of the experts can make these two regex lines into one, but
here it is..
$z = '001.022.003.040';
print "$z\n";
$z =~ s/^0+//;
$z =~ s/\.0+/\./g;
print "$z\n";
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



RE: Regular expression for an IPv4 address

2002-01-16 Thread "Brož Jiří, Ing."

Try for example
$ip = join '.',map {int} split /\./,$oldip;
or (if you resist on a regular expression)
$oldip =~ s/(?:^0+|(\.)0+([1-9]+)|(\.0)00)/$1.$2 || $3/eg;
JB


-Original Message-
From: CARPENTER,STEPHEN (HP-Corvallis,ex1)
[mailto:[EMAIL PROTECTED]] 
Sent: Thursday, January 17, 2002 1:25 AM
To: '[EMAIL PROTECTED]'
Subject: Regular expression for an IPv4 address

Hi,
I'm a beginner with Perl and I'm sure this has been done before:
I
would like to take a string like this '001.202.033.400' and turn it into
'1.202.33.400'. In other words, strip leading zeros from each octet of
an IP
address. I could just split each piece into a different variable, do it,
and
then recombine, but is seems like a one line regular expression could
work
here instead. Thanks to all who reply!

StephenC.
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



RE: Regular expression for an IPv4 address

2002-01-16 Thread Thiebaud Richard

The following:

use strict;
sub try1;
try1 "001.001.001.001";
try1 "1.1.101.1";
try1 "002.2.102.001";
exit(0);

sub try1{
my $str = shift;
my $str2 = $str;
$str2 =~ s/(^|\.)(0*)(\d*)/$1$3/go;
print "in: '$str' out: '$str2'\n";
}

gives:

C:\TEMP>c:\temp\t1.pl
in: '001.001.001.001' out: '1.1.1.1'
in: '1.1.101.1' out: '1.1.101.1'
in: '002.2.102.001' out: '2.2.102.1'

> -Original Message-
> From: CARPENTER,STEPHEN (HP-Corvallis,ex1)
> [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 16, 2002 7:25 PM
> To: '[EMAIL PROTECTED]'
> Subject: Regular expression for an IPv4 address
> 
> 
> Hi,
>   I'm a beginner with Perl and I'm sure this has been 
> done before: I
> would like to take a string like this '001.202.033.400' and 
> turn it into
> '1.202.33.400'. In other words, strip leading zeros from each 
> octet of an IP
> address. I could just split each piece into a different 
> variable, do it, and
> then recombine, but is seems like a one line regular 
> expression could work
> here instead. Thanks to all who reply!
> 
> StephenC.
> ___
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
> 
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Regular expression for an IPv4 address

2002-01-16 Thread CARPENTER,STEPHEN (HP-Corvallis,ex1)

Hi,
I'm a beginner with Perl and I'm sure this has been done before: I
would like to take a string like this '001.202.033.400' and turn it into
'1.202.33.400'. In other words, strip leading zeros from each octet of an IP
address. I could just split each piece into a different variable, do it, and
then recombine, but is seems like a one line regular expression could work
here instead. Thanks to all who reply!

StephenC.
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Perl talking to VSlick

2002-01-16 Thread Jeffrey

I have a script which needs to determine the class of
a number of variables.  I have a VSlick tag file which
contains the information.  Does anyone know of a way
to either A) export the tag file to searchable text
(it's a binary file) or B) open some sort of interface
(a la OLE style) to talk to VSlick?  It is conceivable
that I search through all of the .h files for the
project, but there are a LOT of files.  Large project.

I've already searched CPAN for vslick, with no luck.

TIA

=

Jeffrey Hottle
nkuvu at yahoo dot com

__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



RE: .CHM Help File Available for Build 631? And Index?

2002-01-16 Thread Capacio, Paula J

user2048 wrote:

>(from a list newbie:)
>
>Does anybody know -
>
>Is a .chm help file available for build 631, like there was for build
630?
>
>And how about an index file, for either? Hopefully including entries
for 
>the Perl built-in functions, at least.
>
>Personally, I like having both the HTML help files, and the .chm
compiled 
>help. I find the .chm search capability very useful.
>
>Thanks for your help.
>
>

Roger Perttu [[EMAIL PROTECTED]]  wrote:
>I have no solution for the above but more questions.
>
>Is there a solution planned for downloaded (PPM) modules? The old HTML 
>docs was automatically updated.

I don't know the current direction either. I like both/see advantages in
each.  

As Roger said, downloaded PPM modules don't update the .chm, they
create/update the html doc/index.  When I use CPAN modules with
ActivePerl the instructions have you copy the mods/docs into the file
structures. Therefore the best way to get info about those modules is to
look at the pod doc.  

A few months ago, someone from this group (don't remember who) sent an
item with a script that traverses the Perl directory looking for pod
doc, converts it to html, and then updates the index. 

I think that's pretty nifty and would like to say THANK YOU.
The script is below(beware text wrapping may have occurred)  
---start---
#! perl -w

###
# Just a quick and dirty utility to search for POD that 
# hasn't been converted to HTML by an install or was simply
# unzipped or copied into the site or lib subdirectories. 
# Checks to see if an existing .html version of the POD 
# exists, if not converts it to HTML. After conversion the 
# AS Docs TOC is rebuilt so that all newly added docs are listed.
#
# *! NOTE: If the install location is not C:\Perl 
#(ie: D:\Perl or C:\OthrDir\Perl) then the 
#  $infile_path_root and $outfile_path_root should be changed 
#   to reflect the install location.

use strict;
use Pod::Html;
use Pod::Find qw(pod_find);
use ActivePerl::DocTools;
use File::Path;

my $infile_path_root = "c:/perl";
my $outfile_path_root = "c:/perl/html";
my $logfile = "c:/perl/allpod.txt";

open LOGFILE, ">>$logfile" || die "couldn't open LOGFILE $logfile\n";
&search_for_pod;
print LOGFILE "-" x 60, "\n";
close LOGFILE;
ActivePerl::DocTools::WriteTOC();

sub search_for_pod {
  my %pods = pod_find({ -verbose => 0, -inc => 1 });
  foreach(sort keys %pods) {
convert_pod($_);
  }
}

sub convert_pod {
  my $podfile = shift;
  $podfile =~ s#\\#/#g;
  if ($podfile =~ m!$infile_path_root/(.*)/(\w+)\.p.+$!i) {
my $path = $1;
my $name = $2;
if (! -e "$outfile_path_root/$path/$name\.html") {
  mkpath("$outfile_path_root/$path");
  pod2html( "--infile=$podfile",
"--outfile=$outfile_path_root/$path/$name.html",
"--podroot=$infile_path_root",
"--podpath=site/lib:lib",
  );
  print LOGFILE "-- Created $outfile_path_root/$path/$name.html\n";
}
  }
}
---end- 
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



RE: Help... does anyone have these files?

2002-01-16 Thread Charles Washburn

Thanks Bill! 

Now I only need:

Iprocess-1_32.zip
Isync-1_11.zip

If anyone can provide these, I would really appreciate it.

Charles

-Original Message-
From: Charles Washburn 
Sent: Wednesday, January 16, 2002 11:28 AM
To: '[EMAIL PROTECTED]'
Subject: Help... does anyone have these files?


Hello,

I'm trying to re-set up my Perl environment and I found that I do not have
access to the following files:

Iprocess-1_32.zip
Isync-1_11.zip
Mmap-2_03.zip

These were originally downloaded from Aminer's site. Since then they have
been upgraded but, I cannot use the latest versions yet. Can anyone pass
them on to me or provide a link?

Thanks

Charles

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: yet another regex issue?

2002-01-16 Thread Carl Jolley

On Wed, 16 Jan 2002, Kuhnibert wrote:

>
> ok guys,
>
> i need a starter on this one.
> have a file which looks like this
>
> name:   @a  age: @b
> gender: @c   bla: @d blub @e
> blabla: @f
>
> and so on ...
>
> the @ signs are placeholders for a template and mark the position for later
> entries. they have always 1 alphanumeric digit, followed by either one or
> multiple spaces or a new line.
> after scanning the file, i want to end up in having a hash with the @ sign's
> char as a key and the column and row in which it occured in the file as a
> value, e.g. for above:
>
> $pos{a}->{col}= 9;
> $pos{a}->{row}= 1;
> $pos{b}->{col}= 18;
> $pos{b}->{row}= 1;
> $pos{c}->{col}= 9;
> $pos{c}->{row}= 2; ...
>
> probably a regex can do this, but i don't know how to find out the position
> on which a regex matched within a string, furthemore the multiple occurences
> of placeholders within one line are causing me a headache ...
>

The position of a regex match will be the length of the "stuff" before
the match plus one. In a regex, the "stuff" before the match is $` or,
if uou use the English module, $PREMATCH. I would code it like this:

$row=0;
while($line=) {
  $row++;
  while( $line=/@([a-zA-Z0-9])\s+/g) {
 my $item=$1;
 $pos{$item}->{col}=length($`)+1;
 $pos{$item}->{row}=$row;
  }
}

Note, there is no check for duplicate identifiers. With the code as I've
shown it, the row and column values for an item will be for the last seen
copy of that item.

 [EMAIL PROTECTED] 
 All opinions are my own and not necessarily those of my employer 

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re:Fork and multiple processes in ActivePerl for Win32

2002-01-16 Thread Ashish . Tiwari

In order to create 2 children you have to fork twice.

When you use fork() it returns twice.
-
$pid = fork();
if ($pid > 0) {
### parent here ###
execute parent code
{
elsif (defined $pid) {
### Child here ###
execute child code.

exit(); # end of child process.
}
--

Ashish Tiwari
 

"The views expressed here are mine and do not reflect the official
position of my employer or the organization through which the Internet
was accessed".


Reply Separator
Subject:Fork and multiple processes in ActivePerl for Win32
Author: "DK" <[EMAIL PROTECTED]>
Date:   1/16/02 9:41 PM

I am trying to write a program in ActivePerl for win32, needing to fork my code
into three processes. 
I am trying the code below, but I only get one child (2 processes counting the
parent).
**
defined ($pid1=fork())||die "fork failed $!";
if ($pid1>0) {#Parent Here.
defined($pid2=fork())||die "fork failed $!";

  }

#Code to be executed by both parent and children here.
**
Then, I wish for the child processes to end, leaving only the parent. Since in
my program I cannot create 
a second child (3 processes in all), I use the following code to terminate the
child.

**
#Code to be executed by both parent and children here.

unless($pid1){  #Parent here.
exit; 
  } 
if($pid1>0){  #Parent here.
waitpid($pid1,0);
}
#Code that only the Parent (Child is "dead") executes from now on.
**

How can I get 3 fully working processes? (1 Parent 2 Children) ?? And even if
that is done, then how 
can I terminate the second child as well ?

Thanks in advance. 








I am trying to write a program in ActivePerl for win32, needing to fork my 
code into three processes. I am trying the code below, but I only get one 
child (2 processes counting the parent).**defined 
($pid1=fork())||die "fork failed $!";if ($pid1>0) {#Parent 
Here.
;defined($pid2=fork())||die 
"fork failed $!";  }#Code to be executed by both 
parent and children here.**Then, I wish for the child processes 
to end, leaving only the parent. Since in my program I cannot create a 
second child (3 processes in all), I use the following code to terminate the 
child.**#Code to be executed by both parent and children 
here.unless($pid1){  #Parent here.exit;

&nbs
p; } 
 &n
bsp;  if($pid1>0){ 
 #Parent 
here.waitpid($pid1,0);}<
BR>#Code 
that only the Parent (Child is "dead") executes from now 
on.**How can I get 3 fully working processes? (1 Parent 2 
Children) ?? And even if that is done, then how can I terminate the second 
child as well ?Thanks in advance. 

Received: from listserv.ActiveState.com ([209.17.183.249]) by
mailserver.mail1.com with SMTP
  (IMA Internet Exchange 3.11) id 000703F1; Wed, 16 Jan 2002 11:41:13 -0800
Received: (qmail 15049 invoked from network); 16 Jan 2002 19:41:08 -
Received: from localhost (HELO shot.ActiveState.com) (127.0.0.1)
  by localhost with SMTP; 16 Jan 2002 19:41:08 -
Return-Path: <[EMAIL PROTECTED]>
Delivered-To: [EMAIL PROTECTED]
Received: (qmail 14755 invoked from network); 16 Jan 2002 19:40:24 -
Received: from espresso.activestate.com (HELO smtp1.ActiveState.com)
(192.168.2.150)
  by listserv1.activestate.com with SMTP; 16 Jan 2002 19:40:24 -
Received: from smtp015.mail.yahoo.com (smtp015.mail.yahoo.com [216.136.173.59])
by smtp1.ActiveState.com (8.11.6/8.11.6) with SMTP id g0GJeM730030
for <[EMAIL PROTECTED]>; Wed, 16 Jan 2002 11:40:22
-0800
Received: from thesi36-a098.otenet.gr (HELO ZAEBOS) (212.205.250.98)
  by smtp.mail.vip.sc5.yahoo.com with SMTP; 16 Jan 2002 19:40:21 -
Message-ID: <002201c19ec5$c37e6130$62facdd4@ZAEBOS>
From: "DK" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: Fork and multiple processes in ActivePerl for Win32
MIME-Version: 1.0
Content-Type: multipart/alternative;
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2600.
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.
X-Spam-Probability: 20%
X-Spam-Mask: XX
X-Filtered-By: PerlMx makes it fast and easy.  See
http://www.ActiveState.com/Products/PerlMx/Header
Sender: [EMAIL PROTECTED]
Errors-To: [EMAIL PROTECTED]
X-BeenThere: [EMAIL PROTECTED]
X-Mailman-Version: 2.0.5
Precedence: bulk
List-Help:

List-Post: 
List-Subscribe:
,

List-Id: Discussions relating to ActivePerl on Win32 platforms

List-Unsubscribe:
,

List-Archive: 

Fork and multiple processes in ActivePerl for Win32

2002-01-16 Thread DK



I am trying to write a program in ActivePerl for win32, needing to fork my 
code into three processes. I am trying the code below, but I only get one 
child (2 processes counting the parent).**defined 
($pid1=fork())||die "fork failed $!";if ($pid1>0) {#Parent 
Here.defined($pid2=fork())||die 
"fork failed $!";  }#Code to be executed by both 
parent and children here.**Then, I wish for the child processes 
to end, leaving only the parent. Since in my program I cannot create a 
second child (3 processes in all), I use the following code to terminate the 
child.**#Code to be executed by both parent and children 
here.unless($pid1){  #Parent here.exit; 
  } 
if($pid1>0){ 
 #Parent 
here.waitpid($pid1,0);}#Code 
that only the Parent (Child is "dead") executes from now 
on.**How can I get 3 fully working processes? (1 Parent 2 
Children) ?? And even if that is done, then how can I terminate the second 
child as well ?Thanks in advance. 


Help... does anyone have these files?

2002-01-16 Thread Charles Washburn

Hello,

I'm trying to re-set up my Perl environment and I found that I do not have
access to the following files:

Iprocess-1_32.zip
Isync-1_11.zip
Mmap-2_03.zip

These were originally downloaded from Aminer's site. Since then they have
been upgraded but, I cannot use the latest versions yet. Can anyone pass
them on to me or provide a link?

Thanks

Charles


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent: None
To: [EMAIL PROTECTED]
Subject: Perl-Win32-Users -- confirmation of subscription -- request
841302


Perl-Win32-Users -- confirmation of subscription -- request 841302

We have received a request from 63.199.144.96 for subscription of your
email address, <[EMAIL PROTECTED]>, to the
[EMAIL PROTECTED] mailing list.  To confirm
the request, please send a message to
[EMAIL PROTECTED], and either:

- maintain the subject line as is (the reply's additional "Re:" is
ok),

- or include the following line - and only the following line - in the
message body: 

confirm 841302

(Simply sending a 'reply' to this message should work from most email
interfaces, since that usually leaves the subject line in the right
form.)

If you do not wish to subscribe to this list, please simply disregard
this message.  Send questions to
[EMAIL PROTECTED]
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



RE: Binding events to tk::comboentry

2002-01-16 Thread Swartwood, Larry H

Very cool. Thanks a bunch Jack.

Larry S.

-Original Message-
From: Dunnigan,Jack [Edm] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 16, 2002 10:41 AM
To: 'Swartwood, Larry H'; Perl-Win32-Users (E-mail)
Subject: RE: Binding events to tk::comboentry


Use this script to find out:

#!/usr/bin/perl -w
#
# $Source: ptkkeysym $ $Revision: 1.1 $
#
use strict;
use Tk 'Ev';
 
my $keysym;
 
my $mw = MainWindow->new;
 
$mw->Label(-text=>"-- Press any key --\n\nKeysym is:\n\n")->pack;
$mw->Label(-textvariable=>\$keysym)->pack;
$mw->Button(-text=>'Exit', -command=>[$mw => 'destroy'])
->pack(-side=>'bottom');
 
$mw->geometry('300x200');
$mw->packPropagate(0);
 
sub PrintKeySym { $keysym = $_[1]; }
$mw->bind('all','', [\&PrintKeySym, Ev('K')]);
 
MainLoop;
__END__

Jack

"The views expressed here are mine and do not reflect the official
position of my employer or the organization through which the Internet
was accessed".



-Original Message-
From: Swartwood, Larry H [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 16, 2002 11:35 AM
To: Perl-Win32-Users (E-mail)
Subject: Binding events to tk::comboentry


I need to bind the down and up arrow keys to my tk::comboentry. I'm not sure
what the text string would be for those keys. Anyone have an example?

Thanks,
Larry S.
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



RE: Binding events to tk::comboentry

2002-01-16 Thread Dunnigan,Jack [Edm]

Use this script to find out:

#!/usr/bin/perl -w
#
# $Source: ptkkeysym $ $Revision: 1.1 $
#
use strict;
use Tk 'Ev';
 
my $keysym;
 
my $mw = MainWindow->new;
 
$mw->Label(-text=>"-- Press any key --\n\nKeysym is:\n\n")->pack;
$mw->Label(-textvariable=>\$keysym)->pack;
$mw->Button(-text=>'Exit', -command=>[$mw => 'destroy'])
->pack(-side=>'bottom');
 
$mw->geometry('300x200');
$mw->packPropagate(0);
 
sub PrintKeySym { $keysym = $_[1]; }
$mw->bind('all','', [\&PrintKeySym, Ev('K')]);
 
MainLoop;
__END__

Jack

"The views expressed here are mine and do not reflect the official
position of my employer or the organization through which the Internet
was accessed".



-Original Message-
From: Swartwood, Larry H [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 16, 2002 11:35 AM
To: Perl-Win32-Users (E-mail)
Subject: Binding events to tk::comboentry


I need to bind the down and up arrow keys to my tk::comboentry. I'm not sure
what the text string would be for those keys. Anyone have an example?

Thanks,
Larry S.
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Binding events to tk::comboentry

2002-01-16 Thread Swartwood, Larry H

I need to bind the down and up arrow keys to my tk::comboentry. I'm not sure
what the text string would be for those keys. Anyone have an example?

Thanks,
Larry S.
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: Win32::ActAcc - where from to download

2002-01-16 Thread Johan Lindstrom

At 18:41 2002-01-16 +0530, Abhra Debroy wrote:
>Can anybody tell me where from I can down load 'Win32::ActAcc'. I tried it
>from CPAN but failed.

http://search.cpan.org/search?dist=Win32-ActAcc
http://www.cpan.org/authors/id/P/PB/PBWOLF/Win32-ActAcc-1.0.zip


/J

 --  --- -- --  --  -- -  - -
Johan LindströmSourcerer @ Boss Casinos [EMAIL PROTECTED]

Latest bookmark: "TG Development"
http://touchgraph.sourceforge.net/


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: yet another regex issue?

2002-01-16 Thread Kuhnibert


pos(), huh? never stumbled over this function, didn't think that it would be
*that* simple ...
anyway, it does exactly what i want - thanks a lot, you assuredly prevented
me from writing me a really ugly (and error prone) piece of code

--till


One way is to use to use file://g and pos. The program

while ()


while (/@(\w)/g)


# The pos function returns the position
# where the last file://g search left off. The next
file://g
# search will begin at pos.
$pos{$1}->{col} = pos;
$pos{$1}->{row} = $.;
}
}

print "char=$_, col=$pos{$_}->{col}, row=$pos{$_}->{row}\n" foreach
sort keys %pos;

__DATA__
name:   @a  age: @b
gender: @c   bla: @d blub @e
blabla: @f

produces the following output

char=a, col=10, row=1
char=b, col=19, row=1
char=c, col=10, row=2
char=d, col=20, row=2
char=e, col=28, row=2
char=f, col=10, row=3


Tim




"Kuhnibert" <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
01/16/2002 11:03 AM

To:"perlwin32" <[EMAIL PROTECTED]>
cc:
Subject:yet another regex issue?




ok guys,

i need a starter on this one.
have a file which looks like this

name:   @a  age: @b
gender: @c   bla: @d blub @e
blabla: @f

and so on ...

the @ signs are placeholders for a template and mark the position for later
entries. they have always 1 alphanumeric digit, followed by either one or
multiple spaces or a new line.
after scanning the file, i want to end up in having a hash with the @ sign's
char as a key and the column and row in which it occured in the file as a
value, e.g. for above:

$pos{a}->{col}= 9;
$pos{a}->{row}= 1;
$pos{b}->{col}= 18;
$pos{b}->{row}= 1;
$pos{c}->{col}= 9;
$pos{c}->{row}= 2; ...

probably a regex can do this, but i don't know how to find out the position
on which a regex matched within a string, furthemore the multiple occurences
of placeholders within one line are causing me a headache ...

every help appreciated
TIA
till


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Need Help: Shared Memory

2002-01-16 Thread Ashish . Tiwari

Hello everybody,

I have a Perl script in Unix which monitors the health of a server. and also
runs some other jobs in a infinite loop.

It forks children to monitor the health, and run other jobs. To maintain the
state it uses a hash mapped to shared memory so that the main script which is
the parent and all its children can look at the hash to check the status of the
system, before they perform their activities. 

In event of a failure of either the parent or any of it's children, the script
terminates all the running children and ends - a graceful exits happens and all
the zombie processes are removed. 

In fact the removal of zombies is performed routinely in the script through a
signal handler.

I have to port the same script on NT. And obviously I have to make a lot of
changes:

1.  Signal handling is not supported on NT.

2. The shared memory functions of Perl used in UNIX are not implememnted in Perl
on NT.

3.  Is it a good idea to use fork as the books (Dave Roth's Win32 Perl
scripting) talk of fork not being reliable. Or is there another way to create
child processes and monitor their exit codes, terminate them in case of faults
and reap the zombies.

Pls. Note:  I am using Perl 5.6

I aslo read about using Amine's MemMap module and saw a few references to it in
questions asked in this forum. I am unable to get the Module from the website as
the the zip is missing. 

Can anyone advise me with an alternative or provide me with some hints.

Thanks,

Ashish Tiwari
Integrated Decisions and Systems.
e-mail: [EMAIL PROTECTED] 

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: yet another regex issue?

2002-01-16 Thread Tim . Moose

One way is to use to use //g and pos. The program

        while () {
        
                while (/@(\w)/g) {
        
                        # The pos function returns the position
                        # where the last //g search left off. The next //g
                        # search will begin at pos.
                        $pos{$1}->{col} = pos;
                        $pos{$1}->{row} = $.;
                }
        }
        
        print "char=$_, col=$pos{$_}->{col}, row=$pos{$_}->{row}\n" foreach sort keys %pos;
        
        __DATA__
        name:   @a  age: @b
        gender: @c   bla: @d blub @e
        blabla: @f

produces the following output

        char=a, col=10, row=1
        char=b, col=19, row=1
        char=c, col=10, row=2
        char=d, col=20, row=2
        char=e, col=28, row=2
        char=f, col=10, row=3


Tim








"Kuhnibert" <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
01/16/2002 11:03 AM

        
        To:        "perlwin32" <[EMAIL PROTECTED]>
        cc:        
        Subject:        yet another regex issue?



ok guys,

i need a starter on this one.
have a file which looks like this

name:   @a  age: @b
gender: @c   bla: @d blub @e
blabla: @f

and so on ...

the @ signs are placeholders for a template and mark the position for later
entries. they have always 1 alphanumeric digit, followed by either one or
multiple spaces or a new line.
after scanning the file, i want to end up in having a hash with the @ sign's
char as a key and the column and row in which it occured in the file as a
value, e.g. for above:

$pos{a}->{col}= 9;
$pos{a}->{row}= 1;
$pos{b}->{col}= 18;
$pos{b}->{row}= 1;
$pos{c}->{col}= 9;
$pos{c}->{row}= 2; ...

probably a regex can do this, but i don't know how to find out the position
on which a regex matched within a string, furthemore the multiple occurences
of placeholders within one line are causing me a headache ...

every help appreciated
TIA
till

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users




yet another regex issue?

2002-01-16 Thread Kuhnibert


ok guys,

i need a starter on this one.
have a file which looks like this

name:   @a  age: @b
gender: @c   bla: @d blub @e
blabla: @f

and so on ...

the @ signs are placeholders for a template and mark the position for later
entries. they have always 1 alphanumeric digit, followed by either one or
multiple spaces or a new line.
after scanning the file, i want to end up in having a hash with the @ sign's
char as a key and the column and row in which it occured in the file as a
value, e.g. for above:

$pos{a}->{col}= 9;
$pos{a}->{row}= 1;
$pos{b}->{col}= 18;
$pos{b}->{row}= 1;
$pos{c}->{col}= 9;
$pos{c}->{row}= 2; ...

probably a regex can do this, but i don't know how to find out the position
on which a regex matched within a string, furthemore the multiple occurences
of placeholders within one line are causing me a headache ...

every help appreciated
TIA
till

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: hash of arrays

2002-01-16 Thread dolljunkie


- Original Message -
From: "Peter Eisengrein" <[EMAIL PROTECTED]>


> That just adds a field to my output, like so:
>
> 7943641|ARRAY(0x1b9efb8)||
>
>
> Perhaps I'm contructing it wrong? I'm doing it like this...
>
> @_=$features{$dn};
> push(@_,$line[1]);
> $features{$dn}=\@_;
>

That's kind of scary, first you're saying the key in %features has an array
as content, then you're saying it has an array ref.

It's likely you had an array ref, pulled back an array with one entry (an
array ref) and then referenced back to that in the %features hash, avoiding
doing that will make life less complicated.

Look at something like this :

my %features = ();

foreach (1..10) {
my @array = (1,2,3);
$features{$_} = \@array;
}

foreach my $dn (sort {$a <=> $b} keys(%features)) {
print("\n$dn | ");
push(@{ $features{$dn} },"testline");
foreach (0..$#{ $features{$dn} }) {
my $dat = $features{$dn}->[$_];
print("$dat |");
}
}


!c

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



RE: Task Scheduler?

2002-01-16 Thread Trevor Joerges
Title: RE: Task Scheduler?





Win32-Schedular is available from ROTH.NET.
http://www.roth.net


Kind regards,
Trevor Joerges


-Original Message-
From: Mark G. Franz [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 16, 2002 10:34 AM
To: [EMAIL PROTECTED]
Subject: Re: Task Scheduler?



True,


By creating an AT command, it will insert the task into the scheduler.


Mark
- Original Message -
From: "Michael Stidham" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 16 January, 2002 7:16 AM
Subject: Re: Task Scheduler?



> Dont know, but you could use `at`;
>
>
> >From: "Burak Gursoy" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >Subject: Task Scheduler?
> >Date: Wed, 16 Jan 2002 16:44:46 +0200
> >
> >Hi,
> >
> >Can we access to Windows Task Scheduler with Perl? I can not find
something
> >smilar to this?
> >
> >
> >_
> >Do You Yahoo!?
> >Get your free @yahoo.com address at http://mail.yahoo.com
> >
> >___
> >Perl-Win32-Users mailing list
> >[EMAIL PROTECTED]
> >http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
>
>
> _
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
>
> ___
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
>


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users





RE: Task Scheduler?

2002-01-16 Thread Steven Manross

There's a Win32::TaskScheduler project on SourceForge.  Though it hasn't
been fully released yet and is a 1.0.0 release, it is very functional and
allows most all the options to be set.

I'd like to thank Umberto Nicoletti for all his work for this project.

Here's a link to the sourceforge project.

http://www.sourceforge.net/projects/taskscheduler

Steven

-Original Message-
From: Mark G. Franz [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 16, 2002 8:34 AM
To: [EMAIL PROTECTED]
Subject: Re: Task Scheduler?


True,

By creating an AT command, it will insert the task into the scheduler.

Mark
- Original Message -
From: "Michael Stidham" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 16 January, 2002 7:16 AM
Subject: Re: Task Scheduler?


> Dont know, but you could use `at`;
>
>
> >From: "Burak Gursoy" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >Subject: Task Scheduler?
> >Date: Wed, 16 Jan 2002 16:44:46 +0200
> >
> >Hi,
> >
> >Can we access to Windows Task Scheduler with Perl? I can not find
something
> >smilar to this?
> >
> >
> >_
> >Do You Yahoo!?
> >Get your free @yahoo.com address at http://mail.yahoo.com
> >
> >___
> >Perl-Win32-Users mailing list
> >[EMAIL PROTECTED]
> >http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
>
>
> _
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
>
> ___
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
>

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



RE: hash of arrays

2002-01-16 Thread Peter Eisengrein

BINGO! Thanks Rob.

> -Original Message-
> From: Hanson, Robert [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 16, 2002 10:58
> To: 'Peter Eisengrein'
> Subject: RE: hash of arrays
> 
> 
> Hmmm...
> 
> If $features{$dn} is a reference to an array you dereference 
> it like this...
> 
> @{$features{$dn}}
> 
> And you can also push onto it like this...
> 
> push @{$features{$dn}}, 'foo';
> 
> So I would rewrite the code to sent to look like this...
> 
> push(@{$features{$dn}},$line[1]);
> 
> Rob
> 
> 
> -Original Message-
> From: Peter Eisengrein [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 16, 2002 10:45 AM
> To: Hanson, Robert; Perl-Win32-Users Mailing List (E-mail)
> Subject: RE: hash of arrays
> 
> 
> That just adds a field to my output, like so:
> 
> 7943641|ARRAY(0x1b9efb8)||
> 
> 
> Perhaps I'm contructing it wrong? I'm doing it like this...
> 
> @_=$features{$dn};
> push(@_,$line[1]);
> $features{$dn}=\@_;
> 
> 
> 
> 
> > -Original Message-
> > From: Hanson, Robert [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, January 16, 2002 10:43
> > To: 'Peter Eisengrein'; Perl-Win32-Users Mailing List (E-mail)
> > Subject: RE: hash of arrays
> > 
> > 
> > 
> > This is what you want...
> > 
> > foreach my $dn (keys %features)
> > {
> > my @features = @{$features{$dn}};
> > 
> > print "$dn|";
> > foreach (@features)
> > {
> > print "$_\|";
> > }
> > print "\n";
> > }
> > 
> > Rob
> > 
> > 
> > -Original Message-
> > From: Peter Eisengrein [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, January 16, 2002 10:33 AM
> > To: Perl-Win32-Users Mailing List (E-mail)
> > Subject: hash of arrays
> > 
> > 
> > I know this has been asked and answered so please forgive me, 
> > but I left my
> > camel at home and can't seem to find it with perldoc...
> > 
> > I have constructed a hash of arrays in %features but can't 
> > get the data
> > back. I'm trying:
> > 
> > #
> > foreach my $dn (keys %features)
> > {
> > my @features=$features{$dn};
> > 
> > print "$dn|";
> > foreach (@features)
> > {
> > print "$_\|";
> > }
> > print "\n";
> > }
> > #
> > 
> > but I get something like:
> > 
> > 8204932|ARRAY(0x1b9efb8)|
> > 
> > 
> > How do I dereference it?
> > 
> > ___
> > Perl-Win32-Users mailing list
> > [EMAIL PROTECTED]
> > http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
> > 
> 
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: Trying to print out tables in mysql db with perl & dbi

2002-01-16 Thread Simon Oliver

> @tables = $dbh->table_info();
@tables = $dbh->tables();

--
  Simon Oliver
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



RE: hash of arrays

2002-01-16 Thread Peter Eisengrein

That just adds a field to my output, like so:

7943641|ARRAY(0x1b9efb8)||


Perhaps I'm contructing it wrong? I'm doing it like this...

@_=$features{$dn};
push(@_,$line[1]);
$features{$dn}=\@_;




> -Original Message-
> From: Hanson, Robert [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 16, 2002 10:43
> To: 'Peter Eisengrein'; Perl-Win32-Users Mailing List (E-mail)
> Subject: RE: hash of arrays
> 
> 
> 
> This is what you want...
> 
> foreach my $dn (keys %features)
> {
>   my @features = @{$features{$dn}};
> 
>   print "$dn|";
>   foreach (@features)
>   {
>   print "$_\|";
>   }
>   print "\n";
> }
> 
> Rob
> 
> 
> -Original Message-
> From: Peter Eisengrein [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 16, 2002 10:33 AM
> To: Perl-Win32-Users Mailing List (E-mail)
> Subject: hash of arrays
> 
> 
> I know this has been asked and answered so please forgive me, 
> but I left my
> camel at home and can't seem to find it with perldoc...
> 
> I have constructed a hash of arrays in %features but can't 
> get the data
> back. I'm trying:
> 
> #
> foreach my $dn (keys %features)
> {
>   my @features=$features{$dn};
> 
>   print "$dn|";
>   foreach (@features)
>   {
>   print "$_\|";
>   }
>   print "\n";
> }
> #
> 
> but I get something like:
> 
> 8204932|ARRAY(0x1b9efb8)|
> 
> 
> How do I dereference it?
> 
> ___
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
> 
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users