[27814] in Perl-Users-Digest
Perl-Users Digest, Issue: 9178 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 20 03:05:50 2006
Date: Thu, 20 Apr 2006 00:05:06 -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, 20 Apr 2006 Volume: 10 Number: 9178
Today's topics:
new CPAN modules at Thu Apr 20 2006 (Randal Schwartz)
Re: show hidden value in variable.. with mysql joe.henderson1@
Re: show hidden value in variable.. with mysql <sherm@dot-app.org>
Re: show hidden value in variable.. with mysql <1usa@llenroc.ude.invalid>
Re: show hidden value in variable.. with mysql <kkeller-usenet@wombat.san-francisco.ca.us>
Re: show hidden value in variable.. with mysql <uri@stemsystems.com>
Re: show hidden value in variable.. with mysql <rvtol+news@isolution.nl>
Re: Term::ReadKey on Win? 5.005 vs 5.8.8? <sisyphus1@nomail.afraid.org>
Re: Term::ReadKey on Win? 5.005 vs 5.8.8? <nospam-abuse@ilyaz.org>
Re: Term::ReadKey on Win? 5.005 vs 5.8.8? <sisyphus1@nomail.afraid.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 20 Apr 2006 04:42:04 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules at Thu Apr 20 2006
Message-Id: <Iy07q4.4CG@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
WWW-PkgFind-1.1
http://search.cpan.org/~bryce/WWW-PkgFind-1.1/
Spiders given URL(s) mirroring wanted files and triggering post-processing (e.g. tests) against them.
----
UDPServersAndClients
http://search.cpan.org/~robinbank/UDPServersAndClients/
A Module that is four server/client rograms.
----
UDPServersAndClients-alpha
http://search.cpan.org/~robinbank/UDPServersAndClients-alpha/
----
DBIx-Class-0.06002
http://search.cpan.org/~elliott/DBIx-Class-0.06002/
Extensible and flexible object <-> relational mapper.
----
Module-Build-Convert-0.26
http://search.cpan.org/~schubiger/Module-Build-Convert-0.26/
Makefile.PL to Build.PL converter
----
RT-Client-REST-0.04
http://search.cpan.org/~dmitri/RT-Client-REST-0.04/
talk to RT installation using REST protocol.
----
RT-Client-REST-0.03
http://search.cpan.org/~dmitri/RT-Client-REST-0.03/
talk to RT installation using REST protocol.
----
Net-Interface-0.08
http://search.cpan.org/~miker/Net-Interface-0.08/
Perl extension to access network interfaces
----
Linux-Distribution-Packages-0.05
http://search.cpan.org/~judith/Linux-Distribution-Packages-0.05/
list all packages on various Linux distributions
----
Snail-CSV-0.05
http://search.cpan.org/~mit/Snail-CSV-0.05/
Perl extension for read CSV files.
----
File-DirSync-1.14
http://search.cpan.org/~bbb/File-DirSync-1.14/
Syncronize two directories rapidly
----
Net-Z3950-ZOOM-1.06
http://search.cpan.org/~mirk/Net-Z3950-ZOOM-1.06/
Perl extension for invoking the ZOOM-C API.
----
POE-Component-Client-Whois-1.03
http://search.cpan.org/~bingos/POE-Component-Client-Whois-1.03/
A one shot non-blocking RFC 812 WHOIS query.
----
RDF-Sesame-0.15
http://search.cpan.org/~mndrix/RDF-Sesame-0.15/
Interact with Sesame RDF servers
----
SNMP-APCUPS-0.01
http://search.cpan.org/~sneak/SNMP-APCUPS-0.01/
Object Oriented Interface to American Power Conversions UPS SNMP Management Cards
----
Apache-SWIT-0.11
http://search.cpan.org/~bosu/Apache-SWIT-0.11/
mod_perl based application server with integrated testing.
----
HTML-Tested-0.11
http://search.cpan.org/~bosu/HTML-Tested-0.11/
Provides HTML widgets with the built-in means of testing.
----
HTML-Tested-ClassDBI-0.04
http://search.cpan.org/~bosu/HTML-Tested-ClassDBI-0.04/
Enhances HTML::Tested to work with Class::DBI
----
WWW-Myspace-0.42
http://search.cpan.org/~grantg/WWW-Myspace-0.42/
Access MySpace.com profile information from Perl
----
Filesys-Statvfs_Statfs_Df-0.79
http://search.cpan.org/~iguthrie/Filesys-Statvfs_Statfs_Df-0.79/
----
DBI-1.45-5.8.4
http://search.cpan.org/~hoymich/DBI-1.45-5.8.4/
Database independent interface for Perl
----
DBD-DB2-0.78-5.8.4
http://search.cpan.org/~hoymich/DBD-DB2-0.78-5.8.4/
DataBase Driver for DB2 UDB
----
Data-Validate-0.05
http://search.cpan.org/~sonnen/Data-Validate-0.05/
common data validation methods
----
SNMP-Trapinfo-0.90
http://search.cpan.org/~tonvoon/SNMP-Trapinfo-0.90/
Reading an SNMP trap from Net-SNMP's snmptrapd
----
Rose-DB-Object-0.72
http://search.cpan.org/~jsiracusa/Rose-DB-Object-0.72/
Extensible, high performance RDBMS-OO mapper.
----
Catalyst-Plugin-FormValidator-Simple-OwnCheck-0.02
http://search.cpan.org/~adong/Catalyst-Plugin-FormValidator-Simple-OwnCheck-0.02/
Validator for Catalyst with FormValidator::Simple
----
XML-Validate-1.025
http://search.cpan.org/~bbc/XML-Validate-1.025/
an XML validator factory
----
Plagger-0.6.4
http://search.cpan.org/~miyagawa/Plagger-0.6.4/
Pluggable RSS/Atom Aggregator
----
Catalyst-Plugin-FormValidator-Simple-OwnCheck-0.01
http://search.cpan.org/~adong/Catalyst-Plugin-FormValidator-Simple-OwnCheck-0.01/
Validator for Catalyst with FormValidator::Simple
----
Test-Harness-2.57_05
http://search.cpan.org/~petdance/Test-Harness-2.57_05/
Run Perl standard test scripts with statistics
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Thu, 20 Apr 2006 01:15:17 GMT
From: joe.henderson1@
Subject: Re: show hidden value in variable.. with mysql
Message-Id: <d2od425d2tenrce7e5fsqn86j4b4lkor2n@4ax.com>
On Thu, 20 Apr 2006 01:02:40 GMT, "John W. Krahn"
<someone@example.com> wrote:
>joe.henderson1@ wrote:
>>
>> I run a mysql db 5.0.11. With a table that contains a few columns
>> defined as type "text" with indexes..
>>
>> I running this on a Arch Linux 0.7.1.. 2.6.15 custom.. perl 5.8.8
>>
>> I run some scripts to parse data from cisco/network devices using snmp
>> and telnet/ssh..
>>
>> I retrieve the name, mac, serial, location, description, interfaces,
>> etc..
>>
>> The problem I have is the names I recieve from the
>> devices I run threw a "clean subroutine"..
>>
>> ##########
>> sub clean
>> {
>> my $debug = 0;
>> my $item = $_[0];
>> $item =~ s/^\s+//; #remove Leading whitespace
>> $item =~ s/\s+$//; #remove trailing whitespace
>> $item =~ s/\r/ /g; #remove those Damn ^M
>> $item =~ s/\f/ /g; #remove those Damn ^M
>> $item =~ s/\t/ /g; #remove those Damn ^M
>> $item =~ s/\n/ /g; #remove those Damn ^M
>> $item =~ s/\s+/ /g; #replace multiple spaces with one
>> chomp($item); #remove newline character
>> return $item;
>> }
>> ##########
>
>sub clean
> {
> my $debug = 0;
> #remove those Damn ^M etc. and replace multiple spaces with one
> ( my $item = $_[0] ) =~ tr/ \r\f\t\n/ /s;
> #remove leading and trailing spaces
> s/^ +//, s/ +$// for $item;
> return $item;
> }
Thanks for the edition
>
>> And for some reason when I compare to different names
>>
>> From DB: $name = "00a45fde0032(sw1)"
>>
>> And the name I pulled from the device $name: "00a45fde0032(sw1)"
>> and compare them for exact match
>>
>> ##########
>> if($name eq $mname)
>> { print "MATCH ON NAME: \"$name\" MNAME: \"$mname\"\n"; }
>> else
>> { print "NO MATCH\n"; }
>> ##########
>>
>> Nothing happens.. No Match.
>>
>>
>> However when I did a
>> ##########
>> if($name == $mname)
>> { print "MATCH ON NAME: \"$name\" MNAME: \"$mname\"\n"; }
>> else
>> { print "NO MATCH\n"; }
>> ##########
>>
>> I recieved an error stating "cannot equal on non numeric" which is
>> what I expected.. However it showed a hidden character of
>> "MNAME: "00a45fde0032(sw1)\o"
>>
>> What does the "\o" mean? I have never seen this before..
>
>Are you sure that that is "\o" and not "\0"? It could be a NULL terminated "C
>string".
No.. it was "\o".. However if it was.. How could it have occurred?
>
>
>
>John
Advise,
Joe
------------------------------
Date: Wed, 19 Apr 2006 21:16:57 -0400
From: Sherm Pendley <sherm@dot-app.org>
Subject: Re: show hidden value in variable.. with mysql
Message-Id: <m24q0p9hbq.fsf@Sherm-Pendleys-Computer.local>
joe.henderson1@ writes:
> On Thu, 20 Apr 2006 00:50:50 +0200, "Dr.Ruud"
> <rvtol+news@isolution.nl> wrote:
>
>>After some weeding, this remains:
>>
>> s/^\s+//, s/\s+$//, s/\s+/ /g for $item;
>
> Where is the regex for removing the line feeds/new/tab/form feeds?
Those are all different forms of white space, so \s catches them. Of
course, \s catches spaces too, but no harm is done by replacing a space
with a space.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Thu, 20 Apr 2006 01:55:47 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: show hidden value in variable.. with mysql
Message-Id: <Xns97AADF159D148asu1cornelledu@127.0.0.1>
joe.henderson1@ wrote in news:afmd42po2t5kijm7psg2a4q9l7eaam2jtf@
4ax.com:
> On Thu, 20 Apr 2006 00:11:16 GMT, "A. Sinan Unur"
> <1usa@llenroc.ude.invalid> wrote:
>
>>joe.henderson1@ wrote in news:gfcd429kaaot9ibb06l6ma1od1j5tf1q17@
>>4ax.com:
>>
>>> sub clean
>>> {
>>> my $debug = 0;
>>
>>What does this line do?
>
> All the subs i write have a "magic" debug variable.. I spend more time
> on debugging than writting code.. :(
> When i turn this on I embed print statments with low level printouts..
But that is tedious because you have to edit the body of each sub to
turn debugging on.
>>> my $item = $_[0];
>>
>>my ($item) = @_;
>>
>>would enable you to pass literal strings to this routine as well as
>>variables.
>
> K. thanks.. Used a "$tem = shift;" but quit after some problem I don't
> remember.. :(
>
> However How would you pass multiple Items..
>
> ex..
> ########
> like ($item) = clean($val1, $val2);
>
> sub clean
> {
> my $item1 = shift(@_);
> my $item2 = shift(@_);
my ($item1, $item2) = @_;
Or, if you are applying the same transformation to an indefinite number
of arguments:
sub clean {
my @args = @_;
for ( @args ) {
s/^\s+//;
s/\s+$//;
s/\s+/ /;
}
return @args;
}
>>use constant DEBUG => 1;
>>
>
> I do not have experience with the debug command... Will use.. thanks
> for the advise...
There is no debug command. I am just proposing setting a global flag for
debugging mode. You could have just as well called it CHEESE.
>>DEBUG and
>> warn sprintf("\$name = '%s'\n\$mname = '%s'\n", $name, $mname);
>
> good idea
Well, then, you might want
>>sub hex_dump_string {
>> my ($string) = @_;
>> $string =~ s/(.)/sprintf '%2.2X', ord $1/ges;
>> return $string;
>>}
>
> Good stuff.. I'll read up on the "ord" "/ges"..
>
> don't know what that is... more advance regex..
perldoc perlop
Now, if you do post the contents of those variables, we might be able to
help further.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Wed, 19 Apr 2006 20:11:54 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: show hidden value in variable.. with mysql
Message-Id: <poajh3x9o8.ln2@goaway.wombat.san-francisco.ca.us>
On 2006-04-20, A. Sinan Unur <1usa@llenroc.ude.invalid> wrote:
> joe.henderson1@ wrote in news:afmd42po2t5kijm7psg2a4q9l7eaam2jtf@
> 4ax.com:
>>
>> All the subs i write have a "magic" debug variable.. I spend more time
>> on debugging than writting code.. :(
>> When i turn this on I embed print statments with low level printouts..
>
> But that is tedious because you have to edit the body of each sub to
> turn debugging on.
True, but if you're debugging only one sub, it's helpful to turn on only
those debug messages, rather than turning on all debug messages, which
might swamp a human debugger.
--keith
--
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom
see X- headers for PGP signature information
------------------------------
Date: Thu, 20 Apr 2006 00:26:09 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: show hidden value in variable.. with mysql
Message-Id: <x7irp450v2.fsf@mail.sysarch.com>
>>>>> "jh" == joe henderson1 <joe.henderson1@> writes:
jh> On Thu, 20 Apr 2006 00:11:16 GMT, "A. Sinan Unur"
jh> <1usa@llenroc.ude.invalid> wrote:
>> joe.henderson1@ wrote in news:gfcd429kaaot9ibb06l6ma1od1j5tf1q17@
>> 4ax.com:
>>
>>> sub clean
>>> {
>>> my $debug = 0;
>>
>> What does this line do?
jh> All the subs i write have a "magic" debug variable.. I spend more time
jh> on debugging than writting code.. :(
that is a bad sign. learn to analyze your problems better, improve your
coding skills, etc. debugging should be maybe 20-40% maximum of your
development time.
jh> When i turn this on I embed print statments with low level printouts..
jh> if($debug == 1) { print "Entered sub \"clean\"\n"; }
jh> ... magic ...
jh> if($debug == 1) { print "leaving sub returning: \"$ret\"\n"; }
ewww. that is boring sub tracing. and slow in runtime.
>> use constant DEBUG => 1;
>>
jh> I do not have experience with the debug command... Will use.. thanks
jh> for the advise...
that isn't a debug command. that just create a constant called DEBUG
>>
>> DEBUG and
>> warn sprintf("\$name = '%s'\n\$mname = '%s'\n", $name, $mname);
jh> good idea
it also will run faster than your if you set DEBUG to 0
>> to visually compare the strings during debugging.
>>
>>> However when I did a
>>> ##########
>>> if($name == $mname)
>>> { print "MATCH ON NAME: \"$name\" MNAME: \"$mname\"\n"; }
learn about alternate quote. but even better, why are you using ""
inside a "" string? you can use '', [], <> or {} to demark the actual
values. then you don't need those ugly backwhacks. i tend to use [] for
this.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Thu, 20 Apr 2006 07:59:17 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: show hidden value in variable.. with mysql
Message-Id: <e27fi5.1kg.1@news.isolution.nl>
John W. Krahn schreef:
> sub clean
> {
> my $debug = 0;
> #remove those Damn ^M etc. and replace multiple spaces with one
> ( my $item = $_[0] ) =~ tr/ \r\f\t\n/ /s;
> #remove leading and trailing spaces
> s/^ +//, s/ +$// for $item;
> return $item;
> }
Alternative:
tr/ \r\f\t\n/ /s, s/^ //, s/ $// for $item
but that is less ready for publishing than
s/\s+/ /g, s/^ //, s/ $// for $item
because the tr// as shown, misses several whitespace-incarnations that
are in Unicode.
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Thu, 20 Apr 2006 12:13:05 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: Term::ReadKey on Win? 5.005 vs 5.8.8?
Message-Id: <4446eef0$0$20116$afc38c87@news.optusnet.com.au>
"Ilya Zakharevich" <nospam-abuse@ilyaz.org>
.
.
>
> What happens on what keypress (separately for binmode vs no-binmode)?
>
Haven't yet detected any difference between binmode and no-binmode.
first press - this just enters the command, nothing happens except the
cursor drops down one line
second press - nothing happens
third press - nothing happens
fourth press - nothing happens
fifth press - 13, cursor moves down one line
Then, for each subsequent press of 'Enter', one more '13' appears and the
cursor drops down one line.
Then, If I hit a key other than Enter or Ctrl-M, let's say Ctrl-C, I get 13,
13, and 3 (in that order and on separate lines).
Then if I go back to hitting 'Enter':
first press - nothing happens
second press - nothing happens
third press - nothing happens
fouth press - 13, cursor moves down one line
Then, for each subsequent press of 'Enter', one more '13' appears and the
cursor drops down one line.
Then, If I hit a key other than Enter, let's say 'e', I get 13, 13, and 101
(in that order and on separate lines).
And so on .........
Afaict the behaviour of Ctrl-M is identical to the 'Enter' key in every way.
That is, Ctrl-M produces 13, and it also has exactly the same
latency/re-emergence properties as the Enter key. In fact, as far
asTerm::ReadKey is concerned, 'Ctrl-M' and 'Enter' are the same
(indistinguishable) key
press 'e' - 101
press Ctrl-M - nothing
press Ctrl-M - nothing
press Ctrl-M - nothing
press Ctrl-M - 13
press Enter - 13
or
press 'e' - 101
press Enter - nothing
press Ctrl-M - nothing
press Enter - nothing
press Ctrl-M - 13
press Enter - 13
or any other permutation of 'Ctrl-M' and 'Enter' produces the same output.
I've done most of this using the no-binmode version. Did you have something
more specific in mind re checking for differences between binmode and
no-binmode ? (I might've missed something - though I don't think I have.)
I ran it on perl 5.8.8 - one version built using MSVC++ 7.0 and another
using MinGW. Couldn't detect any difference between the 2 builds.
On Windows 2000.
Cheers,
Rob
------------------------------
Date: Thu, 20 Apr 2006 05:01:29 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Term::ReadKey on Win? 5.005 vs 5.8.8?
Message-Id: <e274j9$161n$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
Sisyphus
<sisyphus1@nomail.afraid.org>], who wrote in article <4446eef0$0$20116$afc38c87@news.optusnet.com.au>:
> > What happens on what keypress (separately for binmode vs no-binmode)?
> Haven't yet detected any difference between binmode and no-binmode.
>
> first press - this just enters the command, nothing happens except the
> cursor drops down one line
> second press - nothing happens
> third press - nothing happens
> fourth press - nothing happens
> fifth press - 13, cursor moves down one line
>
> Then, for each subsequent press of 'Enter', one more '13' appears and the
> cursor drops down one line.
>
> Then, If I hit a key other than Enter or Ctrl-M, let's say Ctrl-C, I get 13,
> 13, and 3 (in that order and on separate lines).
Thank you a lot. Now if could get a mental model of what kind of bug
could cause this...
Yours,
Ilya
------------------------------
Date: Thu, 20 Apr 2006 16:21:25 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: Term::ReadKey on Win? 5.005 vs 5.8.8?
Message-Id: <44472924$0$7529$afc38c87@news.optusnet.com.au>
"Ilya Zakharevich" <nospam-abuse@ilyaz.org> wrote in message
.
.>
> Thank you a lot. Now if could get a mental model of what kind of bug
> could cause this...
>
Fwiw, the bug can be demonstrated with a simpler command:
perl -MTerm::ReadKey -e "ReadMode 4;while(1){$k = getc; print ord($k),
\"\n\"}"
Switching to 'ReadMode 0' in the above command means I have to hit 'Enter'
after I enter the character. So:
press 'a' and the letter 'a' appears
press 'Enter' and I end up with:
a
97
10
then press b and I've got:
a
97
10
b
then press 'Enter' again and I've got:
a
97
10
b
98
10
I don't really understand what's happening (nor do I feel a need to
understand this) - I just thought it might be noteworthy that I now seem to
get a '10' for the 'Enter', rather than a '13'. (And, of course, the bug is
no longer evident.)
Cheers,
Rob
------------------------------
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 9178
***************************************