[24992] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7242 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 13 21:06:56 2004

Date: Wed, 13 Oct 2004 18: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           Wed, 13 Oct 2004     Volume: 10 Number: 7242

Today's topics:
    Re: [newbie] shtml question (krakle)
    Re: [newbie] shtml question (krakle)
    Re: [newbie] shtml question <noreply@gunnar.cc>
    Re: Error.pm and DBI.pm problem <perl&nntp@rhesa.com>
        Help with sorting lists of lists <dderakon@hotmail.com>
    Re: Help with sorting lists of lists <usa1@llenroc.ude.invalid>
    Re: Help with sorting lists of lists <dderakon@hotmail.com>
    Re: Help with sorting lists of lists <usa1@llenroc.ude.invalid>
    Re: Help with sorting lists of lists <emschwar@pobox.com>
    Re: HTML::Parser and <p> behaviour? <tomain@mailinator.com>
    Re: HTML::Parser and <p> behaviour? <geoff.cox@removethisplease.freeuk.com>
    Re: HTML::Parser and <p> behaviour? <usa1@llenroc.ude.invalid>
        odd problem with open() <colinDEL@howarth.de>
    Re: odd problem with open() <abigail@abigail.nl>
    Re: One liner to produce string of n '?'s separated by  (Tony N.)
    Re: One liner to produce string of n '?'s separated by  <abigail@abigail.nl>
    Re: Perl to monitor server stats <usa1@llenroc.ude.invalid>
        QA frameworks with perl <soundz@techie.com>
    Re: Range lookup <abigail@abigail.nl>
    Re: String and Array Programming in Perl (krakle)
    Re: Trying to force 32-bit in pack() (krakle)
    Re: Win2k - Ping - improved. <usa1@llenroc.ude.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 13 Oct 2004 15:26:33 -0700
From: krakle@visto.com (krakle)
Subject: Re: [newbie] shtml question
Message-Id: <237aaff8.0410131426.3bd2f388@posting.google.com>

Larry <dontmesswithme@got.it> wrote in message news:<dontmesswithme-12FA99.16174413102004@twister1.tin.it>...
> Hi folks!
> 
> Maybe this has been covered before but I didn'd find anything helpful on 
> google.

Google is only as good as you use it...

> I've a  .shtml?k=1000 kind of page,here's the code:

Oh that kind of page......

> 
> --
> <html>
>  <!-- #exec cgi="www.yousite.com/cgi-bin/page.cgi" -->
> </html>
> --

Looks like HTML using SSI... So where's the Perl?

>
> Now, I'd like to pass the "k" value to "page.cgi" (before .shtml page 
> being parsed by the server)

