in reply to Dhcpclient module

Here is something I find odd:
exists($args{Server}) ? $self->serverid($args{Server}) : $self->{SERVE +R} = "0.0.0.0";
This is better written as:
$self->serverid($args{Server} || "0.0.0.0");
Not only is it more succinct, but it also observes the encapsulation that you've created with the serverid accessor.

Otherwise, where are you stuck?

Replies are listed 'Best First'.
Re^2: Dhcpclient module
by drip (Beadle) on Mar 28, 2008 at 01:47 UTC
    thank you for the suggestion ^_^...i am stuck because i am not quite sure if what i am doing is right..
    1.)is it ok if i use a lot of modules to create another module?is that advisable?
    2.)would it be better if i use pack/unpack(i still need to learn it though) to decode the packet rather than using the modules?
    3.)how do i use the full potential of OOP?
    =)

      1) It's perfectly fine to build upon the work of others. OOP was developed with the idea of making it easy to reuse software.

      2) Becoming comfortable with pack and unpack is always a good idea, but using a CPAN module is fine too, if it solves your problem.

      3) Mastering the full potential of OOP could take a lifetime. In fact, I doubt anyone knows what its full potential really is. I would suggest incrementally improving your OOP skills whenever you can. Look at other people's code, and see how they solve problems using OOP. OOP techniques are especially helpful in managing the complexities that occur in large programs. Also look at modules that get used a lot like the standard modules which come with perl. Their interfaces have been carefully crafted to make them useful in a general purpose setting. As you see more examples of well-written OOP code, you should get a feel for when certain methods are better than others. The OOP system in perl is very flexible, so it's difficult to lay down hard and fast rules about when to do things one way or another.

      My main question, though, is: does your code work the way you want it to?

        yes, the code works the way i want it to be..thank you..