On Sat, Jul 30, 2005 at 11:03:09PM -0400, Tom Allison wrote:

> Tom Allison wrote:
> >sub new
> >{
> >        my %args = (
> >                output_dir       => '/tmp',
> >                tmp_recycling    => 1,
> >                extract_uuencode => 1,
> >                ignore_errors    => 1
> >        );
> >        my $class = shift;
> >        %args = @_;
> >
> 
> I over write %args...
> change to
> my %a = @_;
> %args = (%args, %a);
> 
> But I'm not sure that this is as clean as it could be.

I'd probably do something like:

    my %args = (
            output_dir       => '/tmp',
            tmp_recycling    => 1,
            extract_uuencode => 1,
            ignore_errors    => 1,
            @_
    );

A lot of my constructors look similar to this.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to