in reply to Having problems with class::struct

Have you looked at the CPAN modules? Win32::IPConfig is an OO interface to the ipconfig data.

Though if what you have works for what you need it for (and is working with the helpful suggestions already listed), then just stick with what you've got.

Replies are listed 'Best First'.
Re: Re: Having problems with class::struct
by dragonchild (Archbishop) on Dec 12, 2003 at 13:29 UTC
    You are correct in that the OP has code that meets dragonchild's First Criterion of Good Coding. However, I would actually argue that the OP should convert to Win32::IPConfig, for the following reasons:
    1. OP would learn more about the Win32:: namespace
    2. OP would learn why it is useful to use said namespace
    3. Maintainer(s) (which might include OP) won't have to deal with hand-rolled code (and the bugs that go with no peer review)
    4. If ipconfig changes (as it probably will), Win32::IPConfig will (should?) change with it
    5. Should ipconfig be different on different Win32 machines, Win32::IPConfig will (should?) handle that transparently

    Those reasons boil down to meeting the Second Criterion of Good Coding.

    1. Code should do what it needs to do.
    2. Code should be both easy and safe to modify.

    1. Code that meets #1, no matter how poorly written, is "good".
    2. Code that meets both #1 and #2 is "great".
    3. Code that meets #2, but not #1, is worthless.

    ------
    We are the carpenters and bricklayers of the Information Age.

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.