> Can It actually be done? (If not,I'll be in a mess!!!)

Did you try it?


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

Date: 13 Oct 2004 17:45:11 -0700
From: krakle@visto.com (krakle)
Subject: Re: [newbie] shtml question
Message-Id: <237aaff8.0410131645.286e5493@posting.google.com>

"Paul Lalli" <mritty@gmail.com> wrote in message news:<c3ebd.69$OK1.31@trndny06>...
> "Larry" <dontmesswithme@got.it> wrote in message
> news:dontmesswithme-FEC453.19401013102004@twister2.tin.it...
> > In article <2t507nF1rat4uU1@uni-berlin.de>,
> >  Gregory Toomey <nospam@bigpond.com> wrote:
> >
> > But I badly need to sort this problem out!!!
> >
> > so forget about TEMPLATE...i need to pass a query string to my cgi
>  script
> > ...
> 
> Apparently you don't need to sort it out badly enough to read the
> documentation I sent in my previous post.
> 
> Paul Lalli

What he needs to do is try it.. If it doesn't work then you can't do
it. His other options are messing with Apache... BUT he SHOULD ask
himself why needs to use SSI in the first place...


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

Date: Thu, 14 Oct 2004 02:51:02 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: [newbie] shtml question
Message-Id: <2t6133F1sihhbU1@uni-berlin.de>

krakle wrote:
> he SHOULD ask himself why needs to use SSI in the first place...

Can it possibly be because he has a Perl program that he wants to
invoke from a static HTML page?

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


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

Date: Mon, 11 Oct 2004 18:41:46 +0200
From: Rhesa Rozendaal <perl&nntp@rhesa.com>
To: Horst Walter <unkwb@web.de>
Subject: Re: Error.pm and DBI.pm problem
Message-Id: <416AB7CA.9070604@rhesa.com>

Horst Walter wrote:
> Here is a complete one you can run. I read all I found about error.pm,
> I am only not certain whether I have to include other use statements
> like qw(:catch).
> 
> Error is still 
> Error: Can't call method "with" without a package or object reference

Importing :try should be sufficient. The manual clearly states: "Error exports subroutines to perform exception handling. These will be exported if the :try tag is used in the use line."

I tried your test script, and it worked fine. Have you tried to use the "otherwise" function yet?
What version of Error are you using?

Can you try this script?

#!/usr/bin/perl

use strict;
use warnings;

use Data::Dumper;
use Error qw/:try/;

try {
    this_dies();
}
catch Error with {
    print Dumper(shift());
};

sub this_dies {
    die "Sorry...";
}

__END__



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

Date: Wed, 13 Oct 2004 23:21:11 -0000
From: Chris Weisiger <dderakon@hotmail.com>
Subject: Help with sorting lists of lists
Message-Id: <20041013162110752-0700@news.claremont.edu>


	I apologize if this is the wrong place to post this; please let me know 
the proper target if so.

	I have a list of lists of numbers, and I want to sort the sublists. 
Every variant on the syntax that I've tried either doesn't visibly do 
anything to sort the lists, or else undefines them all. Here's what I 
originally tried:

    for (my $i = 0; $i < $numActors; ++$i)
    {
        for (my $j = 0; $j < $actors[$i]; ++$j)
        {
            $prolls[$i][$j] = int (rand(20) + 1);
}        }
        @prolls[$i] = sort {$a <=> $b} @prolls[$i];
}    }

	I suspect that I'm getting tripped up by how Perl handles lists of 
lists and references and all that, but all the searching I've done 
hasn't turned up anything that's worked. Any help would be appreciated.

	For reference, I'm working on a dice rolling program for the Donjon 
tabletop RPG. It's a great system, but it needs a lot of d20s...

-- 
"Don't take life so serious, son - it ain't nohow permanent." - 
Porkypine
http://www.cs.hmc.edu/~cweisige


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

Date: 13 Oct 2004 23:42:56 GMT
From: "A. Sinan Unur" <usa1@llenroc.ude.invalid>
Subject: Re: Help with sorting lists of lists
Message-Id: <Xns9581C8D83428asu1cornelledu@132.236.56.8>

Chris Weisiger <dderakon@hotmail.com> wrote in
news:20041013162110752-0700@news.claremont.edu: 

>  I have a list of lists of numbers, and I want to sort the
>  sublists. 

> Every variant on the syntax that I've tried either doesn't visibly do 
> anything to sort the lists, or else undefines them all. Here's what I 
> originally tried:
> 
>     for (my $i = 0; $i < $numActors; ++$i)

Life is generally easier without C-style loops.

>     {
>         for (my $j = 0; $j < $actors[$i]; ++$j)
>         {
>             $prolls[$i][$j] = int (rand(20) + 1);
> }        }
>         @prolls[$i] = sort {$a <=> $b} @prolls[$i];

You should 

use strict;

and

use warnings;

What you probably want to do is set the $i th element of @prolls to a 
reference to the sorted array: i.e. (untested)

$prolls[$i] = [ sort { $a <=> $b } @{ $prolls[$i] } ];

Since you did not post a self-contained script that I could run (why not?), 
I am not sure this would solve your problem. Take a look at 

perldoc perlreftut

#! perl

use strict;
use warnings;

my @lol = (
    [ 3, 7, 4, 5 ],
    [ 11, 15, 1, 3, 5 ],
    [ 2, 1, -1, 3, 4, 5, 9, 22, 11 ],
);

for (@lol) {
    $_= [ sort {$a <=> $b} @{ $_ } ];
}

use Data::Dumper;
print Dumper \@lol;
__END__

Sinan


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

Date: Wed, 13 Oct 2004 23:54:11 -0000
From: Chris Weisiger <dderakon@hotmail.com>
Subject: Re: Help with sorting lists of lists
Message-Id: <20041013165411610-0700@news.claremont.edu>

