Boston Linux Meeting reminder, tomorrow Wednesday, May 16, 2018 - Blockchain crypto currencies, Ubuntu 18.04 LTS, and Perl

2018-05-15 Thread Jerry Feldman
When: May 16, 2018 7:00PM (6:30PM for Q&A) Topic: Blockchain crypto currencies, Ubuntu 18.04 LTS, and Perl Moderators: Jerry Feldman and Bill Ricker Location: MIT Building E-51, Room 145 Please note that Wadsworth St is open from Memorial Drive to Amherst St, but is closed between Amhers

Boston Linux Meeting Wednesday, May 16, 2018 - Ubuntu 18.04 LTS, Blockchain, and Perl

2018-05-11 Thread Jerry Feldman
When: May 16, 2018 7:00PM (6:30PM for Q&A) Topic: Ubuntu 18.04 LTS, Blockchain, and Perl Moderators: Jerry Feldman and Bill Ricker Location: MIT Building E-51, Room 145 Please note that Wadsworth St is open from Memorial Drive to Amherst St, but is closed between Amherst St to Main St.

Re: Perl Tech meeting Tues Oct 14th - Shell-Shocker CGI and Perl DoS bugs

2014-10-13 Thread Bill Ricker
While today is a holiday for some, tomorrow is Boston.PM anyway. (Worse, next month we're on 11/11.) And Boston Perl Monger's 2nd Tuesday comes as late as possible this month, so falls the day before BLU 3rd Wednesday. (I hear some operating system also issues patches that day, does

Perl Tech meeting Tues Oct 14th - Shell-Shocker CGI and Perl DoS bugs

2014-10-10 Thread Bill Ricker
Boston Perl Monger's 2nd Tuesday comes as late as possible this month, so falls the day before BLU 3rd Wednesday. (I hear some operating system also issues patches that day, doesn't affect me.) TOPIC: Shell-Shocker CGI and Perl DoS bugs DATE: Tuesday, October 14 TIME: 7:00 – 10:00 PM

"Rakudo Star - a useful, usable, 'early adopter's distribution of Perl 6" MIT 9/14 E51 7pm

2010-09-08 Thread Bill Ricker
"Rakudo Star - a useful, usable, 'early adopter's distribution of Perl 6" "Rumors of my death are greatly exaggerated" -- Mark Twain Curious what the Perl community has been up to lately? Come see Perl 6's recent preview release. Since July, Perl Mongers gro

Re: Perl vs. Python question...

2009-07-14 Thread Lloyd Kvam
On Tue, 2009-07-14 at 15:32 -0400, Joshua Judson Rosen wrote: > > The simplistic self.foo = self.compute_foo() will trigger a call to > > __getattr__, so you can't use that within __getattr__. > > That's not true; it *will*, however, trigger a call to __settattr__, > if it exists; that's what you'

Re: Perl vs. Python question...

2009-07-14 Thread Joshua Judson Rosen
Lloyd Kvam writes: > > On Mon, 2009-07-13 at 22:59 -0400, Paul Lussier wrote: > > Lloyd Kvam writes: > > > > > You've already gotten two useful responses. I'd just like to add that > > > typically, the object attributes are referenced directly: > > > rect.length * rect.width > > > > Ll

Re: Perl vs. Python question...

2009-07-14 Thread Paul Lussier
Lloyd Kvam writes: > If the value will be computed on demand, __getattr__ is one way to go. > def __getattr__(self, attr): > if attr == 'foo': > return self.compute_foo() > elif > else: > raise AttributeError( attr +

Re: Perl vs. Python question...

2009-07-14 Thread Lloyd Kvam
On Mon, 2009-07-13 at 22:59 -0400, Paul Lussier wrote: > Lloyd Kvam writes: > > > You've already gotten two useful responses. I'd just like to add that > > typically, the object attributes are referenced directly: > > rect.length * rect.width > > Lloyd, thanks. But what if the attribute

Re: Perl vs. Python question...

2009-07-13 Thread Paul Lussier
Lloyd Kvam writes: > You've already gotten two useful responses. I'd just like to add that > typically, the object attributes are referenced directly: > rect.length * rect.width Lloyd, thanks. But what if the attribute isn't set yet? If I have self.foo, and self.foo hasn't yet been set

Re: Perl vs. Python question...

2009-07-13 Thread Bill McGonigle
On 07/11/2009 11:44 PM, Paul Lussier wrote: > In perl, I can use the AUTOLOAD feature to dynamically create methods, > something like this: It looks like in perl6 you get this for free. I'm just getting started with it though. -Bill -- Bill McGonigle, Owner Work: 603.4

Re: Perl vs. Python question...

2009-07-13 Thread Lloyd Kvam
On Sat, 2009-07-11 at 23:44 -0400, Paul Lussier wrote: > How do I create dynamically created methods in python classes? > > For example, if I have a number of member variables which I want to > get > or set, I don't want to have to create getters and setters for each > attribute, since the code wo

Re: Perl vs. Python question...

2009-07-12 Thread Steven W. Orr
e to create getters and setters for each > attribute, since the code would largely be the same, just the variable > I'm dealing with would be different. > > In perl, I can use the AUTOLOAD feature to dynamically create methods, > something like this: > > sub AUTOLOAD

Re: Perl vs. Python question...

2009-07-12 Thread Joshua Judson Rosen
Paul Lussier writes: > > Hi Folks, > > How do I create dynamically created methods in python classes? > > For example, if I have a number of member variables which I want to get > or set, I don't want to have to create getters and setters for each > attribute, since the code would largely be the

Perl vs. Python question...

2009-07-11 Thread Paul Lussier
;m dealing with would be different. In perl, I can use the AUTOLOAD feature to dynamically create methods, something like this: sub AUTOLOAD { my ($self, @args) = @_; my $method = $AUTOLOAD; $method =~ s/.*:://; if ($method ne 'DESTROY') { # Return the structure

RE: shell, perl, performance, parallelism, profiling, etc.

2008-10-22 Thread Roger M. Levasseur
>One might remember the Unix > vfork(2) system call. Originally, the fork(2) call would clone the > entire data segment (data abd .bss), but vfork(2) would implement a > copy-on-write strategy. Since Linux has been virtual since inception, > there is no difference between the vfork(2) and

Re: shell, perl, performance, parallelism, profiling, etc.

2008-10-22 Thread Jerry Feldman
On 10/22/2008 03:49 PM, Kevin D. Clark wrote: Jerry Feldman writes: However, my thought is that if you are concerned with the performance of a shell or Perl script, then you have the wrong language, and should consider a more traditional compiled language. On the BLU server, we had a script

Re: shell, perl, performance, parallelism, profiling, etc.

2008-10-22 Thread Kevin D. Clark
Jerry Feldman writes: > However, my thought is that if you are concerned with the > performance of a shell or Perl script, then you have the wrong > language, and should consider a more traditional compiled > language. On the BLU server, we had a script that would convert > mailm

Re: shell, perl, performance, parallelism, profiling, etc.

2008-10-22 Thread Jerry Feldman
those results out. The results I have been reporting are the typical case, after everything is cached. It seems to be stable after that first run. (Within +/- 0.1 seconds "real".) Additionally, Perl compiles the script first. Hmmm, that's an interesting point. Still,

Re: shell, perl, performance, parallelism, profiling, etc.

2008-10-22 Thread Jerry Feldman
On 10/22/2008 11:34 AM, Ben Scott wrote: On Wed, Oct 22, 2008 at 10:12 AM, Jerry Feldman <[EMAIL PROTECTED]> wrote: The original reason for the sticky bit is because some Unix commands are so frequently used and small that keeping them in memory significantly improves performance, especially

RE: shell, perl, performance, parallelism, profiling, etc. (was: Upgrade guidance)

2008-10-22 Thread Michael Pelletier
ast time in my programming career where it was worth the trouble of implementing it. -Michael Pelletier. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ben Scott Sent: Wednesday, October 22, 2008 11:09 AM To: Greater NH Linux User Group Subject: R

Re: shell, perl, performance, parallelism, profiling, etc.

2008-10-22 Thread Ben Scott
thms are of such interest. (Again, I'm just repeating received wisdom; this could be wrong.) > Perl, on the other hand may need to be loaded, causing a Perl script\ > to appear to be slower than a shell script. I ran did several test runs in succession. The goal is to get everythin

Re: shell, perl, performance, parallelism, profiling, etc. (was: Upgrade guidance)

2008-10-22 Thread Ben Scott
the code writes to them. > Perl has tried a couple times to make it safe and easy, but > MP intrinsically isn't ... Ah, much like security. :) > A shell pipe with sort in it won't be doing more than loading the > executable / spawning the process in parallel, since the s

Re: shell, perl, performance, parallelism, profiling, etc.

2008-10-22 Thread Jerry Feldman
text (instructions and read-only data) are never copied to swap as they are mapped into VM from their physical location. older Unix systems used to copy the program to swap, then a newer technique was to load it into memory and mark it as dirty. Putting this in terms of the shell and Perl, because the

Re: shell, perl, performance, parallelism, profiling, etc. (was: Upgrade guidance)

2008-10-22 Thread Bill Ricker
On Tue, Oct 21, 2008 at 6:51 PM, Ben Scott <[EMAIL PROTECTED]> wrote: >> Perl is poor at SMP (gah! perl threads!). > I've never had to worry about Perl MP. Sounds like I should be glad. :-) MP in any language is tricky, but sometimes it appears easy and bites you later. Per

Re: shell, perl, performance, parallelism, profiling, etc. (was: Upgrade guidance)

2008-10-21 Thread Ben Scott
On Tue, Oct 21, 2008 at 6:51 PM, Ben Scott <[EMAIL PROTECTED]> wrote: > Challenge accepted okay, intersect.pl will follow in a separate message. #!/usr/bin/perl -w # intersect.pl # Gives the intersection of two text files (lines contained in both files). # Similar to comm(1), but

Re: shell, perl, performance, parallelism, profiling, etc. (was: Upgrade guidance)

2008-10-21 Thread Ben Scott
.) So. Curiouser and curiouser. You've got more RAM. Slightly slower CPU clock. Your RPM database file size is not that much bigger than mine. I've got a few more packages installed. All in all, pretty similar. Yet it takes your computer 3 minutes to run the Perl script, and mine 7 seco

Re: shell, perl, performance, parallelism, profiling, etc. (was: Upgrade guidance)

2008-10-21 Thread Kevin D. Clark
Ben Scott writes: > Consider: If the RPM database is in cache, then the > "package-cleanup" utility is going to mainly be reading data from > already cached pages (memory mapped file I/O). In the Perl script, > everything is serialized. But in the bash script,

Re: shell, perl, performance, parallelism, profiling, etc. (was: Upgrade guidance)

2008-10-21 Thread Bill McGonigle
2094536 model name : Intel(R) Pentium(R) 4 CPU 2.50GHz stepping: 9 cpu MHz : 2500.226 cache size : 512 KB > Hmmm, maybe the dual core also means multiple processes can run > concurrently, while Perl is serializing everything? ah, or perhaps time doesn't ho

Re: shell, perl, performance, parallelism, profiling, etc. (was: Upgrade guidance)

2008-10-21 Thread Ben Scott
On Tue, Oct 21, 2008 at 2:36 PM, Michael Pelletier <[EMAIL PROTECTED]> wrote: > An important thing to remember with Perl is that the Perl > interpreter must be loaded before the script can proceed. This may > explain the difference in your case, Ben. I ran several successive

Re: shell, perl, performance, parallelism, profiling, etc. (was: Upgrade guidance)

2008-10-21 Thread Michael ODonnell
>> Note, only valid in bash, not sh. > >Yah, and it doesn't matter if you use "#!/bin/bash" at the top >if you're running the script with "sh foo.sh". It took me five >minutes to figure that out just now. D'oh. That process substitution facility is a favorite of mine but it isn't POSIX, and II

Re: shell, perl, performance, parallelism, profiling, etc. (was: Upgrade guidance)

2008-10-21 Thread Michael Pelletier
why: > > *Very* interesting. I don't get anywhere near the same results. >I'm seeing the following as typical: > >== Shell tools == >real0m4.650s >user0m0.002s >sys 0m0.005s > >== Perl == >real0m6.915s >user0m6.135s >sys 0m0.642s

shell, perl, performance, parallelism, profiling, etc. (was: Upgrade guidance)

2008-10-21 Thread Ben Scott
;sh foo.sh". It took me five minutes to figure that out just now. D'oh. > Efficiency is surprisingly worse with bash/comm, I don't get why: *Very* interesting. I don't get anywhere near the same results. I'm seeing the following as typical: == Shell tools == rea

Boston Perl Mongers seeking speakers

2008-07-06 Thread Bill Ricker
If any members of BLU, GNHLUG, or Ubuntu Mass LoCo have YAPC, OSCON or other talks that would be appropriate for a Perl-centric community, we'd be interested to hear you. We meet in the same MIT E51 building as BLU but up the side corridor, normally on 2nd Tuesday (but July 15th due to ho

Re: Perl best practices

2007-09-17 Thread Ben Scott
better be more than just simple contradiction, too. I expect a connected series of statements intended to establish a proposition! ;-) (And they say Perl and Python have nothing in common. ;-) ) > To avoid LTS and backslashitis in a regexp, I tend to do something like: >m|/foo/bar|/b

Re: Perl best practices

2007-09-14 Thread Paul Lussier
an old Python guy who knows just enough Perl to get it wrong, this > has been educational (and even fun). I'm glad you enjoyed it! That's why I wrote it. I feel that perl has a bad reputation for being "ugly". I believe it's a myth. One can write ugly code in any lan

Re: Perl best practices

2007-09-14 Thread Paul Lussier
[EMAIL PROTECTED] (Kevin D. Clark) writes: > Bill Ricker writes: > >> I highly recommend Damian Conway's book of same title, "Perl Best >> Practices", which recommends a much tamer, consistent readable style >> within a workgroup than he uses in his o

Re: Perl best practices (was: question ... Split operator in Perl)

2007-09-14 Thread Kevin D. Clark
Bill Ricker writes: > I highly recommend Damian Conway's book of same title, "Perl Best > Practices", which recommends a much tamer, consistent readable style > within a workgroup than he uses in his own code (depending on context) > -- he suggests one style but enco

Re: Perl best practices (was: question ... Split operator in Perl)

2007-09-14 Thread Bill Ricker
I highly recommend Damian Conway's book of same title, "Perl Best Practices", which recommends a much tamer, consistent readable style within a workgroup than he uses in his own code (depending on context) -- he suggests one style but encourages each group to decide for themselv

Re: Perl best practices

2007-09-14 Thread Lloyd Kvam
On Thu, 2007-09-13 at 23:58 -0400, Paul Lussier wrote: > For all those just tuning in, Ben and I are in violent and vocal > agreement with each other, and at this point are merely quibbling over > semantics :) As an old Python guy who knows just enough Perl to get it wrong, this

