[22862] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5083 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 6 11:05:45 2003

Date: Fri, 6 Jun 2003 08:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 6 Jun 2003     Volume: 10 Number: 5083

Today's topics:
        Building Threaded List of Newsgroup Headers <cpryce@pryce.net>
    Re: capturing output of executed system command (Helgi Briem)
    Re: open2 under windows <kalinabears@hdc.com.au>
        perl xs module (Jeff Mott)
    Re: perl (C Marshall)
    Re: perl (Tad McClellan)
    Re: perl <graham.drabble@lineone.net>
    Re: perl <roobarb@fastmail.fm>
    Re: Printing VISIO documents using PERL - Win32::OLE in (Graham Smith)
    Re: Push adding space to start of items (Tad McClellan)
    Re: redirect location prints to screen <cat@no-spam.com>
    Re: redirect location prints to screen <cat@no-spam.com>
    Re: redirect location prints to screen <thomas.nagel@planb.de>
    Re: regex based on numeric value (Rick Ferrante)
        Temporary "holding"/"Working" page - ideas? (Lawrence Tierney)
    Re: Temporary "holding"/"Working" page - ideas? <jurgenex@hotmail.com>
    Re: Time limit <ubl@schaffhausen.de>
        Unable to lock array <mahboob@bellsouth.net>
    Re: Unable to lock array (Sam Holden)
        Win32::GUI  for reporting display windows apps? (Kenjis Kaan)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 06 Jun 2003 09:04:29 -0500
From: cp <cpryce@pryce.net>
Subject: Building Threaded List of Newsgroup Headers
Message-Id: <060620030904299472%cpryce@pryce.net>

I am looking for code examples to take a list of messages from a
Newsgroup and display them on an HTML page as a threaded list. 

I'm using the Net::NNTP module, and I have reviewed the docs. I've also
seen Randal's online article. 

I'd like to take the output of an xover call, which looks like this: 

$VAR1 = {
          '29' => [
                    'Re: What shall we test here?',
                    '"Phil Chouinard [Bentley]" <emailaddress dot com>
                    'Mon, 6 Jan 2003 09:49:57 -0500',
                    '<uOg29FZtCHA.1504@prdweb004.viecon.com>',
                    '<iqoS6f6fCHA.1448@prdweb004.viecon.com>
<jZW6vK7fCHA.1824@prdweb004.viecon.com> <1odpap8p7kvzn$.dlg@sasolo.net>
<3E186382.1000009@optonline.net>',
                    '1732',
                    '29',
                    'Xref: prdweb004.viecon.com bentley.testposts:29'
                  ],
          '1' => [
                   'What shall we test here?',
                   '"Chris Zakrewsky" <emailaddress dot com>',
                   'Wed, 30 Oct 2002 01:06:17 +0100',
                   '<iqoS6f6fCHA.1448@prdweb004.viecon.com>',
                   '',
                   '636',
                   '4',
                   'Xref: prdweb004.viecon.com bentley.testposts:1'
                 ],
          '2' => [
                   'Re: What shall we test here?',
                   '"Phil Chouinard [Bentley]" <emailaddress dot com>',
                   'Tue, 29 Oct 2002 20:14:36 -0500',
                   '<jZW6vK7fCHA.1824@prdweb004.viecon.com>',
                   '<iqoS6f6fCHA.1448@prdweb004.viecon.com>',
                   '1063',
                   '13',
                   'Xref: prdweb004.viecon.com bentley.testposts:2'
                 ],
          '16' => [
                    'Re: What shall we test here?',
                    'Solo <emailaddress dot com>',
                    'Tue, 26 Nov 2002 18:42:42 -0600',
                    '<1odpap8p7kvzn$.dlg@sasolo.net>',
                    '<iqoS6f6fCHA.1448@prdweb004.viecon.com>
<jZW6vK7fCHA.1824@prdweb004.viecon.com>',
                    '1195',
                    '14        ',
                    'Xref: prdweb004.viecon.com bentley.testposts:16'
                  ],
          '27' => [
                    'Re: What shall we test here?',
                    'J <emailaddress dot com>',
                    'Sun, 05 Jan 2003 11:55:30 -0500',
                    '<3E186382.1000009@optonline.net>',
                    '<iqoS6f6fCHA.1448@prdweb004.viecon.com>
<jZW6vK7fCHA.1824@prdweb004.viecon.com>
<1odpap8p7kvzn$.dlg@sasolo.net>',
                    '1328',
                    '16        ',
                    'Xref: prdweb004.viecon.com bentley.testposts:27'
                  ],
        };