On 10/13/04 4:42 PM, A. Sinan Unur wrote:
> Chris Weisiger <dderakon@hotmail.com> wrote in
> news:20041013162110752-0700@news.claremont.edu: 
> 
>>  I have a list of lists of numbers, and I want to sort the
>>  sublists. 
> 
>> Every variant on the syntax that I've tried either doesn't visibly do 
>> anything to sort the lists, or else undefines them all. Here's what I 
>> originally tried:
>> 
>>     for (my $i = 0; $i < $numActors; ++$i)
> 
> Life is generally easier without C-style loops.

	Probably; my style is in general not that good since it's a mishmash of 
C styles and Perl styles. 

> 
> You should 
> 
> use strict;
> 
> and
> 
> use warnings;

	Done and done, as a matter of course.

> 
> What you probably want to do is set the $i th element of @prolls to a 
> reference to the sorted array: i.e. (untested)
> 
> $prolls[$i] = [ sort { $a <=> $b } @{ $prolls[$i] } ];

	And this does the trick. Thank you very much. I'm still not certain 
exactly what is going on here, but at least the code works.

> 
> Since you did not post a self-contained script that I could run (why 
> not?),  I am not sure this would solve your problem. Take a look at 
>
> perldoc perlreftut

	Strange that perldoc.com didn't come up in my copious Google searching. 
I'll keep it bookmarked. Again, thanks.
 
-- 
"Don't take life so serious, son - it ain't nohow permanent." - 
Porkypine
http://www.cs.hmc.edu/~cweisige


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

Date: 14 Oct 2004 00:15:12 GMT
From: "A. Sinan Unur" <usa1@llenroc.ude.invalid>
Subject: Re: Help with sorting lists of lists
Message-Id: <Xns9581CE50DBF7Basu1cornelledu@132.236.56.8>

Chris Weisiger <dderakon@hotmail.com> wrote in
news:20041013165411610-0700@news.claremont.edu: 

>> perldoc perlreftut
> 
>      Strange that perldoc.com didn't come up in my copious Google
>      searching. 

No need to venture out to the whole world wide web. You can access the Perl 
documentation installed on your computer using this command from the shell 
you are using.

To see the available documentation, type

perldoc perltoc

on the command line.

Sinan.


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

Date: Wed, 13 Oct 2004 18:28:30 -0600
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: Help with sorting lists of lists
Message-Id: <eto8yaauor5.fsf@wilson.emschwar>

Chris Weisiger <dderakon@hotmail.com> writes:
> On 10/13/04 4:42 PM, A. Sinan Unur wrote:
>> $prolls[$i] = [ sort { $a <=> $b } @{ $prolls[$i] } ];
>
> 	And this does the trick. Thank you very much. I'm still not certain 
> exactly what is going on here, but at least the code works.

Cargo-cult programming, even when the source is a Respected Regular,
is always bad.  So let's take a look at what's going on, shall we?

>> $prolls[$i] = 

Well, you know what this is, I hope, so we'll skip to the right-hand side.

>> [ sort { $a <=> $b } @{ $prolls[$i] } ]

[ something ] returns a reference to an anonymous array that contains
              the list 'something'.  By that, we know two things:

1) $prolls[$i] will contain a reference to an anonymous array, and
2) sort { $a <=> $b } @{ $prolls[$i] } is a list, or at the very least 
   will be interpreted in list context.

Okay, given that, we're almost done, but since I'm taking baby steps
already, I'll continue for the benefit of the peanut gallery.  If you
look up the documentation for 'sort' (via: 'perldoc -f sort' at the
command line), you will see that one of its forms is

sort BLOCK LIST

I'll leave reading sort's documentation to you, Dear Reader, but the
clear implication of this is that 

>> { $a <=> $b }

is a block, and 

>> @{ $prolls[$i] }

is a list.  This is further confirmed by the fact that @{ something }
is one way to dereference a reference to an array, and get that array
back.  This is documented in perlref.pod; read it NOW, via 'perldoc
perlref' at the command line.