Re: Perl best practices

2007-09-13 Thread Paul Lussier
thinking of the first example in this discussion, which had LTS > (Leaning Toothpick Syndrome). I will use // if the regexp doesn't > suffer from LTS. I use m{} or s{}{} when the regexp otherwise > contains slashes. Something about the use {} and () in regexps really bothers me. I

Re: Perl best practices

2007-09-13 Thread Ben Scott
On 13 Sep 2007 12:10:58 -0400, Kevin D. Clark <[EMAIL PROTECTED]> wrote: > If I write anything else, it would just be a combination of me > nit-picking for no purpose and hot air. Welcome to the Internet! ;-) -- Ben ___ gnhlug-discuss mailing list g

Re: Perl best practices

2007-09-13 Thread Ben Scott
nes of comments explaining certain design decisions, but that's one one of them.) > my $file = shift; You're using an implicit argument to shift there. ;-) > The compelling argument is this: It should be blatantly obvious to > whomever is going to be maintaining your code

Re: Perl best practices

2007-09-13 Thread Kevin D. Clark
Paul Lussier writes: > (/me waiting for Kevin to pipe in here in 4...3...2...1... ;) Ben and Paul are competent Perl programmers. They write good code. Code should be written to be clear. While it is nice if code written in a given language is understandable by people who don't

