It has been possible for some time now to write YaST modules in Perl. But to call the UI code you had to use YCP. For the Hack Week I decided to finish Stano's earlier work on the subject and make the UI callable from Perl or any of the soon to be available languages. This is a first step on the way to completely liberate the YaST UI from YCP.
Want to try it out? It works alongside your stock YaST on openSUSE 10.2. Install the binary tarball to /home/martin (really there, the binaries have the path hardwired!)
wget http://www.suse.de/~mvidner/hackweek/yast-ui-from-perl.tar.bz2
sudo sh -c "mkdir /home/martin && bzcat yast-ui-from-perl.tar.bz2 | tar x -C /home/martin"
Here's an example perl script. Note the links to the UI reference.
Let's try with the stock YaST#! /usr/bin/perl -w
use YaST::YCP qw(:DATA);
YaST::YCP::Import "UI";
YaST::YCP::init_ui ($ARGV[0] || "qt");
my $c = Term("VBox",
Term("Label", "Now we can call YaST UI from other languages!"),
Term("PushButton", "&So What?")
);
UI->OpenDialog($c);
UI->UserInput();
UI->CloseDialog();
sh$ perl /home/martin/pfx/bin/helloui.pmNothing happens. If you are interested in the error messages, they are in ~/.y2log
Now let's use the new and improved environment and retry
sh$ /home/martin/pfx/bin/pfxsh
STARTING A NEW SHELL
sh$ perl /home/martin/pfx/bin/helloui.pm
sh$ perl /home/martin/pfx/bin/helloui.pm ncurses
Remember, this is just a preview. It is not packaged properly and has bugs. The source is at svn.opensuse.org.