and turn it into something like: 

<ul>
   <!-- First Item -->
   <li><a href="article_1">What Shall we Test here</a>
      <ul>
      <!-- First Item's firt child --> 
         <li><a href="article_2">Re: What shall we test here</a>
            <ul> 
            <!-- Child of article 1 and Article 2 -->
            ... etc. 

I was trying to come up with a recursion routine that would work, but I
find maybe I'm better off keeping the children to a max depth and
solving this with iteration? 

Any samples would help. Thanks

-- 
cp


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

Date: Fri, 06 Jun 2003 12:44:14 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: capturing output of executed system command
Message-Id: <3ee08c47.254506187@news.cis.dfn.de>

On Thu, 05 Jun 2003 12:31:31 -0500, Chris Olive <nospam@raytheon.com>
wrote:

>benson limketkai wrote:
>> suppose i have:
>> 
>> system 'ps'
>> 
>> how can i redirect the output into an array?
>> 
>> thanks,
>> benson
>> 
>
>I prefer writing a "shell()" wrapper to do this sort of thing:
>
>sub Shell {
>    my @output;
>    foreach (@_) { push( @output, `$_` ) }
>    chomp( @output );
>    return wantarray ? @output : \@output;
>}
>
>Then you can:
>
>my @rv = Shell( "Command 1", "Command 2", "Command 3" );

Seems like an incredibly complex bit of code to avoid:

my @rv = qx/$cmd/;

or

my @output = `$cmd`;

Why exactly do you do it that way?


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

Date: Fri, 6 Jun 2003 22:54:29 +1000
From: "Sisyphus" <kalinabears@hdc.com.au>
Subject: Re: open2 under windows
Message-Id: <3ee09030$0$27125@echo-01.iinet.net.au>


"Alan" <alan_grow@hotmail.com> wrote in message
news:e8791f31.0306051222.6ee0ebb8@posting.google.com...
> Hello and tia:
>
>   I am trying to get a bidirectional pipe working under both Unix and
> Activestate 5.6.1 build 635. I thought my best bet would be
> IPC::Open2, but so far it just hangs under Win2k. Here's the code.
>
>
> # ipctest.pl
> use strict;
> use IPC::Open2;
>
> my $pid;
> my ($r, $w);
> $pid = open2($r, $w, 'perl echo.pl');
>
> print $w "Hello World\n";
> close($w);
>
># print STDOUT <$r>;
my $c = <$r>;
chomp($c);
print $c, "\n";
>
>
> # echo.pl
> use strict;
$| = 1;
> print while (<>) ;
>
>
>   Thanks for the help.
>
>   -Alan

With the above changes it now works for me on Win2k. (Note that *both* files
have been amended.)

Fix supplied by $Bill Luebkert (on another forum).

Cheers,
Rob




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

Date: 6 Jun 2003 04:09:45 -0700
From: mjeff1@twcny.rr.com (Jeff Mott)
Subject: perl xs module
Message-Id: <970676ed.0306060309.2148ea6e@posting.google.com>

 ...seems to come with several files (.pm .bs .dll .exp .lib). I've
found I can get away with discluding all but .pm and .dll, but
although I can do this I'm trying to find out if I should to this. Are
the others necessary at any time for execution of the module?


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

