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

NAME

SDL2::clipboard - UTF-8 Friendly Clipboard Functions

SYNOPSIS

    use SDL2 qw[:clipboard];

DESCRIPTION

Basic clipboard handling.

Functions

These functions expose the clipboard. SDL's video subsystem must be initialized to get or modify clipboard text.

SDL_SetClipboardText( ... )

Put UTF-8 text into the clipboard.

    SDL_SetClipboardText( 'Hello, world!' );

Expected parameters include:

text - the text to store in the clipboard

Returns 0 on success or a negative error code on failure; call SDL_GetError( ) for more information.

SDL_GetClipboardText( )

Get UTF-8 text from the clipboard, which must be freed with SDL_free( ).

    my $clipboard = SDL_GetClipboardText( );

This functions returns NULL if there was not enough memory left for a copy of the clipboard's content.

Returns the clipboard text on success or NULL on failure; call SDL_GetError( ) for more information. Caller must call SDL_free( ) on the returned pointer when done with it.

SDL_HasClipboardText( )

Query whether the clipboard exists and contains a non-empty text string.

    if ( SDL_HasClipboardText( ) ) {
        ...
    }

Returns SDL_TRUE if the clipboard has text, or SDL_FALSE if it does not.

LICENSE

Copyright (C) Sanko Robinson.

This library is free software; you can redistribute it and/or modify it under the terms found in the Artistic License 2. Other copyrights, terms, and conditions may apply to data transmitted through this module.

AUTHOR

Sanko Robinson <sanko@cpan.org>