Re: Perl best practices

2007-09-13 Thread Paul Lussier
another one. [...] > Assuming the reader is familiar with the language, which do you > think will be easier/quicker to comprehend? Both of these hurt my eyes! :) This one is short and sweet: > #!/usr/bin/perl -wp > s/^[\x20\t]*//; # trim leading space > s/[\x20\t]*$//; # trim tr

Re: Perl best practices (was: question ... Split operator in Perl)

2007-09-13 Thread Ben Scott
tab worked better for me. OTOH, \s should eat other kinds of in-line whitespace that might be encountered, including anything Unicode dishes up. So that might be better for some situations. YMMV. Or, since this is Perl we're talking about: TIMTOWTDI. ;-) -- Ben _

Re: Perl best practices (was: question ... Split operator in Perl)

2007-09-12 Thread John Abreau
On Wed, September 12, 2007 9:37 pm, Ben Scott said: > s/^[\x20\t]*//; # trim leading space > s/[\x20\t]*$//; # trim trailing space > Any particular reason to use [\x20\t] instead of \s ? -- John Abreau / Executive Director, Boston Linux & Unix IM: [EMAIL PROTECTED] / [EMAIL PROTECTED] / [EMAI

Perl best practices (was: question ... Split operator in Perl)

2007-09-12 Thread Ben Scott
On 9/12/07, Paul Lussier <[EMAIL PROTECTED]> wrote: >> You don't need to put parenthesis around arguments to split, and you >> don't need to explicitly specify the default pattern match target >> ($_). > > Unfortunately, you both "don't *need* to