Date: 6 Jun 2003 05:27:55 -0700
From: c_j_marshall@hotmail.com (C Marshall)
Subject: Re: perl
Message-Id: <cb9c7b76.0306060427.59e4660e@posting.google.com>

"Jürgen Exner" <jurgenex@hotmail.com> wrote in message news:<OQVDa.53736$Pb.413@nwrddc01.gnilink.net>...
> C Marshall wrote:
> > tadmc@augustmail.com (Tad McClellan) wrote in message
> >> Have you seen the docs about Perl books?
> >>
> >>    perldoc -q book
> >>
> >>    perldoc perlbook
> >
> > Crikey - is there no end to what is available under perldoc ?
> > The guys who maintain that must be costing Oreilly a fortune
> 
> Where did you get the idea that the authors of perldoc are paid by OReilly?
> I'm sure they would very much appreciate that additional funding, but it
> ain't that way.

I meant that people would use perldoc rather than go out and buy an
OReilly manual. But as perldoc advertises Oreilly books anyway it was
a daft suggestion


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

Date: Fri, 6 Jun 2003 08:18:05 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: perl
Message-Id: <slrnbe154d.264.tadmc@magna.augustmail.com>

C Marshall <c_j_marshall@hotmail.com> wrote:


[ Subject: perl

   I don't know how I missed a scoring entry for that subject.
   (although the "one word subject" entry got it for me)
   It is fixed now.
]


> "Jürgen Exner" <jurgenex@hotmail.com> wrote in message news:<OQVDa.53736$Pb.413@nwrddc01.gnilink.net>...
>> C Marshall wrote:
>> > tadmc@augustmail.com (Tad McClellan) wrote in message

>> >> Have you seen the docs about Perl books?

>> > Crikey - is there no end to what is available under perldoc ?
>> > The guys who maintain that must be costing Oreilly a fortune
>> 
>> Where did you get the idea that the authors of perldoc are paid by OReilly?

> I meant that people would use perldoc rather than go out and buy an
> OReilly manual.


Then things are As They Should Be.

Books are supplemental to the docs that came with the software 
that you are using anyway.

I have a bunch of ORA (and other) Perl books, but they are for
learning about stuff. I don't use them for a reference unless
I come up empty from the std docs first.



As far as book recommendations go, if someone says to me:

   I am so poor that I can only afford ONE book, what
   would you recommend?

I recommend a book that isn't even really a Perl book (MRE),
because the std docs can be used in lieu of the Camel, and
you'd stop using the Llama after a few months.


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


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

Date: Fri, 06 Jun 2003 14:36:31 +0100
From: Graham Drabble <graham.drabble@lineone.net>
Subject: Re: perl
Message-Id: <Xns9392949B99602grahamdrabblelineone@ID-77355.user.dfncis.de>

On 06 Jun 2003 tadmc@augustmail.com (Tad McClellan) wrote in
news:slrnbe154d.264.tadmc@magna.augustmail.com: 

> As far as book recommendations go, if someone says to me:
> 
>    I am so poor that I can only afford ONE book, what
>    would you recommend?
> 
> I recommend a book that isn't even really a Perl book (MRE),
                                                        ^^^^^

EXPN?

-- 
Graham Drabble
If you're interested in what goes on in other groups or want to find 
an interesting group to read then check news.groups.reviews for what 
others have to say or contribute a review for others to read.


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

Date: Fri, 6 Jun 2003 15:00:20 +0100
From: Keith Anderson <roobarb@fastmail.fm>
Subject: Re: perl
Message-Id: <qK1Ea.34253$9C6.1540358@wards.force9.net>

On Fri, 06 Jun 2003 14:36:31 +0100
in news:<Xns9392949B99602grahamdrabblelineone@ID-77355.user.dfncis.de>
Graham Drabble wrote:

