On Mon, May 06, 2002 at 11:40:10AM -0700, drieux wrote:
> 
> I'm very confused by the idea of
> 
>       my %args = (
>               PARTITION => '',
>               PARTITIONFILE => '',
>               OUTPUTFILENAME => '',
>               @_,
>       );
> 
> why not the simpler
> 
>       my ( $outputFile, $partitionFile, $partition) = @_;

I guess he over-idiomized:  I use the above frequently to preinitialize
objects:

    sub new {
        my $context = shift
        my $class = ref($context) || $context;
        bless {
            a_number  => 42,
            some_text => 'I have a value',
            @_
        }, $class
    }

That way, one can do the following:

    my $obj = TheClass->new(some_other_value => 57,
                            a_number => 12);

Now, some OO_Bigott would most probably jump right into my face for
allowing some user from the mob to add 'some_other_value' to our holy
moly class object, but in most cases I don't consider that a problem -
the OO_Bigott jumping, that is ;-)

-- 
                       If we fail, we will lose the war.

Michael Lamertz                        |      +49 221 445420 / +49 171 6900 310
Nordstr. 49                            |                       [EMAIL PROTECTED]
50733 Cologne                          |                 http://www.lamertz.net
Germany                                |               http://www.perl-ronin.de 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to