This is one of those examples of things that bothers people, myself included. Three
shifts, and no use of @_ to justify it, really. Instead, you could just declare them in a single
my and be done with it, like:
my ($obj, $usr_log_file, $params) = @_;
Extra params passed by the user are discarded, as one would expect.
The reason being
shifty is annoying is because it can degenerate into nonsensical situations like this:
sub foo
{
my $self = shift;
my $foo = shift;
$self->something($foo, "bar", shift, "shift", "foo");
my ($flob,$blarg,$kvetch) = (shift,shift);
if ($kvetch = $flob->fnordicate($blarg))
{
shift()->refnordicate($kvetch);
}
}
What, exactly, are the parameters to this function? You have to read and understand the entire function before it becomes clear. If this were much larger, that could be very frustrating. Unfortunately, this fictional example is not too far fetched.