> On 06 Jun 2003 tadmc@augustmail.com (Tad McClellan) wrote in
> news:slrnbe154d.264.tadmc@magna.augustmail.com: 
> 
>> As far as book recommendations go, if someone says to me:
>> 
>>    I am so poor that I can only afford ONE book, what
>>    would you recommend?
>> 
>> I recommend a book that isn't even really a Perl book (MRE),
>                                                         ^^^^^
> 
> EXPN?

I presumed Tad was alluding to Mastering Regular Expressions (the 'hip
owls' book).


-- 
Keith Anderson


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

Date: 6 Jun 2003 05:33:11 -0700
From: grehom@ntlworld.com (Graham Smith)
Subject: Re: Printing VISIO documents using PERL - Win32::OLE in general
Message-Id: <98eb7f13.0306060433.eba33a6@posting.google.com>

As a general principle when you are trying to write a Perl Win32::OLE
automation of Microsoft product (like Visio) it's quite instructive to
create a macro of the operation you want to automate, I can't
demonstrate with
visio but if I demonstrate with a Macro I created in M$ Word you might
see what I'm doing.  The macro opens a file and 'bold'ens the first
paragraph then
prints it.

    Documents.Open FileName:="test_first_para.doc",
ConfirmConversions:=False, _
         ReadOnly:=False, AddToRecentFiles:=False,
PasswordDocument:="", _
        PasswordTemplate:="", Revert:=False,
WritePasswordDocument:="", _
        WritePasswordTemplate:="", Format:=wdOpenFormatAuto
    With Selection.Find
        .Text = "^p"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute
    Selection.HomeKey Unit:=wdStory, Extend:=wdExtend
    Selection.Font.Bold = wdToggle
    Application.PrintOut FileName:="", Range:=wdPrintAllDocument,
Item:= _
        wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
        Collate:=True, Background:=True, PrintToFile:=False,
PrintZoomColumn:=0, _
        PrintZoomRow:=0, PrintZoomPaperWidth:=0,
PrintZoomPaperHeight:=0
    ActiveDocument.Close
End Sub

I then massage it gently!! and end up with something like:

    use strict;
    use warnings;
    
    use Win32::OLE qw(with);
    use Win32::OLE::Variant;
    use Win32::OLE::Const 'Microsoft Word';

    use constant FALSE => Variant( VT_BOOL, 0);
    use constant TRUE  => Variant( VT_BOOL, 1);

    my $Word = Win32::OLE->new('Word.Application', 'Quit');
    $Word->{'Visible'} = 1;         # if you want to see what's going
on
	
    use Getopt::Long; 
    use vars qw( $opt_dir $opt_verbose $opt_subroutines );
    use Cwd;

    GetOptions ("dir=s", "verbose!");

    die "No such directory" unless -d $opt_dir;
    $opt_dir  =~ s[\\][/]g;   # change backslashes to forward slashes
ala Perl
    $opt_dir  =~ s[/$][];     # strip trailing slash off directory
names

    my $VERBOSE = $opt_verbose;

    use File::Find;

    #  find all files within directory specified in -d= command line
option
    find( \&find_files, $opt_dir);

    # you don't want to quit until all files printed

	1;

sub find_files { 
    my $this_file = $File::Find::name;

	return if -d $this_file;  # return if file is a directory
	return unless /\.doc$/;   # return unless a '*.doc' file
   	print "File: $this_file\n" if $VERBOSE;

    $Word->Documents->Open( $this_file, { ReadOnly => TRUE, }  
    ) or die "Unable to open document " . Win32::OLE->LastError();
    with( $Word->Selection->Find,
        Text => "^p",
        Forward => TRUE,
    );
    $Word->Selection->Find->Execute;
    $Word->Selection->HomeKey( { 
    	Unit => wdStory,
    	Extend => wdExtend,
    } );
    $Word->Selection->Font->{Bold} = wdToggle;

    with( $Word->Application->PrintOut,
    	FileName => "",
    	Range => wdPrintAllDocument,
    	Item =>  wdPrintDocumentContent,
        Copies => 1,
        Pages => "",
        PageType => wdPrintAllPages,
        Collate => TRUE,
        Background => TRUE,
        PrintToFile => FALSE,
        PrintZoomColumn => 0,
        PrintZoomRow => 0,
        PrintZoomPaperWidth => 0,
        PrintZoomPaperHeight => 0,
	);
	
    $Word->ActiveDocument->Close( {SaveChanges => FALSE} );

}

This has turned into quite a long posting but I think the content is
widely useful to anyone trying out Win32::OLE automation for first
time


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

Date: Fri, 6 Jun 2003 08:27:26 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Push adding space to start of items
Message-Id: <slrnbe15lu.264.tadmc@magna.augustmail.com>

Mark Smith <Mark.Smith@sonyericsson.com> wrote:
> "Jürgen Exner" <jurgenex@hotmail.com> wrote in message news:<lSVDa.53750$Pb.4656@nwrddc01.gnilink.net>...
>> Mark Smith wrote:


[ asked a FAQ ]


> Was rushing as I was
> leaving work and did a bit of a brain dump.


One person rushed. 

Hundreds (thousands?) of people around the world dealt with trying 
to make sense of it.

Not an efficient distribution of labor.


> You live and you learn.


Let's hope so.  :-)


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


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

Date: Fri, 06 Jun 2003 21:05:37 +1000
From: Cat <cat@no-spam.com>
Subject: Re: redirect location prints to screen
Message-Id: <xo_Da.7$rD5.2778@nsw.nnrp.telstra.net>

Harvey Siegelman wrote:
> I have written a cgi that uses an environment variable (remote_user)
> on a password protected page to redirect the user to one of several
> folders, each named after on of the likely users.  The purpose is to
> have a link to a client access area where each client can 'sign in'
> and be directed to their own private page.
> 
> The problem: when the cgi executes it generates a hyperlink printed at
> the the top of an otherwise blank page.  When clicked, the hyperlink
> will take the user to the correct page, but that is not the effect
> that I wish to achieve.  I had hoped to have the redirect print to the
> location bar and not the page.  The cgi is being executed from a shtml
> page.  What am I doing wrong?  Here is the cgi code:
> 
> #!/usr/bin/perl
> $baseurl = 'http://www.economicsgroup.com/clients/';
> $user = $ENV{'REMOTE_USER'};
> $fullurl = $baseurl.lc($user);
> print "Location: $fullurl/\n\n";
> 

Hey, correct me if I'm wrong, but that doesn't look like a CGI script.
It is just an ordinary perl script doing ordinary perl stuff.

#!/usr/bin/perl
$baseurl = 'http://www.economicsgroup.com/clients/';
$user = $ENV{'REMOTE_USER'};
$fullurl = $baseurl.lc($user);
print "Location: $fullurl/\n\n";

All you've done is created three variables and printed a line to
standard output.

And from the sounds of things, that exactly what you have described as
the result of running this script.  I'd like to help you with some real
code, but CGI scripting is not my expertise.  Maybe another reader can help.

Good luck



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

Date: Fri, 06 Jun 2003 21:51:25 +1000
From: Cat <cat@no-spam.com>
Subject: Re: redirect location prints to screen
Message-Id: <e3%Da.8$rD5.3964@nsw.nnrp.telstra.net>

Cat wrote:
> Harvey Siegelman wrote:
> 
>> I have written a cgi that uses an environment variable (remote_user)
>> on a password protected page to redirect the user to one of several
>> folders, each named after on of the likely users.  The purpose is to
>> have a link to a client access area where each client can 'sign in'
>> and be directed to their own private page.
>>
>> The problem: when the cgi executes it generates a hyperlink printed at
>> the the top of an otherwise blank page.  When clicked, the hyperlink
>> will take the user to the correct page, but that is not the effect
>> that I wish to achieve.  I had hoped to have the redirect print to the
>> location bar and not the page.  The cgi is being executed from a shtml
>> page.  What am I doing wrong?  Here is the cgi code:
>>
>> #!/usr/bin/perl
>> $baseurl = 'http://www.economicsgroup.com/clients/';
>> $user = $ENV{'REMOTE_USER'};
>> $fullurl = $baseurl.lc($user);
>> print "Location: $fullurl/\n\n";
>>
> 
> Hey, correct me if I'm wrong, but that doesn't look like a CGI script.
> It is just an ordinary perl script doing ordinary perl stuff.
> 
> #!/usr/bin/perl
> $baseurl = 'http://www.economicsgroup.com/clients/';
> $user = $ENV{'REMOTE_USER'};
> $fullurl = $baseurl.lc($user);
> print "Location: $fullurl/\n\n";
> 
> All you've done is created three variables and printed a line to
> standard output.
> 
> And from the sounds of things, that exactly what you have described as
> the result of running this script.  I'd like to help you with some real
> code, but CGI scripting is not my expertise.  Maybe another reader can 
> help.
> 
> Good luck
> 

Having said that...  I've managed to get something... hope it helps

#!/usr/bin/perl
use strict;
use warnings;

use CGI;

my $baseurl = 'http://www.economicsgroup.com/clients/';
my $user = $ENV{'REMOTE_USER'};
my $fullurl = $baseurl.lc($user);
#print "Location: $fullurl/\n\n";

my $co = new CGI;

print(
       "<meta HTTP-EQUIV='Refresh' CONTENT='0;URL=$fullurl/index.html'>",
       $co->start_html(),
       $co->end_html
      );



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

Date: Fri, 06 Jun 2003 13:53:19 +0200
From: Thomas Nagel <thomas.nagel@planb.de>
Subject: Re: redirect location prints to screen
Message-Id: <bbpvas$13r$1@sapa.inka.de>

Hi,

 > What am I doing wrong?  Here is the cgi code:
> 
> #!/usr/bin/perl
> $baseurl = 'http://www.economicsgroup.com/clients/';
> $user = $ENV{'REMOTE_USER'};
> $fullurl = $baseurl.lc($user);
> print "Location: $fullurl/\n\n";

Works perfectly for me.

What Webserver / Browser are you using?






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

Date: 6 Jun 2003 07:31:37 -0700
From: rferrante@tnsi.com (Rick Ferrante)
Subject: Re: regex based on numeric value
Message-Id: <726cd874.0306060631.60662e76@posting.google.com>

> tadmc@augustmail.com (Tad McClellan) wrote in message 
> > Why do you want to do mathematics with string operators?
> > 
> > Perl comes with numeric operators for working with numbers,
> > use them for your comparisons:
> > 
> >    if ($num =~ /(\d+\.\d+)/ and $1 > 75 )

Tad, great advice! I won't try. But since I already had a gui that
allows users to enter regex specifying the messages they are
interested in, I wanted to let them specify the numeric ranges in that
gui too. To do this, I used the regex comment field and allowed them
to encode their limitations. The code is a subroutine generator that
creates routines that will match the pattern given and evaluate
numeric constraints (<,>,>=,<=, and between) that the user specifies
in a regex comment. It returns a hash of all the memory matches.







$make_pattmatch = sub { my ($pat,$tag,$case) = @_; $pat=~s/#/\#/g;
my $qual;  $qual.=",$1=>['". lc($2) . "',$3,". (($5)?$5:0) . "]" while
($_[0]=~/ARPQUAL:M(\d+):(>|>=|<|<=|between\s+|not
between\s+)\s*([0-9.]+)(\s+and\s+([0-9.]*)){0,1}/ig);$qual=~s/,//;
 print "$qual\n" if ($qual);
eval 'sub {my $cnt=0;my %ret;my $tv;'.
 (($qual)?'my %qual=(' . $qual . ');'.
          '%ret=map{my $val=$_;
                     $tv++ if (
                              ($qual{$cnt}->[0] eq ">" and  $val <=
$qual{$cnt}->[1]) or
                              ($qual{$cnt}->[0] eq ">=" and $val <
$qual{$cnt}->[1]) or
                              ($qual{$cnt}->[0] eq "<" and  $val >=
$qual{$cnt}->[1]) or
                              ($qual{$cnt}->[0] eq "<=" and  $val >
$qual{$cnt}->[1]) or
                              ($qual{$cnt}->[0] =~ /^between\s*/ and 
($val < $qual{$cnt}->[1] or $val > $qual{$cnt}->[2])) or
                              ($qual{$cnt}->[0] =~ /^not between\s*/
and  ($val > $qual{$cnt}->[1] and $val < $qual{$cnt}->[2]))
                   );'.
            '"<$tag". $cnt++ .">" ,$_} map m#($pat)#o' .
(($case==0)?'i':'')  . ',$_[0];print "TV:$tv\n";(($tv)?():%ret); }'
         :'%ret=map{"<$tag". $cnt++ .">" ,$_} map m#($pat)#o' .
(($case==0)?'i':'')  . ',$_[0]; };'
    ) ;
};












rferrante@tnsi.com (Rick Ferrante) wrote in message news:<726cd874.0306050506.119eee@posting.google.com>...
> Tad, 
>   You're right. I was looking because I have an operational NMS system
> that applies regex patterns to incoming syslog messages where the
> regex's are stored in Oracle.  Therefore, I don't know in advance what
> kind of tests users may want to apply to the match variable
> ($1,$2,...).  Therefore, I was hoping to deal with it in the regex
> itself and be done.
> 
> But its just not that easy.
> 
> I'm thinking about encoding the additional requirements in a regex
> comment, parse that out and eval it if necessary.
> 
> Thanks!
> Rick
> 
> 
> tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnbdt5j1.nvd.tadmc@magna.augustmail.com>...
> > Rick Ferrante <rferrante@tnsi.com> wrote:
> > 
> > > Given a string like "Level 87.34"
> > > 
> > > Is there a regex that will match if the string is like "Level
> > > ([0-9.]+)" and \1 is > 75 ?
> > 
> > 
> > Why do you want to do mathematics with string operators?
> > 
> > Perl comes with numeric operators for working with numbers,
> > use them for your comparisons:
> > 
> >    if ($num =~ /(\d+\.\d+)/ and $1 > 75 )


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

Date: 6 Jun 2003 07:12:00 -0700
From: lawrence.tierney@bipcontracts.com (Lawrence Tierney)
Subject: Temporary "holding"/"Working" page - ideas?
Message-Id: <17e88dbe.0306060612.1b0ee613@posting.google.com>

Hi there,

Looking for some ideas.

Got a script which runs a sql search. This search can take anything up to 60
secs - quite a long time. What I'd like to do is while the mySQL is
doing its stuff display a page like "Hold on - searching".

So the logic would be (roughly):

user completes and submits form
      ||
sql search starts
      ||
temp page loads "Hold on -  searching" - whilst the search is in
progress
      ||
sql returns results
      ||
spit out results page - which replaces "Hold on - searching" page.

Any ideas/thoughts on this would be appreciated. Vaguely thought about forking
it when the sql search starts.......

Lawrence


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

Date: Fri, 06 Jun 2003 14:20:31 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Temporary "holding"/"Working" page - ideas?
Message-Id: <Pq1Ea.52295$da1.28612@nwrddc03.gnilink.net>

Lawrence Tierney wrote:
> Got a script which runs a sql search. This search can take anything
> up to 60 secs - quite a long time. What I'd like to do is while the
> mySQL is doing its stuff display a page like "Hold on - searching".

And your Perl question would be ......?

jue




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

Date: Fri, 06 Jun 2003 14:11:31 +0200
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: Time limit
Message-Id: <bbq3i5$nu4$1@news.dtag.de>

Jürgen Exner wrote:
>>A cookie that expires in xx
>>seconds, is that the only way ?
> 
> 
> Perl has cookies? Interesting....

http://search.cpan.org/author/GAAS/libwww-perl-5.69/lib/HTTP/Cookies.pm

:)



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

