You can make your test even simpler if you read the source for FindWindowLike. You'll seeing that the first call is to GetRootWindow and a little testing will show that it is in fact crashing when it trys to execute that bit.

So a simpler mod.pm is:

use X11::GUITest; X11::GUITest::GetRootWindow;
The source for GetRootWindow is in GUITest.xs and is pretty short and sweet:
Window GetRootWindow() CODE: RETVAL = RootWindow(TheXDisplay, TheScreen); OUTPUT: RETVAL

But... Where are TheXDisplay or TheScreen defined? This is C, after all, and things don't just auto-vivify. In fact, both are set up in SetupXDisplay.

SetupXDisplay is called from the INIT block at the end of GUITest.pm. If the INIT block hasn't been called yet (INIT blocks aren't called until just before the main program is executed -- which would be after the statements in mod.pm are executed), then TheXDisplay is NULL when it is used in the above code and we get a segfault.

The fix, then is to make sure that SetupXDisplay is called before TheXDisplay is used.

To answer your question: this is a bug in X11::GUITest.


In reply to Re^3: Bug in perl, or X11::GUITest by hexmode
in thread Bug in perl, or X11::GUITest by EvanCarroll

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.