Re: a question regarding the use of Split operator in Perl

2007-09-12 Thread Paul Lussier
"Ben Scott" <[EMAIL PROTECTED]> writes: > You don't need to put parenthesis around arguments to split, and you > don't need to explicitly specify the default pattern match target > ($_). Unfortunately, you both "don't *need* to" and "*ca

Re: a question regarding the use of Split operator in Perl

2007-09-11 Thread David J Berube
itespace within the phrase > 2, there are 2+ whitespace in between the phrases) > 3, each line start with 3 whitespace > ] > >good morninggood evening good night >go south go northgo east go west > > > I want to separate th

Re: a question regarding the use of Split operator in Perl

2007-09-11 Thread Ben Scott
On 9/11/07, Jerry <[EMAIL PROTECTED]> wrote: > I want to separate the phrases by 2+ whitespace to > separate these phrases, so I think the perl code > should look like this > @list = split ( /\s{2,}/, $_); This may do what you want: @list = split ( /\s{2,}|\s\*\s/,

Fwd: a question regarding the use of Split operator in Perl

2007-09-11 Thread Jerry
f Split operator in Perl To: gnhlug-discuss@mail.gnhlug.org Hi, First I want to apologize for that lately I've been blasting this great list with my "almost stupid" questions. I simply couldn't find any better place to ask than here. :-) Say I have 2 lines of phrases shown bel

