develooper Front page | perl.perl6.users | Postings from September 2018

Re: .kv ?

Thread Previous | Thread Next
From:
ToddAndMargo
Date:
September 16, 2018 08:33
Subject:
Re: .kv ?
Message ID:
110a78e2-56a6-7f78-ddd2-718a4d35bbe1@zoho.com
On 09/15/2018 03:16 PM, Brad Gilbert wrote:
> Anyway I edited the Option Types post.

Hi Brad,

I like it!  That took some thinking.  You kicked it!

      To designate that it must have a defined value assigned to
      it (not be in the null state), use the :D "smiley" designation.

      It is also possible to designate that it must always be a
      null using the :U "smiley".

That `:U` thing comes in handy with NativeCall, where a totally
blank variable is required on the input.

-T


sub GetXDisplay () is export {
#`{
     reference: man XDisplayName
     char *XDisplayName(char *string);
     sub display-name(Str:D $name) is native('X11') is 
symbol("XDisplayName") { * }

     reference: 
https://tronche.com/gui/x/xlib/event-handling/protocol-errors/XDisplayName.html
         The XDisplayName() function returns the name of the display 
that XOpenDisplay()
         would attempt to use. If a NULL string is specified, 
XDisplayName() looks in the
         environment for the display and returns the display name that 
XOpenDisplay() would
         attempt to use. This makes it easier to report to the user 
precisely which display
         the program attempted to open when the initial connection 
attempt failed.
}

    my $Display;
    my $NullStr; # Do not initialize this guy!

    # char *XDisplayName(char *string);
    sub XDisplayName(Str:D $name) is native('X11') returns Str { * };

    $Display = XDisplayName( $NullStr );
    return $Display;
}

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About