Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > TIEHANDLE and deep recursion

Reply
Thread Tools

TIEHANDLE and deep recursion

 
 
Rainer Weikusat
Guest
Posts: n/a
 
      05-10-2012
Tim Watts <(E-Mail Removed)> writes:
> Rainer Weikusat wrote:
>> Tim Watts <(E-Mail Removed)> writes:
>>> Rainer Weikusat wrote:
>>>> An entirely different approach to accomplish this:
>>>>
>>>> ---------------
>>>> package SafeFile;
>>>>
>>>> sub new
>>>> {
>>>> my ($class, $name) = @_;
>>>> my $fh;
>>>>
>>>> open($fh, '>', $name.'.tmp')
>>>> or die("open: $name.tmp: $!");
>>>>
>>>> ${*$fh{SCALAR}} = $name;
>>>> return bless($fh, $class);
>>>> }
>>>>
>>>> sub DESTROY
>>>> {
>>>> my $fh = $_[0];
>>>> my $name;
>>>>
>>>> close($fh);
>>>>
>>>> $name = ${*$fh{SCALAR}};
>>>> rename($name.'.tmp', $name);
>>>> }
>>>>
>>>> package main;
>>>>
>>>> {
>>>> my $fh = SafeFile->new('/tmp/ziegenwurst');
>>>>
>>>> print $fh ("Ziege\n");
>>>> print $fh ("Salz\n");
>>>> }
>>>
>>> Hi Rainer,
>>>
>>> I did consider something like this - but more like a fully OO style where
>>> the print/write methods would be implemented

>>
>> Read: You didn't "consider something like this".

>
> What's got your goat?
>
> I did consider something like this (I think I'd know) - specifically:
>
> my $fobj = SafeFile->new(filename, options...);
>
> $obj->print(Blah);


As I already wrote: You didn't. And you wouldn't ever ...
Apart from that, I'm not interested in this ****ing contest.
 
Reply With Quote
 
 
 
 
Tim Watts
Guest
Posts: n/a
 
      05-10-2012
Rainer Weikusat wrote:


> As I already wrote: You didn't. And you wouldn't ever ...


Then you would be wrong. I have toyed with several possible methods.

> Apart from that, I'm not interested in this ****ing contest.


Whatever...
--
Tim Watts
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
va_arg... recursion: changing arguments and the using recursion jononanon@googlemail.com C Programming 8 04-26-2012 08:37 PM
error message Deep recursion on subroutine NamSa Perl Misc 1 05-04-2009 10:25 AM
efficiency of recursion (stack level too deep) Chet Nichols III Ruby 3 11-14-2007 08:41 PM
Deep Freeze In Deep Trouble johntangelo@gmail.com Computer Security 3 10-25-2005 11:49 PM
Returning value from deep recursion Arun Java 1 01-26-2005 03:05 AM



Advertisments