a question regarding the use of Split operator in Perl

2007-09-11 Thread Jerry
ce to separate these phrases, so I think the perl code should look like this @list = split ( /\s{2,}/, $_); The desired output should look like this: "good morning","good evening","good night" "go south", "go north", "go east",

a song about Perl on YouTube by Pudge

2007-07-23 Thread Don Leslie
http://www.youtube.com/watch?v=Mxk5RMQF6Js ___ gnhlug-discuss mailing list gnhlug-discuss@mail.gnhlug.org http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/

Re: Stupid Perl/Apache Question - Fixed!

2006-12-13 Thread Dan Jenkins
Brian Chabot wrote: ...nothing like debugging through trial and error. Think of it as a form of genetic programming. :-) You've naturally selected the fittest solution. -- Dan Jenkins ([EMAIL PROTECTED]) Rastech Inc., Bedford, NH, USA --- 1-603-206-9951 *** Technical Support Excellence for

Re: Stupid Perl/Apache Question - Fixed!

2006-12-13 Thread Brian Chabot
Ben Scott wrote: [regarding two ways of passing vars to a module] > Remember, this is Perl, where there are 50 different ways to do > anything. Sometimes that's useful, sometimes less so. So I hoped. The problem is neither "Learning Perl" nor "Perl in a Nutshell"

Re: Stupid Perl/Apache Question

2006-12-07 Thread Kevin D. Clark
What happens if you code your credentials this way?: $mech->credentials( 'host.domain.tld:443', '//cgi-bin/myscript.cgi/', 'adminuser' => 'adminpass' ); The LWP (which WWW::Mechanize is based upon) mentions this method. Also, can you verify that you are creating your mec

Re: Stupid Perl/Apache Question

2006-12-07 Thread Brian Chabot
Thomas Charron wrote: > Your perl skilz n33d working on. ;-) They're the same thing. Learning perl by writing inefficient tools that streamline my job. Wee! >> "Illegal seek"? That's very strange. H... um, try the method >> > above first. Ma

Re: Stupid Perl/Apache Question

2006-12-07 Thread Ben Scott
Postscript: On 12/7/06, Ben Scott <[EMAIL PROTECTED]> wrote: system qq("curl $url -o $outfile"); # valid Perl code ;-) ... but a bogus command. That should be: system qq(curl "$url" -o "$outfile"); -- B __

Re: Stupid Perl/Apache Question

2006-12-07 Thread Ben Scott
->credentials ("username","password"); ...or does it matter? It doesn't matter. They're both variants of the same thing. Remember, this is Perl, where there are 50 different ways to do anything. Sometimes that's useful, sometimes less so. http://search.cpan.o

Re: Stupid Perl/Apache Question

2006-12-07 Thread Thomas Charron
$mech->credentials ("username","password"); ...or does it matter? Your perl skilz n33d working on. ;-) They're the same thing. "Illegal seek"? That's very strange. H... um, try the method > above first. Maybe we'll get lucky and th

Re: Stupid Perl/Apache Question

2006-12-07 Thread Thomas Charron
Make sure you have IO::Socket:SSL installed as well. It could also be a socket that was closed prematurely. On 12/7/06, Brian Chabot <[EMAIL PROTECTED]> wrote: I'm trying to use a perl script to scrape a site under https. Using perl-WWW-Mechanize-1.20-1mdv2007.0 from RPM. perl-

Re: Stupid Perl/Apache Question

