Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Archive::Ar - pure perl way to handle Ar archives (comments encouraged)

by dash2 (Hermit)
on May 04, 2003 at 20:06 UTC ( #255516=note: print w/replies, xml ) Need Help??

in reply to Archive::Ar - pure perl way to handle Ar archives (comments encouraged)

I don't know if this works - away from my trusty Linuxbox - but it is a good idea. A pure perl Archive::Zip would be a really _brilliant_ idea - great for app packaging.

A few comments just from reading the source:

  • It's a good idea to stick to one subroutine naming convention: like_this or likeThis. In Perl, like_this is preferred as more readable.
  • You have an OO interface, so why export functions (esp. automatically)? AFAICS Archive::Tar doesn't do this.
  • ... especially as you are exporting functions named the same as Perl core functions (e.g. "read")
  • Hmm... do you come from Java? I don't see anything wrong with using $this instead of $self, it is just a bit unusual.
  • int $verbose == 0: no need. Just and not $verbose would be fine.
  • Similarly, return unless fileno $filehandle; is fine, and avoids non-standard brackets.

I'm just looking for nitpicks, you understand. It seems like very nice, clear code.

Replies are listed 'Best First'.
Re: Re: Archive::Ar - pure perl way to handle Ar archives (comments encouraged)
by JayBonci (Curate) on May 05, 2003 at 15:06 UTC
    Heya, thanks for taking a look. In response:
    1. Typically all of the functions anyone would want to use are like_this, and everything that's "internal" is _likeThis or _like_this. I guess it's just a matter of style.
    2. I wasn't sure about the exporting, and learned my mistake several versions out. It's fixed in he one that's in CPAN.
    3. I actually come from C. The $self vs. $this thing
    4. I use $verbose == 0 because calling DEBUG() without parameters turns it on. With a 0 parameter, it turns it off. It needs to be numerically false and existing.
    5. The unless fileno thing is a good suggestion, and i'll update it when I put through some module fixes tonight.
    It needs some compatibility testing. A pure perl Archive::Zip does sound like a good idea. hmmmm....


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://255516]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2022-05-17 02:14 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (65 votes). Check out past polls.