The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


wxPerl::Styles - shortcuts for wxFOO style constants


This package encapsulates stringwise access to wxPerl constants, primarily for use in specifying styles, but also for comparing constants.

  use Wx qw(
  ... wxALIGN_RIGHT ... ;


  use Wx ();
  use wxPerl::Styles 'wxVal';
  ... wxVal('align_right') ... ;

Names will be uppercased automatically.

When using wxPerl::Constructors, style is always a named parameter, so this gives you the 'style => ...' bit:

  use Wx ();
  use wxPerl::Constructors;
  use wxPerl::Styles 'style';

  my $text_ctrl = wxPerl::TextCtrl->new($self, 'some text here',
    style('hscroll', te => 'process_enter|multiline')


This does delay typo errors until run-time, but widget-construction is pretty close to compile time, and the error messages are likely to be more informative than 'syntax error'. Also, I think that's a small price to pay for not having all of those extra methods kicking around in your class.


  my $style = wxVal('align_right',


Same as wxVal(), but returns (style => $style) for use with wxPerl::Constructors named parameter lists.

  my %param = style(@list);


Hash-parameter shortcut for 'id => Wx::wxID_OK()' and etc.

  my %param = ID('ok');


  my $const = _mk_constant($prefix, $string);


Expects a fully qualified subname such as 'Wx::wxALIGN_RIGHT'.

  my $const = _get_constant($name);


Eric Wilhelm @ <ewilhelm at cpan dot org>


If you found this module on CPAN, please report any bugs or feature requests through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

If you pulled this development version from my /svn/, please contact me directly.


Copyright (C) 2007 Eric L. Wilhelm, All Rights Reserved.


Absolutely, positively NO WARRANTY, neither express or implied, is offered with this software. You use this software at your own risk. In case of loss, no person or entity owes you anything whatsoever. You have been warned.


This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.