As a consequence of THAT, we know that $prolls[$i] is an arrayref,
which is convenient, because if you look back up to the top of this
message, I showed that we are assigning an arrayref back to
$prolls[$i].

Does that make sense?

-=Eric
-- 
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
		-- Blair Houghton.


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

Date: Wed, 13 Oct 2004 17:48:13 -0500
From: Tom <tomain@mailinator.com>
Subject: Re: HTML::Parser and <p> behaviour?
Message-Id: <3libd.308$Z9.159@fe25.usenetserver.com>

187 wrote:

> 
> 
> Grated soem sample code would of been nice, the situation was still
> described to the point wher someone who has worked with that module
> might be able to help.

No it wasn't.

> 
> Your assine tone, as well as your direct insults to the OP, was
> completely unwarrented.

No they weren't. There are too many idiots like you who should be 
frequenting comp.lang.basic rather than this newsgroup.

> 
> You could of just rplied asking for more information, but if you could
> not tell the situation from the initial post then I doubt you would of
> been able to help. (I would attemt but I am not very familiar with this
> module).
> 
> There is NO excuse for your tone in this thread.
> 
> 

There is NO excuse for you and your bad spelling to frequent this 
esteemed newsgroup at all. The OP's question was stupid, and in fact 
incapable of being answered. Go away.




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

Date: Wed, 13 Oct 2004 23:32:35 GMT
From: Geoff Cox <geoff.cox@removethisplease.freeuk.com>
Subject: Re: HTML::Parser and <p> behaviour?
Message-Id: <aferm01p7aq9m0fnohf0on0oe0d64deu97@4ax.com>

On 13 Oct 2004 20:24:19 GMT, "A. Sinan Unur"
<1usa@llenroc.ude.invalid> wrote:

>Geoff Cox <geoff.cox@removethisplease.freeuk.com> wrote in
>news:a31rm05784u5g7stoojk2rogj49dfn35t1@4ax.com: 

>I suspect the handler is being called multiple times, each time with a 
>different part of the original text. You can test this hypothesis by 
>putting a debug statement in here.

You seem to be correct - I have simplified the code and placed a
simple html file (below) in d:\fred and the result appears in
d:\fred\jim and indeed the <p> ... </p>text is there twice. Any ideas
why?

Thanks

Geoff

package MyParser;
use base qw(HTML::Parser);
use strict;
use diagnostics;

my ($in_heading,$in_p,$fh);

sub register_fh {

$fh = $_[1];
}

sub reset { ($in_heading,$in_p)=(0,0)}

sub start {

    my ( $self, $tagname, $attr, undef, $origtext ) = @_;

    if ( $tagname eq 'h2' ) {
        $in_heading = 1;
        return;
    }

    if ( $tagname eq 'p' ) {
        $in_p = 1;
        return;
    }

}

sub end {
    my ( $self, $tagname, $origtext ) = @_;

    if ( $tagname eq 'h2' ) {
        $in_heading = 0;
        return;
    }

    if ( $tagname eq 'p' ) {
        $in_p = 0;
        return;
    }

}

sub text {
    my ( $self, $origtext ) = @_;

    print $fh "<h2>$origtext</h2> \n" if $in_heading;
    print $fh "<p>$origtext</p> \n" if $in_p;

}

package main;

use File::Find;

my $dir = "d:/fred";
my $parser = MyParser->new;

