Re: OO confusion

2009-01-12 Thread Jenda Krynicky
From: Mike McClain > On Sat, Jan 10, 2009 at 09:56:24PM -0800, Randal L. Schwartz wrote: > > > > I prefer the "do" form, myself. > > Is there a functional reason for your preference > or is it just a matter of taste? I can't talk for Randal, but for me there is a simple reason. In the do

Re: OO confusion

2009-01-12 Thread Mike McClain
On Sat, Jan 10, 2009 at 09:56:24PM -0800, Randal L. Schwartz wrote: > > I prefer the "do" form, myself. Is there a functional reason for your preference or is it just a matter of taste? Mike -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginn

Re: OO confusion

2009-01-11 Thread Dr.Ruud
Randal L. Schwartz wrote: Ruud: is better written as ... for varying and arguable values of "better". I prefer the "do" form, myself. The simple problem with the do-form is that it easily uses double the memory because it allocates two buffers (as I hinted in the part that you didn't quo

Re: OO confusion

2009-01-11 Thread Rob Dixon
Randal L. Schwartz wrote: >> "Rob" == Rob Dixon writes: > > Rob> I tested the similar > > Rob> my @data = do { > Rob> open my $fh, '<', $file or die $!; > Rob> <$fh>; > Rob> }; > > Rob> a while ago, but not on v5.10. I will see if I can find time to try it > again. > > Ahh, bu

Re: OO confusion

2009-01-11 Thread Rob Dixon
Randal L. Schwartz wrote: >> "Rob" == Rob Dixon writes: > > Rob> But the first causes Perl to keep two copies of the file data, which may > be > Rob> unacceptable depending on the the size of the file and the specification > of the > Rob> platform. > > Does it really? Have you tested this

Re: OO confusion

2009-01-11 Thread Randal L. Schwartz
> "Rob" == Rob Dixon writes: Rob> I tested the similar Rob> my @data = do { Rob> open my $fh, '<', $file or die $!; Rob> <$fh>; Rob> }; Rob> a while ago, but not on v5.10. I will see if I can find time to try it again. Ahh, but that's very different. My suspicion is that both

Re: OO confusion

2009-01-11 Thread Rob Dixon
Randal L. Schwartz wrote: >> "Rob" == Rob Dixon writes: > > Rob> But the first causes Perl to keep two copies of the file data, which may > be > Rob> unacceptable depending on the the size of the file and the specification > of the > Rob> platform. > > Does it really? Have you tested this

Re: OO confusion

2009-01-11 Thread Randal L. Schwartz
> "Rob" == Rob Dixon writes: Rob> But the first causes Perl to keep two copies of the file data, which may be Rob> unacceptable depending on the the size of the file and the specification of the Rob> platform. Does it really? Have you tested this? I suspect it actually doesn't. -- Randa

Re: OO confusion

2009-01-11 Thread Rob Dixon
Randal L. Schwartz wrote: >> ""Dr" == "Dr Ruud" writes: > > "Dr> is better written as > > ... for varying and arguable values of "better". > > I prefer the "do" form, myself. I too much prefer the style of my $data = do { local $/; ; }; over my $data; { local $/;

Re: OO confusion

2009-01-11 Thread Mike McClain
On Sat, Jan 10, 2009 at 03:26:33PM +0100, Jenda Krynicky wrote: > The Class::Name->method(...) is a class method call. Perl will find > the method in the clas hierarchy and call the method and pass the > 'Class::Name' as the first parameter. > Thank you Jenda that's very clear. Mike -- To

Re: OO confusion

2009-01-11 Thread John W. Krahn
Dr.Ruud wrote: Jenda Krynicky wrote: my $data = do {local $/; }; is better written as my $data; { local $/; $data = }; For smallish files it doesn't matter much. Or perhaps: read DATA, my $data, -s DATA; John -- Those people who think they know everything are a great annoyance to t

Re: OO confusion

2009-01-10 Thread Randal L. Schwartz
> ""Dr" == "Dr Ruud" writes: "Dr> is better written as ... for varying and arguable values of "better". I prefer the "do" form, myself. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 http://www.stonehenge.com/merlyn/> Smalltalk/Perl/Unix consulting, Techni

Re: OO confusion

2009-01-10 Thread Dr.Ruud
Jenda Krynicky wrote: my $data = do {local $/; }; is better written as my $data; { local $/; $data = }; For smallish files it doesn't matter much. -- Ruud -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl

Re: OO confusion

2009-01-10 Thread Chas. Owens
On Sat, Jan 10, 2009 at 09:26, Jenda Krynicky wrote: > From: Mike McClain >> On Fri, Jan 09, 2009 at 05:52:45PM -0500, Chas. Owens wrote: >> >> > You seem to be under the impression that the argument to >> > Digest::MD5::md5_hex is a file name. The argument is a scalar holding >> > the data to

Re: OO confusion

2009-01-10 Thread Jenda Krynicky
From: Mike McClain > On Fri, Jan 09, 2009 at 05:52:45PM -0500, Chas. Owens wrote: > > > You seem to be under the impression that the argument to > > Digest::MD5::md5_hex is a file name. The argument is a scalar holding > > the data to perform md5 on. So Digest::MD5::md5_hex("foo") will give > >

Re: OO confusion

2009-01-09 Thread Mike McClain
On Fri, Jan 09, 2009 at 05:52:45PM -0500, Chas. Owens wrote: > You seem to be under the impression that the argument to > Digest::MD5::md5_hex is a file name. The argument is a scalar holding > the data to perform md5 on. So Digest::MD5::md5_hex("foo") will give > you the MD5 of the data "foo".

Re: OO confusion

2009-01-09 Thread Chas. Owens
On Fri, Jan 9, 2009 at 16:40, Mike McClain wrote: snip >I appreciate your taking the time to respond and having been > reading your responses for several months now have no doubt that > you know what you're talking about. >I'm still not clear however about what's going on. >As you can

Re: OO confusion

2009-01-09 Thread Mike McClain
On Thu, Jan 08, 2009 at 07:12:03PM -0500, Chas. Owens wrote: > On Thu, Jan 8, 2009 at 17:47, root wrote: > >The following script gives me confusing results. > > I've not delved into OOP before and am surprised when something > > appears to work but gives wrong answers. > >Explicitly Digest

Re: OO confusion

2009-01-09 Thread Mike McClain
On Thu, Jan 08, 2009 at 06:47:05PM -0800, John W. Krahn wrote: > root wrote: > >The following script gives me confusing results. > >I've not delved into OOP before and am surprised when something > >appears to work but gives wrong answers. > > > >foreach( @ARGV) > >{ $target = $_; > > M

Re: OO confusion

2009-01-08 Thread John W. Krahn
root wrote: The following script gives me confusing results. I've not delved into OOP before and am surprised when something appears to work but gives wrong answers. Explicitly Digest::MD5's md5_hex gives wrong answers if called as Digest::MD5->md5_hex. OK, I've figured out that it shou

Re: OO confusion

2009-01-08 Thread Chas. Owens
On Thu, Jan 8, 2009 at 17:47, root wrote: >The following script gives me confusing results. > I've not delved into OOP before and am surprised when something > appears to work but gives wrong answers. >Explicitly Digest::MD5's md5_hex gives wrong answers if called as > Digest::MD5->md5_hex