Date: Fri, 6 Jun 2003 07:50:41 -0400
From: "Mahboob" <mahboob@bellsouth.net>
Subject: Unable to lock array
Message-Id: <e5%Da.36650$0E3.5964@fe03.atl2.webusenet.com>

Hi,

I am writing a multi-threaded program but am not able to share an array
between the threads.

I have a directory called "oltest" under which there are sub-directories,
which have files with the extension .ud. The script does a find in the
oltest directory to store all files with .ud extension in the array udList.

It spawns 6 threads and my initial intention is that each thread should grab
(by shift) one file name from the list and print it. But all 6 threads are
printing the same file name. What is the fix for this?

The final intention is to get all the files in the list. As each thread gets
a file, which is a test case in a regression suite, it will pass it to a
back end Tuxedo server.

Thanks,
-- Mahboob

===============================================================
use strict;
use File::Find;
use Thread;

my @udList;
find sub {push @udList, $File::Find::name if /\.ud$/}, "oltest";

sub runUd {
        my $udNum;
        if (($udNum = @udList) > 0) {
                {
                        lock @udList;
                        my $ud = shift @udList;
                        my $tid = Thread->self->tid;
                        print "thread $tid: $ud\n";
                }
        }
        else {
                return;
        }
}

my @t;
for my $i (1..6) {
    push @t, Thread->new(\&runUd);
}

