What to do when WxPerl class doesn't have some method?
Asked Answered
L

1

6

I'm programming an application that uses WxPerl, but the Wx::Grid class is missing the method UseNativeColHeader. What can I do to call this method anyway?

What about event? The event EVT_GRID_COL_SORT is not implemented either in WxPerl. Is there a way to bypass the restriction in pure Perl?

Lobby answered 22/12, 2014 at 13:32 Comment(0)
C
1

If you know the expected arguments for the missing method, you can rig you own method with that name and inject it into the BEGIN block, then it will be available to the module in question.

In order for this to work you will need to make sure you load that module first (in the BEGIN block) and then define the (empty, unless you know what's supposed to be there) subroutine, making sure it returns the proper value so that Wx::Grid does not error out on you.

If possible, you could just find the source somewhere and drop it into the BEGIN block instead, unless you are just looking to get by without it. However, if you are after the actual "identical" behavior you may be looking at re-inventing the wheel a bit.

I might be able to elaborate a bit more if I had more information on what you really need to have (do you need to call those methods and generate those events, are you able to update modules where you are, etc).

Catechol answered 5/2, 2015 at 0:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.