find sub {
    return if -d $_;

    my $name = $_;
    open( OUT, ">>d:/fred/jim/$name" )
     || die "can't open d:/fred/jim/$name: $!";

    print OUT ("<html><head><title>test</title>
    </head><body> \n");

    $parser->register_fh(\*OUT);
    $parser->parse_file($_);
    $parser->reset;

    print OUT ("</body></html> \n");

}, $dir;


--------------- html file ---------------------------
<html>
<head>
<title>test</title>
</head>

<body>

<h2>test file</h2>

<p>The is some text which I am using to test whether para.pl using
HTML::Parser will output all of the text in this paragraph in one
paragraph, or, in two smaller paragraphs.</p>


</body>
</html>


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

Date: 14 Oct 2004 00:07:44 GMT
From: "A. Sinan Unur" <usa1@llenroc.ude.invalid>
Subject: Re: HTML::Parser and <p> behaviour?
Message-Id: <Xns9581CD0C7850Basu1cornelledu@132.236.56.8>

Geoff Cox <geoff.cox@removethisplease.freeuk.com> wrote in 
news:aferm01p7aq9m0fnohf0on0oe0d64deu97@4ax.com:

> On 13 Oct 2004 20:24:19 GMT, "A. Sinan Unur"
> <1usa@llenroc.ude.invalid> wrote:
> 
>>Geoff Cox <geoff.cox@removethisplease.freeuk.com> wrote in
>>news:a31rm05784u5g7stoojk2rogj49dfn35t1@4ax.com: 
> 
>>I suspect the handler is being called multiple times, each time with a 
>>different part of the original text. You can test this hypothesis by 
>>putting a debug statement in here.
> 
> You seem to be correct - I have simplified the code and placed a
> simple html file (below) in d:\fred and the result appears in
> d:\fred\jim and indeed the <p> ... </p>text is there twice. Any ideas
> why?

I think you probably want to emit the start and end tags only when the 
start and end callbacks are invoked. I tried to shorten your script to deal 
only with the p case:

use strict;
use warnings;

package MyParser;
use base qw(HTML::Parser);

my ($in_p, $fh);

sub register_fh { $fh = $_[1]; }

sub start {
    my ($p, $t, $a, undef, $txt ) = @_;

    if ($t eq 'p') {
        $in_p = 1;
        print $fh '<p>';
        return;
    }
}

sub end {
    my ($p, $t, $txt) = @_;

    if ($t eq 'p') {
        $in_p = 0;
        print $fh "</p>\n";
        return;
    }
}

sub text {
    my ($p, $txt) = @_;
    print $fh $txt if ($in_p);
}

package main;

my $p = MyParser->new;
$p->register_fh(\*STDOUT);

print <<HEADER;
<html>
<head>
<title>Test Output</title>
</head>
<body>
HEADER

$p->parse_file(\*DATA);

print <<FOOTER;
</body>
</html>
FOOTER

__DATA__
<html>
<head>
<title>test</title>
</head>

<body>

<h2>test file</h2>

<p>The is some text which I am using to test whether para.pl using
HTML::Parser will output all of the text in this paragraph in one
paragraph, or, in two smaller paragraphs.</p>


</body>
</html>



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

Date: Thu, 14 Oct 2004 00:40:05 +0200
From: Colin Howarth <colinDEL@howarth.de>
Subject: odd problem with open()
Message-Id: <ckkas5$h12$00$1@news.t-online.com>

Hi, I'm running perl 5.6.0 on Mac OS X (darwin) and have a program with 
the following code:

  sub do_dir {
       my $dir = shift;
 ...
        opendir(DIR, $dir) or die "Can't open directory '$dir' $!";

        while ($file = readdir(DIR)) {
                next if $file =~ /^\.\.?$/;
                next if -l "$dir/$file";

                if (-d "$dir/$file") {
                        do_dir("$dir/$file");
                } elsif (-f "$dir/$file") {
                         open(FILE, "$dir/$file") or die "Can't open 
'$dir/$file': $!";

                        ...
}

i.e. it's recursing through the filesystem, skipping symbolic links 
(because there are entries linked back to a parent directory (!)) and 
skipping '.' and '..' of course.

This works fine except when it comes across a filename like

/Library//CFMSupport/StuffItEngineShell.cfm/Icon^M

i.e. where the last character is a CR, when the program dies.

Now, I don't know why the odd file has a CR in it's name, but why 
doesn't open() work anyway?

At present I've resorted to

#               chop $file if $file =~/\r$/;
                chop $file if substr($file, -1, 1) eq "\r";

(substr seems to be slightly quicker here)

Thanks,

colin



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

Date: 14 Oct 2004 00:28:20 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: odd problem with open()
Message-Id: <slrncmri14.34g.abigail@alexandra.abigail.nl>

Colin Howarth (colinDEL@howarth.de) wrote on MMMMLXI September MCMXCIII
in <URL:news:ckkas5$h12$00$1@news.t-online.com>:
[]  Hi, I'm running perl 5.6.0 on Mac OS X (darwin) and have a program with 
[]  the following code:
[]  
[]    sub do_dir {
[]         my $dir = shift;
[]  ...
[]          opendir(DIR, $dir) or die "Can't open directory '$dir' $!";
[]  
[]          while ($file = readdir(DIR)) {
[]                  next if $file =~ /^\.\.?$/;
[]                  next if -l "$dir/$file";
[]  
[]                  if (-d "$dir/$file") {
[]                          do_dir("$dir/$file");
[]                  } elsif (-f "$dir/$file") {
[]                           open(FILE, "$dir/$file") or die "Can't open 
[]  '$dir/$file': $!";
[]  
[]                          ...
[]  }
[]  
[]  i.e. it's recursing through the filesystem, skipping symbolic links 
[]  (because there are entries linked back to a parent directory (!)) and 
[]  skipping '.' and '..' of course.
[]  
[]  This works fine except when it comes across a filename like
[]  
[]  /Library//CFMSupport/StuffItEngineShell.cfm/Icon^M
[]  
[]  i.e. where the last character is a CR, when the program dies.

Where does the program die? In the open? Due to open returning false?
If so, what's the message in $!?

[]  Now, I don't know why the odd file has a CR in it's name, but why 
[]  doesn't open() work anyway?

Does the file actually exist? Do you have permission to read it?

[]  At present I've resorted to
[]  
[]  #               chop $file if $file =~/\r$/;
[]                  chop $file if substr($file, -1, 1) eq "\r";
[]  
[]  (substr seems to be slightly quicker here)

How many files are you opening that such a difference matters?



Abigail
-- 
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"


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

Date: 13 Oct 2004 15:29:12 -0700
From: tnitzke@simpson.com (Tony N.)
Subject: Re: One liner to produce string of n '?'s separated by commas ... ?
Message-Id: <638483db.0410131429.4514f7fb@posting.google.com>

"Richard Gration" <richard@zync.co.uk> wrote in message news:<ckj69c$4up$1@news.freedom2surf.net>...
> Anyone for golf?
> 
> 
> 	$n = 10;
> 	$vals = join ',', split //,'?' x $n;
> 
Yet another way:

print join ',', map('?', 1..10)


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

Date: 13 Oct 2004 22:29:53 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: One liner to produce string of n '?'s separated by commas ... ?
Message-Id: <slrncmrb31.34g.abigail@alexandra.abigail.nl>

Richard Gration (richard@zync.co.uk) wrote on MMMMLXI September MCMXCIII
in <URL:news:ckj69c$4up$1@news.freedom2surf.net>:
""  Anyone for golf?
""  
""  I can't think of anything shorter
""  
""  	$n = 10;
""  	$vals = join ',', split //,'?' x $n;
""  
""  In case anyone was wondering, this _is_ SQL related ;-)


    $vals=("?,"x9)."?";



Abigail
-- 
# Perl 5.6.0 broke this.
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi


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

Date: 14 Oct 2004 00:18:23 GMT
From: "A. Sinan Unur" <usa1@llenroc.ude.invalid>
Subject: Re: Perl to monitor server stats
Message-Id: <Xns9581CEDAA2917asu1cornelledu@132.236.56.8>

"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in 
news:Xns95819CC47D80Aasu1cornelledu@132.236.56.8:

> I have not used them, but have you looked at
> 
> Win32::NetAdmin
> 
> and
> 
> Win32::NetResource

On second thought, those modules don't seem to do what you want. Sorry.

Sinan.


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

Date: Wed, 13 Oct 2004 16:57:48 -0700
From: Mark Day <soundz@techie.com>
Subject: QA frameworks with perl
Message-Id: <416DC0FC.6020304@techie.com>

Can anyone point me to an on line tutorial regarding developing QA test 
harnesses and frameworks using perl. I am aware of some relevant modules 
on CPAN, but looking for a general overview, examples and introduction.

Thanks in advance.



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

Date: 13 Oct 2004 22:40:38 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Range lookup
Message-Id: <slrncmrbn5.34g.abigail@alexandra.abigail.nl>

Yash (yashgt@yahoo.com) wrote on MMMMLXI September MCMXCIII in
<URL:news:5a373b1d.0410130456.4f12e63d@posting.google.com>:
""  I have a set of ranges such as
"" <0.1%
""  0.1-0.2%
""  0.2-0.3%
""  0.3-0.4%
""  0.4-0.5%
""  0.5-0.6%
""  0.6-0.7%
""  0.7-0.8%
""  0.8-0.9%
""  0.9-1.0%
""  1.0-1.5%
""  1.5-2.0%
""  2.0-2.5%
""  2.5-3.0%
""  3-20%
""  20-30%
""  30-40%
"" >40%
""  
""  and I have to identify the range that contains an input value such as
""  1.25. The above set of ranges is not fixed and is configurable in a
""  text file.
""  Can somebody suggest the most efficient way to do this, in terms of
""  the data structure to use and the lookup technique to apply.


What a good method is depends on a couple of things. First, does the
set of ranges overlap each other, that is, are there points that belong
to more than one range? Second, how many queries per set of ranges
will you do? If you just have a couple, there's no point in doing any
preprocessing.  Otherwise, building a datastructure might pay off.

BTW, note that your question has nothing at all to do with Perl. Finding
the most appropriate datastructure for this problem is independent of
the language being used.


Abigail
-- 
               split // => '"';
${"@_"} = "/"; split // => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_)  {print "$_ $_{$_} "}};
%{"@_"} = %_ = (Just => another => Perl => Hacker); &{%{%_}};


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

Date: 13 Oct 2004 16:02:48 -0700
From: krakle@visto.com (krakle)
Subject: Re: String and Array Programming in Perl
Message-Id: <237aaff8.0410131502.36df7008@posting.google.com>

Phillip.Small@gmail.com (DeveloperGuy) wrote in message news:<64f06fa2.0410121120.4b777d7c@posting.google.com>...
> I am very very new to Perl and am trying automate a process in my AIX
> Unix box.  I issed the command ps -aef and sent it to a file.  How do
> I get how many different users running programs, the total time for
> each user in hours:minutes format, and who is running the longest
> process and the program name?  I am not familiar with using the loops.
>  I know that I can probably use the date command to specify the date. 
> This is where I am stuck thus far. Please help anyone...
> 
> #! /usr/bin/perl
> 
> use strict;
> use warnings;
> 
> @users;
> @tmpfile = OPEN(DataFileHandle, /home/smallp/data.txt);
> 
> $tmpfile[0];
> $users[0];
> 
>    for ($count= 0; $count <= $#users; $count++;) {
>      If $tmpline[0] eq $users[i] 
>       if TRUE then exit
>     push(@users, $users[0]);
> }

This isn't Perl this is SHIT... You must NOT of read anything at
all... Pick up a book or read a tutorial or the manpages.. I'm not
even going to rewrite this crap...


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

Date: 13 Oct 2004 16:11:26 -0700
From: krakle@visto.com (krakle)
Subject: Re: Trying to force 32-bit in pack()
Message-Id: <237aaff8.0410131511.683ebb8a@posting.google.com>

"Brad Walton" <sammie-nospam@greatergreen.com> wrote in message news:<AN6dnVxQ75fw-_HcRVn-tA@comcast.com>...
> 18+2+3 should = 22 bytes sent

It does? 18+2+3=22? :)


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

Date: 13 Oct 2004 22:13:45 GMT
From: "A. Sinan Unur" <usa1@llenroc.ude.invalid>
Subject: Re: Win2k - Ping - improved.
Message-Id: <Xns9581B9B985D3Easu1cornelledu@132.236.56.8>

kejoseph@hotmail.com (Kevin Joseph) wrote in 
news:54c48ac0.0410131323.59838e80@posting.google.com:

> The moment I uncomment the for loop, the first iteration works fine,
> subsequent show only 0ms (almost as if its caching it.) Any ideas as
> to what I am doing wrong ?

For starters, you don't have 

use strict;
use warnings;

which would have enabled you to detect an error below.

> $p = Net::Ping->new(icmp) ;

Notice something wrong here?

Please do not post code without 'strict' and 'warnings'.

I observed the same behavior testing on my home network. The issue 
disappears the moment I reach outside my home network. Incidentally, the 
Win32 command line ping also shows the same behavior. Thus, it appears as 
though this is not a Perl issue.

Sinan.


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

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


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