for my $t (@t) {
        $t->join();
}





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

Date: 6 Jun 2003 12:10:12 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: Unable to lock array
Message-Id: <slrnbe1154.6m2.sholden@flexal.cs.usyd.edu.au>

On Fri, 6 Jun 2003 07:50:41 -0400, Mahboob <mahboob@bellsouth.net> wrote:
> Hi,
> 
> I am writing a multi-threaded program but am not able to share an array
> between the threads.

Are you stuck with 5005threads, or can you use ithreads?

If you don't need to use 5005threads you should stop using the Thread module
which is labelled "for old code only".

I don't pretend to know anything about perl threading and so don't know
why @usList isn't being shared (maybe you are using ithreads - which doesn't
share data by default according to the docs).

Can you use the Thread::Queue module?

It would do all the locking stuff for you, and would also allow you to
run the File::Find as a thread (and hence in parallel) safely.

[snip]

> use strict;
> use File::Find;
> use Thread;
> 
> my @udList;
> find sub {push @udList, $File::Find::name if /\.ud$/}, "oltest";
> 
> sub runUd {
>         my $udNum;
>         if (($udNum = @udList) > 0) {
>                 {
>                         lock @udList;
>                         my $ud = shift @udList;
>                         my $tid = Thread->self->tid;
>                         print "thread $tid: $ud\n";
>                 }
>         }

That locking is faulty, in that a bunch of threads will end up shifting
from an empty array. If that's OK then I guess it doesn't really count as 
a fault. If it isn't then you should be checking the length after the lock.

-- 
Sam Holden



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

Date: 6 Jun 2003 06:52:40 -0700
From: tivolinewbie@canada.com (Kenjis Kaan)
Subject: Win32::GUI  for reporting display windows apps?
Message-Id: <6a8ba9f8.0306060552.7515a72e@posting.google.com>

Hello perl gurus,  I have a need for a Win32::Gui application to
display a report, can someone help me out.  Basically this application
runs on Windows and display selected contents retrieved from a
database source.   I initially wanted to display this info using a web
browser, but we are forbidden from setting up a web browser for
security reasons.  So I am forced to go with a Windows GUI method,
hence Win32::Gui.   But my knowledge of this module is only limited
mostly from google.com.   I am hoping someone has dealt with this
problem before and wrote some report displaying application similar,
could you please share ??  TIA


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

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.  

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


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