[22953] in Perl-Users-Digest
Perl-Users Digest, Issue: 5173 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 3 11:05:45 2003
Date: Thu, 3 Jul 2003 08:05:09 -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 Thu, 3 Jul 2003 Volume: 10 Number: 5173
Today's topics:
Re: "Word too long" ? And exactly WHAT word might that (bm)
Re: Alternative to use vars <tassilo.parseval@rwth-aachen.de>
Re: Alternative to use vars (Greg Bacon)
Call parent method indirectly <REMOVEsdnCAPS@comcast.net>
Re: Call parent method indirectly <ubl@schaffhausen.de>
Getting the size of files from a list? (Math55)
Re: Getting the size of files from a list? <noreply@gunnar.cc>
Re: Getting the size of files from a list? <abigail@abigail.nl>
Re: help with regular expressions (Tad McClellan)
Re: How to put a filehandle into a hash array? <usenet@NOSPAM.matthewb.org>
Re: How to put a filehandle into a hash array? (Tad McClellan)
Re: HTTP Headers (dan baker)
Re: installing perl modules via ftp <flavell@mail.cern.ch>
Re: installing perl modules via ftp <noreply@gunnar.cc>
Re: k operator in REGEX?? <member31962@dbforums.com>
Re: k operator in REGEX?? <abigail@abigail.nl>
Re: need assistance understanding multilevel hashes. <allen.wooden@educate.invalid>
Re: Need help with Win32::GuiTest and Indigo perl <awingnut@hotmail.com>
Re: Need Perl teacher/school: Network programming <asu1@c-o-r-n-e-l-l.edu>
perl script generates sendmail NOQUEUE: connect from ro (Jhary-a-Conel)
Re: perl script generates sendmail NOQUEUE: connect fro (Greg Bacon)
Re: script for unrestricted permutation (Jay Tilton)
Re: Using Perl with ESRI ArcGIS? Or VB foolishness? (qu1kb1rd)
Re: UTF16 and Control M's <flavell@mail.cern.ch>
What is swash? (Simon Fairey)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 3 Jul 2003 04:22:01 -0700
From: contact_brad@email.com (bm)
Subject: Re: "Word too long" ? And exactly WHAT word might that be? Curious
Message-Id: <c1d7e6a1.0307030322.3592d263@posting.google.com>
genericax@hotmail.com (Sara) wrote in message news:<776e0325.0307020518.2e428903@posting.google.com>...
> I have a script that runs fine, but on invocation in csh or bash or
> tcsh or ksh, the script reports:
>
> Word too long
>
> before a single line is executed (I'm starting in the debugger). Other
> than that message everything seems fine.
>
I have seen this happen when environment variables exceed their maximum
length. Is your script modifying %ENV?
------------------------------
Date: 3 Jul 2003 10:33:08 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Alternative to use vars
Message-Id: <be10p4$m6m$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Eric J. Roode:
> gbacon@hiwaay.net (Greg Bacon) wrote in news:vg5mmas61oi489
> @corp.supernews.com:
>
>> You can also declare the globals with our:
>>
>> our $scalar;
>> our @array;
>> our %hash;
>>
>> See the perlfunc documentation on our for details.
>
> Maybe I'm dense.... I have yet to grasp the advantage of 'our' over 'use
> vars'.
You are not the only one trying to grasp that. The concept of lexically
scoped global (that is, dynamic) variables truely escapes me. The only
advantage I see is that you can introduce new global variables
everywhere easily like so:
our $var;
....
....
our $another_var;
Of course, 'use vars' can also be used multiple times. It's just a
little more to type.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: Thu, 03 Jul 2003 12:34:41 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: Alternative to use vars
Message-Id: <vg88n1d6cso44d@corp.supernews.com>
In article <Xns93AD38EEF9A1Dsdn.comcast@206.127.4.25>,
Eric J. Roode <REMOVEsdnCAPS@comcast.net> wrote:
: Maybe I'm dense.... I have yet to grasp the advantage of 'our' over
: 'use vars'.
Declaring variables with our is more finely grained than use vars.
As the perlfunc documentation on our puts it,
The our declaration has no semantic effect unless "use
strict vars" is in effect, in which case it lets you
use the declared global variable without qualifying it
with a package name. (But only within the lexical
scope of the our declaration. In this it differs from
"use vars", which is package scoped.)
You can use our's lexical scope to cross package boundaries, as this
example (ibid.) shows:
package Foo;
our $bar; # declares $Foo::bar for rest of lexical scope
$bar = 20;
package Bar;
print $bar; # prints 20
See http://www.perldoc.com/perl5.8.0/pod/func/our.html
Yes, the difference is a bit subtle, but, if nothing else, it's less
typing. :-)
Hope this helps,
Greg
------------------------------
Date: Thu, 03 Jul 2003 05:10:08 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Call parent method indirectly
Message-Id: <Xns93AD3EB75BC99sdn.comcast@206.127.4.25>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
To call a method in a class indirectly, you do:
$self->$method(@args);
To call a specific method in the parent class, you do:
$self->SUPER::foo(@args);
How do you delegate to a parent method indirectly? This:
$self->SUPER::$method(@args);
doesn't work -- it reports "Bad name after ::".
Is there a way to do this without eval? I am using AUTOLOAD to generate
simple accessor/mutator methods in my class (table-driven design), and want
to delegate unknown methods to the parent class (since many methods will be
inherited from the parent).
- --
Eric
$_ = reverse sort qw p ekca lre Js reh ts
p, $/.r, map $_.$", qw e p h tona e; print
-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBPwQA8GPeouIeTNHoEQIBIQCcCLPo8nnh8y9liZ5t/XomMzkTk90An2Bj
kfso0B0KoynkEUulLEh3JTKr
=CGuJ
-----END PGP SIGNATURE-----
------------------------------
Date: Thu, 03 Jul 2003 13:17:56 +0200
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: Call parent method indirectly
Message-Id: <be16hb$32n$1@news.dtag.de>
Eric J. Roode wrote:
> How do you delegate to a parent method indirectly? This:
>
> $self->SUPER::$method(@args);
my $super = "SUPER::$method";
$self->$super(@args)
> doesn't work -- it reports "Bad name after ::".
>
> Is there a way to do this without eval? I am using AUTOLOAD to generate
> simple accessor/mutator methods in my class (table-driven design), and want
> to delegate unknown methods to the parent class (since many methods will be
> inherited from the parent).
Maybe you want to use delegation to delegate (as opposed to inheritance)?
bye
malte
------------------------------
Date: 3 Jul 2003 06:43:34 -0700
From: magelord@t-online.de (Math55)
Subject: Getting the size of files from a list?
Message-Id: <a2b8188a.0307030543.19cea0e7@posting.google.com>
hi, lets say i have this list (its in a file):
32k /var/log/XFree86.0.log
76k /var/log/auth.log
116k /var/log/auth.log.0
8.0k /var/log/auth.log.1.gz
228k /var/log/kdm.log
20k /var/log/kern.log
1.2M /var/log/kern.log.0
12k /var/log/kern.log.1.gz
2.8M /var/log/ksymoops
228k /var/log/ksymoops/20030628062520.ksyms
4.0k /var/log/ksymoops/20030628062520.modules
228k /var/log/ksymoops/20030629062502.ksyms
4.0k /var/log/ksymoops/20030629062502.modules
12k /var/log/ksymoops/20030630.log
228k /var/log/ksymoops/20030630062525.ksyms
4.0k /var/log/ksymoops/20030630062525.modules
12k /var/log/ksymoops/20030701.log
228k /var/log/ksymoops/20030701062504.ksyms
how can i get the size from the 9 files in /var/log/ksymoops and how
the size of the 8 files in /var/log? the list is noct always the same,
it can have more or less directories. i tried it like that so far:
1. get all directories and uniqed them. looks like that:
/var/log
/var/log/ksymoops
2. put them into a hash as keys
3. filtered the list so i get something that can be compared to the
keys
12k /var/log/ksymoops/20030701.log-->/var/log
4. when this already exists inside the hash, i get the size and add it
to the key /var/log as value. i do this with all keys and i think the
correct size for both dirs should be calculated. but the size is
wrong.
this is what i want to have:
/var/log:1720.8
/var/log/ksymoops:3815.2
is therea better and less complicated way to do that?
THANK YOU :)
------------------------------
Date: Thu, 03 Jul 2003 16:50:57 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Getting the size of files from a list?
Message-Id: <be1frm$75d3$1@ID-184292.news.dfncis.de>
Math55 wrote:
> hi, lets say i have this list (its in a file):
>
> 32k /var/log/XFree86.0.log
> 76k /var/log/auth.log
> 116k /var/log/auth.log.0
> 8.0k /var/log/auth.log.1.gz
> 228k /var/log/kdm.log
> 20k /var/log/kern.log
> 1.2M /var/log/kern.log.0
> 12k /var/log/kern.log.1.gz
> 2.8M /var/log/ksymoops
> 228k /var/log/ksymoops/20030628062520.ksyms
> 4.0k /var/log/ksymoops/20030628062520.modules
> 228k /var/log/ksymoops/20030629062502.ksyms
> 4.0k /var/log/ksymoops/20030629062502.modules
> 12k /var/log/ksymoops/20030630.log
> 228k /var/log/ksymoops/20030630062525.ksyms
> 4.0k /var/log/ksymoops/20030630062525.modules
> 12k /var/log/ksymoops/20030701.log
> 228k /var/log/ksymoops/20030701062504.ksyms
>
> how can i get the size from the 9 files in /var/log/ksymoops
> and how the size of the 8 files in /var/log?
<snip>
> this is what i want to have:
>
> /var/log:1720.8
> /var/log/ksymoops:3815.2
One way:
#!/usr/bin/perl
use strict;
use warnings;
my ($dir1, $dir2);
my $path = '/some/path/to/the/file';
open FH, "< $path" or die $!;
while (<FH>) {
my ($value, $sort, $file) = /^([\d.]+)(\w)\t(.+)/;
$value *= 1024 if $sort eq 'M';
if ($file =~ m!^/var/log/ksymoops!) {
$dir2 += $value;
} else {
$dir1 += $value;
}
}
close FH;
print "/var/log:$dir1\n/var/log/ksymoops:$dir2\n";
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 03 Jul 2003 14:58:36 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Getting the size of files from a list?
Message-Id: <slrnbg8h4s.pg4.abigail@alexandra.abigail.nl>
Math55 (magelord@t-online.de) wrote on MMMDXCIII September MCMXCIII in
<URL:news:a2b8188a.0307030543.19cea0e7@posting.google.com>:
][ hi, lets say i have this list (its in a file):
][
][
][ 32k /var/log/XFree86.0.log
][ 76k /var/log/auth.log
][ 116k /var/log/auth.log.0
][ 8.0k /var/log/auth.log.1.gz
][ 228k /var/log/kdm.log
][ 20k /var/log/kern.log
][ 1.2M /var/log/kern.log.0
][ 12k /var/log/kern.log.1.gz
][ 2.8M /var/log/ksymoops
][ 228k /var/log/ksymoops/20030628062520.ksyms
][ 4.0k /var/log/ksymoops/20030628062520.modules
][ 228k /var/log/ksymoops/20030629062502.ksyms
][ 4.0k /var/log/ksymoops/20030629062502.modules
][ 12k /var/log/ksymoops/20030630.log
][ 228k /var/log/ksymoops/20030630062525.ksyms
][ 4.0k /var/log/ksymoops/20030630062525.modules
][ 12k /var/log/ksymoops/20030701.log
][ 228k /var/log/ksymoops/20030701062504.ksyms
Something like (untested code):
my %total;
while (<>) {
my ($size, $dir) = m!(\S+)\s+(\S+)/! or next;
if ($size =~ s/k$//) {$size *= 1024}
elsif ($size =~ s/M$//) {$size *= 1024 * 1024}
$total {$dir} += $size;
}
while (my ($dir, $size) = each %total) {
printf "%s:%.1f\n" => $dir, $size / 1024;
}
Abigail
--
print v74.117.115.116.32;
print v97.110.111.116.104.101.114.32;
print v80.101.114.108.32;
print v72.97.99.107.101.114.10;
------------------------------
Date: Thu, 3 Jul 2003 06:29:19 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: help with regular expressions
Message-Id: <slrnbg84sf.3o1.tadmc@magna.augustmail.com>
Jay <jranchordas@hotmail.com> wrote:
> while ()($thisrow = <FILE>))
What's with all those (unbalanced) parenthesis?
> $thisrow =~ s/\<\/textarea\>/\<\*textarea\>/;
^ ^ ^ ^ ^
^ ^ ^ ^ ^
What's with all those unnecessary backslashes?
> This obviously doesn't work and I was wondering if any of you guys
> could shed some light to the darkness that I am experiencing.
You have a syntax error in the while statement.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 03 Jul 2003 11:06:57 +0100
From: "Matthew Browning" <usenet@NOSPAM.matthewb.org>
Subject: Re: How to put a filehandle into a hash array?
Message-Id: <pan.2003.07.03.10.06.56.290749@NOSPAM.matthewb.org>
On Thu, 03 Jul 2003 00:59:59 +0000, Vsevolod Afanassiev wrote:
> I need to build an array of filehandles so different records go into
> different output files depending on a value. This is the code:
>
> $dt = 20030701;
>
> open ( "$FH{$dt}", ">output" . "." . $dt ) or die "$!";
If I understand your question correctly, you may find the IO::File
module helpful, which will let you do something like this:
my $file1 = IO::File->new( '>file1' );
my $file2 = IO::File->new( '>file2' );
push @filehandles, ( $file1, $file2 );
for( @filehandles ) {
# write something.
}
...which is a bit more tidy and intuitive.
Matthew Browning.
------------------------------
Date: Thu, 3 Jul 2003 06:38:27 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: How to put a filehandle into a hash array?
Message-Id: <slrnbg85dj.3o1.tadmc@magna.augustmail.com>
Vsevolod Afanassiev <vafanassiev@aapt.com.au> wrote:
> I need to build an array of filehandles
perldoc -q filehandle
How can I make a filehandle local to a subroutine?
How do I pass filehandles between subroutines?
How do I make an array of filehandles?
> open ( "$FH{$dt}", ">output" . "." . $dt ) or die "$!";
^ ^
^ ^
Why are you forcing stringification of the hash value?
See also:
perldoc -q quoting
What's wrong with always quoting "$vars"?
> print { "FH{$dt}" } "something ...\n";
You know that you are not accessing that same (or any) hash
value here, right?
> It works when run without "-w"
Then it will work _with_ warnings too, since warnings never change
how your program executes...
> What's the correct way of doing it?
The way the FAQ answer shows.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 3 Jul 2003 05:26:08 -0700
From: botfood@yahoo.com (dan baker)
Subject: Re: HTTP Headers
Message-Id: <13685ef8.0307030426.226b3ee6@posting.google.com>
mjeff1@twcny.rr.com (Jeff Mott) wrote in message news:<970676ed.0307021651.27a2e575@posting.google.com>...
> How would an HTTP request sent with Perl return the *full* set of HTTP
> headers? In fact I'm not even interested in the content. ...
------------
you may not need to look at the headers to get at what you want. I'd
guess that the login you are looking for is in the %ENV ... i.e. the
$ENV{'REMOTE_USER'} might be the field you are looking for.
try dumping out everything in %ENV from a simple cgi to see what
you've got available:
...snippet:
print "<P><b>Name</b> = Value pairs list...\n";
print "<br>------------------------------\n";
# perl env
print "<br>running perl version $] \n";
print "<br>running CGI version $CGI::revision \n";
print '<br><b>@INC</b> = '.join(" , ",@INC)."\n";
# cgi env
foreach $key ( sort(keys(%ENV))) { print "<br><b>$key</b> = $ENV{$key}
\n" }
print "<p> \n";
------------------------------
Date: Thu, 3 Jul 2003 11:42:38 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: installing perl modules via ftp
Message-Id: <Pine.LNX.4.53.0307031132120.16393@lxplus100.cern.ch>
On Thu, Jul 3, Gunnar Hjalmarsson inscribed on the eternal scroll:
> Wouldn't it be a good idea to include in the FAQ that many modules can
> be 'installed' by simply uploading the *.pm file(s)? I believe it
> would make Perl accessible to a broader audience.
I must admit I'm sceptical. Sure, there are many cases where it would
work, but you're trying to help someone who can probably be rated as a
relative beginner, so it'll be hard to explain that it's OK for some
modules and not OK for others, and to set out the various possible
issues. They might be led into wasting a lot of time and effort
before working out that they're dealing with a case where it isn't
feasible.
(What I did, when I was stuck in that position, was to write a
throw-away CGI script which installed a private copy of the module,
using the technique described in the FAQ; upload the script to the
server via FTP, and then run it there by calling-up its URL from a web
browser. Beforehand I had to make the installation subdirectory
world-writeable, but of course afterwards I turned that off again -
both tasks which were feasible via their FTP server and didn't need
shell access. But YMMV, as servers and their policies differ in so
many different ways.)
> As an example, in the POD of a trivial module I wrote, I included a
> few lines with the 'FTP users' in mind:
I've nothing against that for an individual module, since you know
what its capabilities are. I'm just sceptical of being able to
formulate an FAQ answer that's useful enough and wide enough in scope
to be useful across-the-board for users who are at the presumed level
of expertise.
cheers
------------------------------
Date: Thu, 03 Jul 2003 15:59:26 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: installing perl modules via ftp
Message-Id: <be1cr3$5mee$1@ID-184292.news.dfncis.de>
Alan J. Flavell wrote:
> On Thu, Jul 3, Gunnar Hjalmarsson inscribed on the eternal scroll:
>> Wouldn't it be a good idea to include in the FAQ that many
>> modules can be 'installed' by simply uploading the *.pm file(s)?
>> I believe it would make Perl accessible to a broader audience.
>
> I must admit I'm sceptical. Sure, there are many cases where it
> would work, but you're trying to help someone who can probably be
> rated as a relative beginner, so it'll be hard to explain that it's
> OK for some modules and not OK for others, and to set out the
> various possible issues. They might be led into wasting a lot of
> time and effort before working out that they're dealing with a case
> where it isn't feasible.
It's true that you would need to explain when it works and when it
doesn't, and yes, occassionally someone might misunderstand.
Nevertheless, I believe it would
1) increase the Perl user base and
2) encourage the use of modules
both of which I thought were good things.
You are right that I'm trying to help relative beginners. I'm counting
myself to that category, and yes, I appreciate proper documentation
that I'm able to understand and follow. Besides, we are all beginners
to start with, right? ;-)
Personally I'm convinced that the advantages with such a guidance
would carry greater weight than the risk you mention. In the end it's
a matter of will.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Thu, 03 Jul 2003 11:08:45 +0000
From: darkname <member31962@dbforums.com>
Subject: Re: k operator in REGEX??
Message-Id: <3071009.1057230525@dbforums.com>
[Yes i took it frim there in order to try to get and enhance the Regex
to catch multiline comments in order to catch comments in PL/SQL!!
Do you have any suggestion?
Thank you.. and sorry for trying to use your code!!!
Can i use it?
Thanks!
--
Posted via http://dbforums.com
------------------------------
Date: 03 Jul 2003 14:27:58 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: k operator in REGEX??
Message-Id: <slrnbg8fbd.pbr.abigail@alexandra.abigail.nl>
darkname (member31962@dbforums.com) wrote on MMMDXCIII September MCMXCIII
in <URL:news:3071009.1057230525@dbforums.com>:
==
== [Yes i took it frim there in order to try to get and enhance the Regex
== to catch multiline comments in order to catch comments in PL/SQL!!
If you give me a pointer to a specification of PL/SQL, or at least of
its comment syntax, I'll add a regexp for it in Regexp::Common.
==
== Do you have any suggestion?
==
== Thank you.. and sorry for trying to use your code!!!
==
== Can i use it?
Yes.
Abigail
--
map{${+chr}=chr}map{$_=>$_^ord$"}$=+$]..3*$=/2;
print "$J$u$s$t $a$n$o$t$h$e$r $P$e$r$l $H$a$c$k$e$r\n";
------------------------------
Date: Thu, 03 Jul 2003 13:02:48 GMT
From: Allen Wooden <allen.wooden@educate.invalid>
Subject: Re: need assistance understanding multilevel hashes.
Message-Id: <i388gv0sghpi6chr495b48875nif1gnqgq@4ax.com>
On Wed, 02 Jul 2003 22:20:41 GMT, tiltonj@erols.com (Jay Tilton)
wrote:
>: $cust = ARGV[0];
> ^
>Lost its '$'
>
typo
>
>Not quite. You should be able to get the value of $hash1{'ports'}.
>
still having a bit of trouble. seems I can see the contents of %hash1
with:
for $b ( keys %hash1) {
print "keys are: $b\n";
print "value for $b \= $hash1{$b}";
print "\n";
}
but this doesn't work:
$v = $hash1{tag};
print "$v\n";
or
printf "tag value for customer $cust is: $hash1{tag}\n";
>
>I think posting that would be appropriate.
Here's some code that rolls through the hashes and prints out a bunch
of stuff. You'll need a file called test.cfg with contents of:
%foo = ( "ports" => "1", "rrd0" => 'some_path', "rate" => "0", "tag"
=> 'Foo Co.', "page_num" => "1" );
%bar = ( "ports" => "1", "rrd0" => 'some_path_x', "rrd1" =>
'some_path_x1', "rate" => "1000000", "tag" => 'Bar Co.', "page_num" =>
"
2" );
Code:
#!/usr/local/bin/perl -w
#$Id: find_hashes,v 1.2 2003/06/25 18:54:02 awooden Exp $
use strict;
use diagnostics;
our ($v,$cust,%hash1,$data,$who,$field,$keys,$values,%hash,@a);
$cust = $ARGV[0];
do '/export/home/awooden/snippets/test.cfg';
open(FILE,"< /export/home/awooden/snippets/test.cfg") or die "Error:
$!";
@a = grep(/\%/,<FILE>); # only read in hashes from config file.
close FILE;
foreach (@a) {
$data =(split/\ \=\ \(/)[1];
$data =~ s/\)\;//;
$who = (/^\%(\w+) /);
$who = "$1";
print "WHO: $who\n";
print "DATA: $data\n";
for $field ( split(/,/,$data) ) {
print "The fields are: $field\n";
($keys, $values) = split /=\>/, $field;
print "the keys are $keys\n";
print "the values are $values\n";
$hash{$who}{$keys} = $values;
}
%hash1 = %{$hash{$cust}} if defined $hash{$cust};
}
for $b ( keys %hash1) {
print "keys are: $b\n";
print "value for $b \= $hash1{$b}";
print "\n";
}
$v = $hash1{tag};
print "$v\n";
Replace invalid with com to reply via email.
PGP key available @ keyserver.pgp.com
------------------------------
Date: Thu, 03 Jul 2003 08:14:33 -0400
From: gw1500se <awingnut@hotmail.com>
Subject: Re: Need help with Win32::GuiTest and Indigo perl
Message-Id: <b968gvgng700p9eheos04djsr6mt2qaip6@4ax.com>
On Thu, 3 Jul 2003 15:05:52 +1000, "Sisyphus" <kalinabears@hdc.com.au>
wrote:
>
>As a workaround solution go to:
>http://ppm.activestate.com/PPMPackages/zips/8xx-builds-only/Windows/
>
>and download Win32-GuiTest.zip.
>
>Inside there's a 'Win32-GuiTest.tar.gz' that contains the files you want.
>Just replace your existing '.pm' and '.dll' files with the ones it contains.
>If you do this by extracting them, make sure you *don't* preserve the packed
>directory structure or they'll end up in the wrong place. Might be best to
>simply extract to a temp location then manually copy them across.
Thanks. I tried it and it looks like we make it to the next layer of
the onion.
>
>That will give you version 1.14. Hope that's satisfactory. Copy the other
>files across, too, if you like .... though it shouldn't be necessary.
I only copied the pm and dll files.
>
>This should work at least as well as your current installation
>:-)
Or at least it fails different. I no longer get the error on the "use"
statement. Now I get an error on the "FindWindowLike" statement. Here
is what I tried as a test:
@windows=FindWindowLike(0;"*","*");
This results in the error:
Quantifier follows nothing in regex; marked by <-- HERE in m/* <--
HERE / at C:/OpenSA/perl/site/lib/Win32/GuiTest.pm line 570.
I also tried other expressions in the call but got the same error.
>
>Also see if you can install *any* modules that contain a dll and have them
>work properly. It might help get to the source of your trouble.
>
Actually the first module I installed was MySQL_auth quite some time
ago. It works fine.
------------------------------
Date: 3 Jul 2003 13:15:21 GMT
From: "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
Subject: Re: Need Perl teacher/school: Network programming
Message-Id: <Xns93AD5E27497FBasu1cornelledu@132.236.56.8>
Irving Kimura <irving_kimura@lycos.com> wrote in news:bdugv0$ksn$1
@reader1.panix.com:
> For months (actually years) I have been trying to learn how to
> write a Perl proxy that can do the following: intercept *all* HTTP
> and HTTPS traffic to and from my browser, and write all of it to
> a log file, decoding and encoding the HTTPS stuff as necessary so
> that all the logged text is intelligible. The proxy must be able
> to handle redirection, pop-ups, frames, and any other tricks the
> browser and server may be up to.
The article "Web Scraping Proxy" by Howard P. Katseff in Dr. Dobbs' June 03
issue might be of some help.
http://www.ddj.com/articles/2003/0306/
--
A. Sinan Unur
asu1@c-o-r-n-e-l-l.edu
Remove dashes for address
Spam bait: mailto:uce@ftc.gov
------------------------------
Date: 3 Jul 2003 04:58:14 -0700
From: multiverse@hotmail.com (Jhary-a-Conel)
Subject: perl script generates sendmail NOQUEUE: connect from root@localhost
Message-Id: <d6888173.0307030358.585caf3c@posting.google.com>
Hello,
I have numerous administrative scripts that contain the following
chucnk of perl:
# Mail Procedure
#
&send_mail;
sub send_mail
{
open(MAIL,"|$MAIL -s \"$SUBJECT\" admin.report\@multiverse.org");
# Test output for string
#
if($output eq "")
{
print MAIL "Good news. None of the eth devices are in PROMISC
mode. Take no action.
\n\n";
}
else
{
print MAIL "Bad news. There is an eth device in PROMISC mode.
Take immeadiate actio
n.\n\n";
}
close(MAIL);
}
When this script is run it generates the following output in
/var/log/maillog:
Jul 3 04:26:45 prod sendmail[8843]: NOQUEUE: connect from
root@localhost
Jul 3 04:26:45 prod sendmail[8843]: h63BQjj08843: from=root,
size=150, class=0, nrcpts=1,
msgid=<200307031126.h63BQjj08843@www.domain.com>, relay=root@localhost
Jul 3 04:26:45 prod sendmail[8846]: h63BQjj08843:
to=admin.report@domain.com, ctladdr=root (0/0), delay=00:00:00,
xdelay=00:00:00, mailer=local, pri=30150, dsn=2.0.0, stat=Sent
Jul 3 04:26:45 prod sendmail[8846]: h63BQjj08843: done;
delay=00:00:00, ntries=1
My research indicates that when a client doesn't close a connection
properly with Sendmail it throws the NOQUEUE line into the logs.
<eyeroll>I guess Outlook is a big offender </eyeroll>.
My understanding of the situation is that this is more of a report
message than an error message. But one thread suggested that there
might be network issues. Since these scripts run via crontab, my
assumption is that I have written my script poorly and that the script
is disconnecting unceremoniously or the mail client needs to be passed
something or sendmail needs to be passed a parameter that better
terminates the transaction. BTW, this is on Redhat 7.3 and I'm using
the version of mail installed by default and $MAIL='mail'
I'd like to eliminate this report message, but have a feeling the
NOQUEUE message is inconsequential. When I reduce the logging level,
the message stops being recorded. Should I ignore this and get on
with my life or what?
Also, if you see any other clueless newbie nonsense ocurring in the
above script, please let me know.
Thanks,
Jerry Cornelius
------------------------------
Date: Thu, 03 Jul 2003 13:14:03 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: perl script generates sendmail NOQUEUE: connect from root@localhost
Message-Id: <vg8b0r8ro3vn66@corp.supernews.com>
In article <d6888173.0307030358.585caf3c@posting.google.com>,
Jhary-a-Conel <multiverse@hotmail.com> wrote:
: # Mail Procedure
: &send_mail;
:
: sub send_mail
: {
: open(MAIL,"|$MAIL -s \"$SUBJECT\" admin.report\@multiverse.org");
:
: # [snip message]
:
: close(MAIL);
: }
How do you set the value of $SUBJECT? If this is a setuid program,
it would be safer to invoke sendmail -- and the qmail folks would say
it's never safe to invoke sendmail :-) -- with the -t option, which
tells sendmail to scan the message for recipients. You're also not
checking system calls for failure.
Consider rewriting send_mail as
sub send_mail {
# XXX: or wherever sendmail is
open MAIL, "| /usr/lib/sendmail -oi -t"
or die "$0: failed fork: $!";
my $status = $output ? <<EOBad : <<EOGood;
Bad news. There is an eth device in PROMISC mode.
Take immeadiate action.
EOBad
Good news. None of the eth devices are in PROMISC
mode. Take no action.
EOGood
my $subj = $SUBJECT;
$subj =~ s/([^[:print:]]|[\r\n])+/ /g;
my $message = join "\n",
"To: admin.report\@multiverse.org",
"From: eth device monitor <root>",
"Subject: $subj",
"", # end of header
$status;
print MAIL $message or warn "$0: print MAIL: $!";
close MAIL
or warn $! ? "$0: error closing sendmail pipe: $!"
: "$0: exit status $? from sendmail";
}
Hope this helps,
Greg
--
The competent programmer is fully aware of the strictly limited size of his
own skull; therefore he approaches the programming task in full humility,
and among other things he avoids clever tricks like the plague.
-- Edsger Dijkstra
------------------------------
Date: Thu, 03 Jul 2003 11:11:21 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: script for unrestricted permutation
Message-Id: <3f040319.2828824@news.erols.com>
weberh@zedat.fu-berlin.de (weberh) wrote:
: Alright, but it is slow, no?
It is customary to provide some context by quoting relevant material
from the article you are replying to.
recap of bd's code:
while($indices[0] < @elements){
foreach my $index (@indices) {
print "$elements[$index] ";
}
print "\n";
$indices[-1]++;
for($_ = $#indices; $_ > 0; $_--){
if($indices[$_] >= @elements){
$indices[$_] = 0;
$indices[$_ - 1]++;
}
}
}
Sure it's slower. But the idea is readily adapted to give it much
more flexibility.
It's essentially a base-n counter, where n is the number of permutable
items. By changing it from a counter to a decimal-to-base-n
converter, it can be used to obtain any arbitrary permutation without
having to generate the entire set.
my($count, @elements) = @ARGV;
my $permutation = sub {
use integer;
my($i) = @_;
my @indices = ($elements[0]) x $count;
my $c = $count;
while($c && $i) {
$indices[--$c] = $elements[ $i % @elements ];
$i /= @elements;
}
@indices;
};
print $permutation->($_), "\n"
for 0 .. @elements ** $count -1;
------------------------------
Date: 3 Jul 2003 07:27:16 -0700
From: qu1kb1rd@yahoo.com (qu1kb1rd)
Subject: Re: Using Perl with ESRI ArcGIS? Or VB foolishness?
Message-Id: <d64066d2.0307030627.2ce8f205@posting.google.com>
dananrg@yahoo.com (dnrg) wrote in message news:<c1888d06.0306280437.11c8f579@posting.google.com>...
> Any GIS folk in da house?
Yep. Here's my two cents....
You are right to look elsewhere for GIS programming tools. If it makes
you feel any better, I have been happily GIS programming for a couple
years and only had to use VB once, and that was with MapInfo, not
ESRI. I am not particularly a fan of ESRI products and the last few
years I've used Linux for everything I do, so ESRI's not really even
much of an option for me. Well I guess the java stuff might do ok on
linux. But we're talking Perl, not Java right?
Here's some resources for doing GIS without the monopoly:
GRASS GIS www.baylor.edu/grass -- learn to use it. Once installed,
very easy to wrap perl around it. We created a mapserver with just
perl and GRASS5.
MAPSERVER from University of Minnnesota. This is simply outstanding
open source ware. We use this for all kinds of things. Perl Mapscript
will build with it. You'll really like that, I'd bet.
SHAPELIB & GDAL www.remotesensing.org -- THE place for open source GIS
tools. Frank Warmerdam is my hero. We have gotten more value out of
shapelib than just about anything. GDAL is really robust for raster
stuff. Once again, really easy to wrap perl around.
postGIS www.postgis.org -- this project has more potential than
anything. I'm currently doing some R&D with postGIS and it really is
nice. Wait til they get the GEOS lib built into it for strong spatial
analysis tools. Once again plays well with perl.
All of these tools really work well together too, as a bonus.
Get yourself an apache server and a DB server, you can rock the
enterprise with these kinds of tools.
You really can do all kinds of GIS work without either M$ or ESRI if
you're resourceful and willing to learn new things. It turns out to be
a lot easier in the end. Downloading and compiling these kinds of
software is much easier than trying to convince your boss to spend
tens of thousands of dollrs on software that ain't all that much
better than the free stuff.
Good Luck!!
D. Marino
DigitalGlobe, Inc.
------------------------------
Date: Thu, 3 Jul 2003 13:05:07 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: UTF16 and Control M's
Message-Id: <Pine.LNX.4.53.0307031241170.16393@lxplus100.cern.ch>
On Thu, Jul 2, Eileen inscribed on the eternal scroll:
> Sorry, I left out the first part of the script.there's the full
> script:
>
> #!/usr/local/bin/perl -w
We also recommend "use strict;" around here. Take advantage of all of
Perl's opportunities for helping you identify mistakes.
> $file = "kono.xml";
^
my
> open (IN, $file) or die "cannot open $file\n";
Don't omit "$!" from the error report: it helps to understand the
reason for the failure.
> I didn't realize you could specify the encoding of a file in Perl.
Another good reason to [check that you're using at least version
5.8.0 and] take a few moments out to read the introduction to the
new support for Unicode. (In earlier Perls you'd need to explicitly
invoke the relevant module to do this stuff).
> the \x{0x0D00} was identified by one of my Unicode editors,and was a
> stab in the dark on my part :)
But what have you learned from the experience?
- if you are reading text, and have properly defined the encoding,
then internally your characters can be referenced by their unicode
code point values, _not_ by their externally-encoded bit patterns.
- if, on the other hand, you are reading the data as a bunch of bytes
(i.e effectively "as binary") then you'd need to handle the byte-pairs
as byte-pairs, not as unicode characters. This is not to be
recommended in current versions of Perl (unless your data is somehow
defective, and you got to write a fixup routine of some kind).
- the new notation e.g \x{263a} denotes a _wide unicode character_ in
Perl's native unicode representation. That value is the Unicode code
point (in this case the smiley, "U+263a" as the Unicode Consortium's
notation would write it). Don't confuse it with the external coding
representation, which (_if_ you had read utf-16LE coding in binary
format, which I don't recommend) would have been \x3a\x26.
hope this helps
(You'd also be advised to take a read of
http://web.presby.edu/~nnqadmin/nnq/nquote.html )
p.s I have the impression that the regulars around here have nominated
me by default as the character encoding spokesman. I must admit that
I'm sometimes at the edge of my expertise, so I _do_ hope they're
watching closely, and will pounce as necessary if I say something
wrong or explain it badly...
------------------------------
Date: 3 Jul 2003 07:23:27 -0700
From: simon.fairey@ft.com (Simon Fairey)
Subject: What is swash?
Message-Id: <af9e67d1.0307030623.5f253369@posting.google.com>
Hi,
I've seen a few references to swash but am still none the wiser. I
have a large SAX based parser that slowed down drastically when I
moved to 5.8 and after running DProf notice a huge number of calls to
SWASHGET/NEW. I isolated it down to a piece of code that had read a
string which happened to contain the £ sign (\243 I think) and was
performing a regexp on said string quite a few times. By running
utf8::decode() on the string in question before it's processed I
reduced my run time by 40% but am not really that much wiser.
Any info would be greatly appreciated. Is there a way I could have
opened/read from the file in the first instance to bypass this issue?
Many thanks for any info
Si
PS: Cross posted as most references I found to swash were in porters
but there is elements of the above probably better suited to
perl.misc, hope no-one minds :-)
------------------------------
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 5173
***************************************