2006-12-07 Thread Brian Chabot
s in the situation. I ended up just > calling out to "curl" to do the actual download. If I had my way, I wouldn't need to use Mech at all. I'd be accessing the db directly and using PHP or just bash scripting with curl, too. The job's requirements are where I need to scrape in perl... Brian ___ gnhlug-discuss mailing list gnhlug-discuss@mail.gnhlug.org http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/

Re: Stupid Perl/Apache Question

2006-12-07 Thread Ben Scott
On 12/7/06, Brian Chabot <[EMAIL PROTECTED]> wrote: $auth = MIME::Base64::encode("$adminuser:$adminpass") || die "Error: $!\n"; $mech->add_header (Authorization=>"Basic $auth") || die "Error: $!\n"; You need to do this: $mech->credentials ("username" => "password"); Yet I keep seeing this e

Stupid Perl/Apache Question

2006-12-07 Thread Brian Chabot
I'm trying to use a perl script to scrape a site under https. Using perl-WWW-Mechanize-1.20-1mdv2007.0 from RPM. perl-Apache-Test-1.28-2mdv2007.0 apache-base-2.2.3-1mdv2007.0 apache-mod_perl-2.0.2-8mdv2007.0 The script parses fine till it goes to scrape the page... The line that's

Re: question: text substitution using Perl

2006-10-24 Thread Bill Ricker
and ' are quoted by \ inside 's. Note that q{} and qq{} are aliases for ' ' and " ", and you can use your choice of bracketing characters. http://perldoc.perl.org/perlop.html#Regexp-Quote-Like-Operators -- Bill [EMAIL PROTECTED] [EMAIL PROTECTED] Boston Perl Mon

Re: question: text substitution using Perl

2006-10-23 Thread Steven W. Orr
On Monday, Oct 23rd 2006 at 14:55 -0400, quoth Zhao Peng: =>Mike and Kevin, => =>Thank you both for quick, detailed, and crystal clarification and =>explanation. => =>Just one more question: => =>"To the shell, anything inside of single quotes is a single argument, so all =>of the spaces, newline

Re: question: text substitution using Perl

2006-10-23 Thread Kevin D. Clark
do well to understand all of these scenerios: (look at how FOO is quoted at the end of each line) $ FOO="zero one two three four" ### $ perl -le '$i=0; print "\n\nNumber of command line arguments: ", scalar(@A

Re: question: text substitution using Perl

