in reply to wxPerl: is AddMany implemented?

check and see with wxperl_usage / wxperl-usage / wxPerl::Usage / Class Method Browser , available methods, method invocation syntax, link to docs

Also, you didn't notice that "convenience method" on the wxwidgets website

http://docs.wxwidgets.org/trunk/search.php?query=AddMany

Perl doesn't really need such a convenience method

$sizer->Add( $_, 1, Wx::wxEXPAND() ) for $code, $text, $tree, $snickerdoodle;

But you could make one

sub Wx::Sizer::AddMany { my $sizer = shift; $sizer->Add($_) for @_; } sub Wx::Sizer::AddMany { my ( $self, @many ) = @_; $self->Add($_) for +@many; } sub Wx::Sizer::AddMany { my ( $self, $flags, @many ) = @_; if ( 'ARRAY' eq ref $flags ) { $self->Add( $_, @$flags ) for @many +; } else { $self->Add($_) for $flags, @many; } }
  • Comment on Re: wxPerl: is AddMany implemented? (check and see with wxperl_usage)
  • Download Code

Replies are listed 'Best First'.
Re^2: wxPerl: is AddMany implemented? (check and see with wxperl_usage)
by Anonymous Monk on Apr 19, 2013 at 09:00 UTC
    :) make it work with wxperl-usage :)
    sub Wx::Sizer::AddMany { my ( $self, $flags, @many ) = @_; $self and $flags or Carp::croak "Usage: Wx::Sizer::AddMany( THIS, +optionalArrayrefOfOptions, window, ... )"; if ( 'ARRAY' eq ref $flags ) { @many or Carp::croak "Usage: Wx::Sizer::AddMany( THIS, optiona +lArrayrefOfOptions, window, ... )"; $self->Add( $_, @$flags ) for @many; } else { $self->Add($_) for $flags, @many; } }
      Thanks, AM's, I'll try that.
      Helen