develooper Front page | perl.perl5.porters | Postings from January 2011

Re: [PATCH 2/3] modernise package variable style

Thread Previous | Thread Next
From:
Eric Brine
Date:
January 30, 2011 22:38
Subject:
Re: [PATCH 2/3] modernise package variable style
Message ID:
AANLkTimJYGJZs+DXTm5khrYhcv4K=ZXFXotDQaaw1P8x@mail.gmail.com
On Sun, Jan 30, 2011 at 5:02 PM, Aristotle Pagaltzis <pagaltzis@gmx.de>wrote:

> +our @ISA = qw(Tie::StdHash);
>
> -use vars qw($SIGACTION_FLAGS $_SIGRTMIN $_SIGRTMAX $_sigrtn @ISA);
> -@POSIX::SigRt::ISA = qw(Tie::StdHash);
> +our ($_SIGRTMIN, $_SIGRTMAX, $_sigrtn);
>
> -$SIGACTION_FLAGS = 0;
> +our $SIGACTION_FLAGS = 0;
>

<<use vars>> should be used instead of <<our>> for vars that can be accessed
from outside the module to prevent "used only once" warnings. Switching
<<$SIGACTION_FLAGS>> to <<our>> is a mistake. It causes proper usage of that
variable to warn.

<<our>> is obviously ok for <<@ISA>>

<<our>> should be ok for <<$_SIGRTMIN>>, <<$_SIGRTMAX>> and <<$_sigrtn>>
since they're internal variables. (Could maybe even use <<my>>?)

- Eric

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About