All,

I have found a curious issue with Constant Arrays.

In my code I have this:-

use constant PARENT_MENUS=>(
        #'Admin::Entity',
      );

and a subroutine:-

sub parent_menus
{
  my $self=shift;
  my $class=ref($self)||$self;

  my @menu=();
  eval
  {
    @menu=$class->PARENT_MENUS;
  };
  if ($@)
  {
    my @tmp=();
    return [EMAIL PROTECTED];
  }
  else
  {
    return [EMAIL PROTECTED];
  }
}

my @parent_items = @{parent_menus};

What I want to know is when the Constant PARENT_MENUS is declared, but given
no values, e.g. like in the example above where the value is commented out.
The @parent_items returned from the subroutine contains ONE element of
($class) rather than NO elements.

If I comment out the constant definition completely, I get an EMPTY array as
expected.

Why is this happenning?

Marty





---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 20/08/2003

_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to