2006-10-23 Thread Zhao Peng
Mike and Kevin, Thank you both for quick, detailed, and crystal clarification and explanation. Just one more question: "To the shell, anything inside of single quotes is a single argument, so all of the spaces, newlines, etc. in there are passed without shell interpretation" (quoted from th

Re: question: text substitution using Perl

2006-10-23 Thread Kevin D. Clark
gt; an extra caution to make sure it refers to the 1st captured buffer in > case there are some digits followed. No, I wrote it this way just to make the code clear -- there wasn't a technical reason for this. > > Question 2: > line 1> perl -i.bak \ > line 2>

Re: question: text substitution using Perl

2006-10-23 Thread Zhao Peng
e 1st captured buffer in case there are some digits followed. Question 2: line 1> perl -i.bak \ line 2>-pe 's/ \$(\d+)\. / \$ebcdic${1}. /g; line 3> s/ (\d+)\. / s370ff${1}. /g;' \ line 4>your-directory-somewhere/*readme* On the end of line 1 a

Re: question: text substitution using Perl

2006-10-20 Thread Kevin D. Clark
titution will look like this > > 2. -> s370ff2. > 14. -> s370ff14. > > Should the regular expression for original string be: \d+\. ? I would make this replacement like this: s/ (\d+)\. / s370ff${1}. /g; > My real situation is that I have a bunch of files at one directory

question: text substitution using Perl

2006-10-20 Thread Zhao Peng
Hi, Being a slow Perl learner who hasn't make much progress, I'm wondering if some kind souls could help me achieve the following 2 text substitution tasks detailed below. substitution 1 The characteristic of original string: 1, always start with "$"

Re: Perl CGI charset magic thingy (was: How to be an expert)

2006-06-13 Thread Mark Komarinski
On Tue, Jun 13, 2006 at 09:31:14AM -0400, Ben Scott wrote (and I changed): > >... but, if so, then I don't understand why. Anyone care to give > >me their interpretation? [From /usr/share/perl5/Bugzilla/CGI.pm] > > > >$self->charset(Param('utf8') ? 'UTF-8' : ''); > > Well, that looks like

Perl CGI charset magic thingy (was: How to be an expert)

2006-06-13 Thread Ben Scott
On 6/13/06, Ken D'Ambrosio <[EMAIL PROTECTED]> wrote: Speaking about being ignorant, I *think* I understand what the following line does... ... but, if so, then I don't understand why. Anyone care to give me their interpretation? [From /usr/share/perl5/Bugzilla/CGI.pm] $self->charset(

Re: perl - sometimes it *does* resemble line noise... (long)

2006-05-12 Thread Paul Lussier
The multi-map/grep/split thing was the result of a couple refactorings before I came to the same conclusion :) > I say this, of course, as somebody who is an enthusiastic Perl > programmer. Code that is hard to understand and maintain will > eventually either get rewritten or junked. Ye

Re: perl - sometimes it *does* resemble line noise... (long)

2006-05-12 Thread Kevin D. Clark
"write-once" code) in my opinion the original version of the code that you presented is preferable. I say this, of course, as somebody who is an enthusiastic Perl programmer. Code that is hard to understand and maintain will eventually either get rewritten or junked. Just another Pe

perl - sometimes it *does* resemble line noise... (long)

2006-05-12 Thread Paul Lussier
, a little simpler, but some of the original simplicity got lost in all the refactoring along the way, and, I think, in some places, even replaced with correctness :) At one point, I asked a friend to come and review my code. This person happens to be a scheme/lisp afficianado as well as one of the

Re: perl and network addresses

2006-04-03 Thread Jason Stephenson
Kevin D. Clark wrote: Another thing to be aware of (but which hasn't come up...yet...in this thread) is that all of the test code that I see here uses signed integers for the bit operations (~ << etc.). The C spec. specifically states that the results of such expressions is system dependent (an

Re: perl and network addresses

2006-04-03 Thread Kevin D. Clark
Stephen Ryan writes: > Ooh, here's something interesting. I first tried a test with constants, > and got the warning: left shift count >= width of type" out of gcc. > Then I rewrote the thing to use a loop, and I got correct results out of > it. (This is all on an Athlon64X2.) > > When you desc

Re: perl and network addresses

2006-03-31 Thread Stephen Ryan
On Fri, 2006-03-31 at 21:00 -0500, Jason Stephenson wrote: > Stephen Ryan wrote: > > hostmask = (1 << (32 - n)) - 1 > > netmask = ~ hostmask > > Doh! That's so obvious, so obviously, I overlooked it. ;) Well, yes, of course :-) > > > > 1 << (32 - n) in binary is (n-1) '0' bits, a '1', then (32

Re: perl and network addresses

2006-03-31 Thread Jason Stephenson
Stephen Ryan wrote: Can anyone think of a better way to blit an arbitrary number of bits from 0 to 1? Well, let's see Taking advantage of the fact that all of the '1' bits are at the end of the hostmask, you've actually almost gotten it already. hostmask = (1 << (32 - n)) - 1 netmask =

Re: perl and network addresses

2006-03-31 Thread Stephen Ryan
On Thu, 2006-03-30 at 20:35 -0500, Jason Stephenson wrote: > Paul Lussier wrote: > > > Yes, more or less. Between you and Jason I've been able to come up > > with exactly what I need. Thanks a lot for all your help. Why I > > couldn't see this for myself is beyond me. Of course, this week has

Re: perl and network addresses

2006-03-30 Thread Jason Stephenson
Paul Lussier wrote: Yes, more or less. Between you and Jason I've been able to come up with exactly what I need. Thanks a lot for all your help. Why I couldn't see this for myself is beyond me. Of course, this week has been full of me "missing the details" to the point where I somehow manage

Re: perl and network addresses

2006-03-30 Thread Paul Lussier
oduct could approach 255+ hosts in a single installation, in practice, the number of hosts in a single install is rarely more than 10. > Okay, in return for taking the time and effort to explain all that, > I took the time to figure out how to get Perl to convert IP addresses. > Hope

Re: perl and network addresses

2006-03-29 Thread Ben Scott
might be that. As for the rest... wow... funky. I do hope all that multi-homing to the same network is for test/simulation procedures. :) Okay, in return for taking the time and effort to explain all that, I took the time to figure out how to get Perl to convert IP addresses. Hopefully th

Re: perl and network addresses

2006-03-28 Thread Paul Lussier
Jason Stephenson <[EMAIL PROTECTED]> writes: > I'd suggest looking up how to configure VLANs on whatever you're > using for a router.--I know you mentioned a FreeBSD firewall > earlier. You must have missed the part where I said "we don't have a router", "we're migrating to a comletely new networ

Re: perl and network addresses

2006-03-28 Thread Jason Stephenson
Paul Lussier wrote: Errr, no, just the opposite actually. Trying to *prevent* routing from a very existent router :) Sounds to me like what you really need is a router with VLAN capability. If I understand correctly, it sounds like you're trying to implement VLANs. Your setup actually soun

Re: perl and network addresses

2006-03-28 Thread Jason Stephenson
Paul Lussier wrote: Jason Stephenson <[EMAIL PROTECTED]> writes: It seems to me that the answer is that your IP addresses are limited to the range of 10.0.32.0 to 10.0.63.255 with 10.0.0.0 being the network address and 10.255.255.255 being the broadcast address, no? Err, you've got the IP a

Re: perl and network addresses

2006-03-28 Thread Paul Lussier
"Ben Scott" <[EMAIL PROTECTED]> writes: > On 3/28/06, Paul Lussier <[EMAIL PROTECTED]> wrote: >> If you really want the long convoluted discussion, I'll be glad to >> post it, I just figured no on would care. > > Well, everyone here knows *I* thrive on long, convoluted > discussions. I'm also c

Re: perl and network addresses

2006-03-28 Thread Paul Lussier
"Ben Scott" <[EMAIL PROTECTED]> writes: > Well... okay... but it's the *why* that makes me wonder. :) > > I hope it's something interesting, and not just that he's trying to > say that he's been assigned the addresses in the range 10.0.32.0/19 on > the 10.0.0.0/16 network. That would be *so*

Re: perl and network addresses

2006-03-28 Thread Paul Lussier
Jason Stephenson <[EMAIL PROTECTED]> writes: > It seems to me that the answer is that your IP addresses are limited > to the range of 10.0.32.0 to 10.0.63.255 with 10.0.0.0 being the > network address and 10.255.255.255 being the broadcast address, no? Err, you've got the IP addresses wrong. It'

Re: perl and network addresses

2006-03-28 Thread Ben Scott
On 3/28/06, Jason Stephenson <[EMAIL PROTECTED]> wrote: > Of course, after looking back through the thread, I see Ben has already > pretty much answered the above. ;) "Repetition is the very soul of the net." -- from alt.config > Paul is using a network that is restricted to using a /19 netmask

Re: perl and network addresses

2006-03-28 Thread Ben Scott
ng to route packets through a non-existant gateway again. ;-) >> perl -we '$a = inet_addr("192.0.2.42");' >> >> but it complained that inet_addr is not defined. > > You likely need to use -MSocket, and then figure out which of the > correct fun

Re: perl and network addresses

2006-03-28 Thread Jason Stephenson
st addresses is very straightforward. Here's some sample code: network = address & netmask; broadcast = address | ~netmask; The above is C, but should work in Perl, too. Of course, after looking back through the thread, I see Ben has already pretty much answered the above. ;) I think I un

Re: perl and network addresses

2006-03-28 Thread Paul Lussier
"Ben Scott" <[EMAIL PROTECTED]> writes: > I tried > > perl -we '$a = inet_addr("192.0.2.42");' > > but it complained that inet_addr is not defined. I suspect there's a > module somewhere you need to pull in. Hopefully this is en

Re: perl and network addresses

2006-03-28 Thread Paul Lussier
Python <[EMAIL PROTECTED]> writes: > Would it help to convert to 32-bit integers? I might. I'll try that. > I think I understand the arithmetic. I do not really understand what > you are trying to do. That's okay, neither do I ;) (If you really want the long convoluted discussion, I'll be

Re: perl and network addresses

2006-03-27 Thread Ben Scott
this stuff if you write it out in binary notation (view using a fixed-width font): /19 = 255.255.224.0 010.000.033.189 = 1010 0011 1001 255.255.224.000 = 1110 Net portion = 1010 0010 Node portion= 00

Re: perl and network addresses

2006-03-27 Thread Python
On Mon, 2006-03-27 at 14:25 -0500, Paul Lussier wrote: > Hi all, > > I'm stumped. I've got a network address space of 10.0.32/19. How > ever, this space is carved up using a /16 netmask. In otherwords, the > /19 netmask was simply used to *allocate* the space from 10.0.32.0 to > 10.0.63.255, bu

perl and network addresses

2006-03-27 Thread Paul Lussier
Hi all, I'm stumped. I've got a network address space of 10.0.32/19. How ever, this space is carved up using a /16 netmask. In otherwords, the /19 netmask was simply used to *allocate* the space from 10.0.32.0 to 10.0.63.255, but we actually *use* the space with a /16 netmask (yes, this means

  1   2   >