On Wed, Nov 25, 2009 at 02:16:51PM -0500, Steve Bertrand wrote:

> Hi all,
> 
> I just upgraded from perl 5.8 to perl 5.10.1. Everything went well,
> except for a single module that I need.
> 
> The offending code is this:
> 
> ${$self->{__pb_template_list}}[...@{$self->{__PB__TEMPLATE_LIST}}}]->param(
> $param, $value );
> 
> As I understand it, $# has been deprecated in 5.10. Can someone please
> help me understand the above line of code? What does $# represent in
> this context?

The variable $# is deprecated, but this isn't the usage of $# here.
Here it is being used to get the number of elements in an array.

But the original code is buggy, and whilst 5.8 let that slip, 5.10
won't.

The original code the author was trying to write should have been

  ${$self->{__PB_TEMPLATE_LIST}}[$#{$self->{__PB__TEMPLATE_LIST}}]->param( 
$param, $value );

Notice the lack of @{}.

But this is still far more complicated than it needs to be.  It should
ideally look something like

  $self->{__PB_TEMPLATE_LIST}->[-1]->param( $param, $value );

> I've tried changing the code in numerous ways to no avail. I'd like to
> get this fixed, so a) I can use it and b) I can create a patch for the
> developer.

Please do.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to