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

pEFL - Perl bindings for the Enlightenment Foundation Libraries

SYNOPSIS

        use pEFL;
        use strict;
        use warnings;

        use pEFL::Elm;

        pEFL::Elm::init($#ARGV, \@ARGV);

        pEFL::Elm::policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

        my $win = pEFL::Elm::Win->util_standard_add("hello", "Hello");
        $win->smart_callback_add("delete,request",\&on_done, undef);

        my $box = pEFL::Elm::Box->add($win);
        $box->horizontal_set(1);
        $win->resize_object_add($box);
        $box->show();

        my $lab = pEFL::Elm::Label->add($win);
        $lab->text_set("Hello out there, World\n");
        $box->pack_end($lab);
        $lab->show();

        my $btn = pEFL::Elm::Button->add($win);
        $btn->text_set("OK");
        $box->pack_end($btn);
        $btn->show();
        $btn->smart_callback_add("clicked", \&on_done, undef);

        $win->show();

        pEFL::Elm::run();

        pEFL::Elm::shutdown();

        sub on_done {
                print "Exiting \n";
                pEFL::Elm::exit();
        }

DESCRIPTION

Perl bindings for the Enlightenment Foundation Libraries (EFL). The module gives a nice object-oriented interface. Apart from that the API is deliberatly kept close to the Elementary API. The perl method names generally remove the prefix at the beginning of the c functions. Therefore applying the C documentation should be no problem.

For the documentation in detail please study the single modules and the documentation at https://www.enlightenment.org/docs/start

SPECIFICS OF THE BINDING

Perl specific variants of methods (_pv, "perl value"-methods)

If a method returns an Eina_List there usually is a version with the suffix _pv (for perl value) that returns a perl array (for example in pEFL::Elm::List the method items_get_pv()). It is recommended to use these perl adjusted methods. If you find a method, where the adaption is missing, please open an issue.

Sometimes a method returns an EvasObject which can be any Elm Widget Type (e.g. $nav->item_pop(), $object->content_get, $object_item->content_get). In this case there will be a "perl value" version that tries to bless the return variant to the appropriate perl class, too (e.g. $naviframe->item_pop_pv(), $object->[part_]content_get_pv, $object_item->[part_]content_get_pv).

Output Parameters

pEFL sometimes uses output parameters. See for example void elm_calendar_min_max_year_get(Evas_Object *obj,int *min,int *max), where you have to pass in C a pointer to max and min. In perl this is translated to my ($min, $max) = $calendar-min_max_year_get();>. Sometimes the C function returns a status or similar as in Eina_Bool elm_entry_cursor_geometry_get(Evas_Object *obj,int *x,int *y,int *w,int *h)>. In Perl this status variable is given, too. So the function elm_entry_cursor_geometry_get for example is translated into my ($status,$x,$y,$w,$h) = $entry-cursor_geometry_get;>.

FUNCTIONS IN EFL

The pEFL modules gives you the following functions:

pEFL::ev_info2s($ev_info) - if event info is a string, this function converts the void pointer to a perl string
pEFL::ev_info2obj($ev_info, "pEFL::Evas::Event::MouseUp") - if event info is a c stuct, this function converts the void pointer to a perl scalar, that is blessed to the given class. The perl class gives the necessary methods to get the members of the struc. At the moment the following c structs are (among others) supported:
Elm_Entry_Anchor_Info (aka pEFL::Elm::EntryAnchorInfo)
Elm_Entry_Change_Info (aka pEFL::Elm::EntryChangeInfo)
Elm_Image_Progress (aka pEFL::Elm::ImageProgress)
Elm_Panel_Scroll_Info (aka pEFL::Elm::PanelScrollInfo)
Evas_Coord_Rectangle (aka pEFL::Evas::Coord::Rectangle)
Evas_Event_Mouse_Down (aka pEFL::Evas::Event::MouseDown)
Evas_Event_Mouse_Up (aka pEFL::Evas::Event::MouseUp)
Evas_Event_Mouse_In (aka pEFL::Evas::Event::MouseIn)
Evas_Event_Mouse_Out (aka pEFL::Evas::Event::MouseOut)
Evas_Event_Mouse_Move (aka pEFL::Evas::Event::MouseMove)
Evas_Event_Mouse_Wheel (aka pEFL::Evas::Event::MouseWheel)
Ecore_Event_Key (aka pEFL::Ecore::Event::Key)
Ecore_Event_MouseButton (aka pEFL::Ecore::Event::MouseButton)
Ecore_Event_MouseMove (aka pEFL::Ecore::Event::MouseMove)
Ecore_Event_MouseWheel (aka pEFL::Ecore::Event::MouseWheel)
Ecore_Event_Signal_Exit (aka pEFL::Ecore::Event::SignalExit)
Ecore_Event_Signal_Realtime (aka pEFL::Ecore::Event::SignalRealtime)
Ecore_Event_Signal_User (aka pEFL::Ecore::Event::SignalUser)

Some events pass an Elementary Widget or an Evas Object as event info. Of course you can use ev_info2obj to convert these pointers to a appropiate blessed perl scalar, too. See for instance examples/colorselector.pl, where the Elm Widget Itemq Elm_Colorselector_Palette_Item is passed as event_info. This must converted by pEFL::ev_info2obj($ev_info, "pEFL::Elm::ColorselectorPaletteItem");

The provision of perl classes for event_info c structs is work in progress. If you need a specific binding for a c struct that is not supported at the moment, please send an issue report.

STATE OF THE BINDING

The perl binding is in an early development state. So things may change in the future and some functionalities are missing at the moment. Nevertheless especially the Elementary binding is very usable and complete.

If you miss something or find issues, please report it to github (see below).

WHY pEFL

Originally the name of the distribution was Efl. Unfortunately there was a conflict with the existing distribution EFL which isn't maintained any more and can't be compiled with newer versions of efl. Therefore the name pEFL was chosen whereby the "p" stands for "perl".

EXPORT

None by default.

SEE ALSO

https://www.enlightenment.org/docs/start

https://github.com/MaxPerl/Perl-pEFL

AUTHOR

Maximilian Lika

COPYRIGHT AND LICENSE

Copyright (C) 2021 by Maximilian Lika

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.28.1 or, at your option, any later version of Perl 5 you may have available.