Re: Perl Hacker, Python Initiate

2011-02-03 Thread Jorgen Grahn
On Wed, 2011-02-02, Gary Chambers wrote: > All, > > Given the following Perl script: > > #!/usr/bin/perl I'm a Perl user, but I generally refuse to read Perl code which doesn't utilize 'use warnings/-w' and 'use strict'. There are just too many crazy bugs and 1980s constructs which go unnoticed w

Re: Perl Hacker, Python Initiate

2011-02-03 Thread waku
you've already got a hint on how to do it using library functions in python. below is a more literal suggestion. On Feb 1, 10:36 pm, Gary Chambers wrote: > All, > > Given the following Perl script: > > #!/usr/bin/perl > > %dig = ( >      solaris => "/usr/sbin/dig", >      linux   => "/usr/bin/di

Re: Perl Hacker, Python Initiate

2011-02-03 Thread sturlamolden
On 2 Feb, 05:36, Gary Chambers wrote: > Given the following Perl script: (...) Let me quote the deceased Norwegian lisp hacker Erik Naggum: "Excuse me while I barf in Larry Wall's general direction." Sturla -- http://mail.python.org/mailman/listinfo/python-list

Re: Perl Hacker, Python Initiate

2011-02-03 Thread Hrvoje Niksic
Gary Chambers writes: > Will someone please provide some insight on how to accomplish that > task in Python? I am unable to continually (i.e. it stops after > displaying a single line) loop through the output while testing for > the matches on the two regular expressions. Thank you. If I under

Re: Perl Hacker, Python Initiate

2011-02-02 Thread Steven D'Aprano
On Wed, 02 Feb 2011 11:00:11 -0500, Gary Chambers wrote: > Finally, the problem I encountered in the Python code was having the > script fail when it encountered a line that didn't match either of the > two regular expressions. What I'm seeking is either some Python code > that mimics what my Perl

Re: Perl Hacker, Python Initiate

2011-02-02 Thread Ben Finney
Gary Chambers writes: > If you can't make heads or tails of the Perl code, all I'm trying to > do is loop through some dig output of a DNS zone transfer. The request to see your Python code was partly because Perl is foreign here, yes. But another, more significant reason is: we want to see *yo

Re: Perl Hacker, Python Initiate

2011-02-02 Thread Carl Banks
On Feb 2, 8:00 am, Gary Chambers wrote: > All, > > > Insight will be easier to provide once we see your Python code. > > Thanks to all of you who replied to my original request for assistance.  All > points are valid and well-taken. > > I'm afraid that I can no longer locate the original Python co

Re: Perl Hacker, Python Initiate

2011-02-02 Thread Gary Chambers
All, Insight will be easier to provide once we see your Python code. Thanks to all of you who replied to my original request for assistance. All points are valid and well-taken. I'm afraid that I can no longer locate the original Python code where I was encountering the problem I described i

Re: Perl Hacker, Python Initiate

2011-02-02 Thread Tom Boland
if you want to do dns lookups on a large number of hosts, then try looking at gnu adns, or if you don't mind each request blocking until it's complete, then see Alain's response below. I have written some scripts myself which do massively parallel dns lookups quickly using twisted. If this i

Re: Perl Hacker, Python Initiate

2011-02-02 Thread Alain Ketterlin
Gary Chambers writes: > Given the following Perl script: [41 lines of Perl removed] Sorry, I'm lucky enough to be able to completely ignore Perl. > Will someone please provide some insight on how to accomplish that task in > Python? >From what I understood in the comments of your script, here

Re: Perl Hacker, Python Initiate

2011-02-02 Thread Steven D'Aprano
On Tue, 01 Feb 2011 23:36:27 -0500, Gary Chambers wrote: > All, > > Given the following Perl script: [snip line noise] > Will someone please provide some insight on how to accomplish that task > in Python? No idea, I can't read Perl, and you shouldn't assume that people will be able to. Can

Re: Perl Hacker, Python Initiate

2011-02-02 Thread wander.lairson
2011/2/2 Gary Chambers : > All, > > Given the following Perl script: > > #!/usr/bin/perl > > %dig = ( >    solaris => "/usr/sbin/dig", >    linux   => "/usr/bin/dig", >    darwin  => "/usr/bin/dig" > ); > > $DIG = $dig{"$^O"}; > $DOMAIN = "example.com"; > $DNS = "ns.example.com"; > $DIGCMD = qq/$DI

Re: Perl Hacker, Python Initiate

2011-02-01 Thread Carl Banks
On Feb 1, 8:36 pm, Gary Chambers wrote: > open DIG, "$DIGCMD|" or die "$DIG: $!\n"; > while () { > Will someone please provide some insight on how to accomplish that task in > Python?  I am unable to continually (i.e. it stops after displaying a single > line) loop through the output while test

Re: Perl Hacker, Python Initiate

2011-02-01 Thread Ben Finney
Gary Chambers writes: > Given the following Perl script: […] > > Will someone please provide some insight on how to accomplish that > task in Python? I am unable to continually (i.e. it stops after > displaying a single line) loop through the output while testing for > the matches on the two regu

Re: Perl Hacker, Python Initiate

2011-02-01 Thread Chris Rebert
On Tue, Feb 1, 2011 at 8:36 PM, Gary Chambers wrote: > All, > > Given the following Perl script: > Will someone please provide some insight on how to accomplish that task in > Python?  I am unable to continually (i.e. it stops after displaying a single > line) loop through the output while testin

Perl Hacker, Python Initiate

2011-02-01 Thread Gary Chambers
All, Given the following Perl script: #!/usr/bin/perl %dig = ( solaris => "/usr/sbin/dig", linux => "/usr/bin/dig", darwin => "/usr/bin/dig" ); $DIG = $dig{"$^O"}; $DOMAIN = "example.com"; $DNS = "ns.example.com"; $DIGCMD = qq/$DIG \@$DNS $DOMAIN axfr/; open DIG, "$DIGCMD|" or