Skip to content

Commit b47d7f5

Browse files
committed
OTHER: Update perl tutorials.
1 parent dd4430c commit b47d7f5

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

perl/tut5.pl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
# First we retrieve the config values stored in the server and print them out.
5050
# This is a normal dict.
5151

52-
my $result = $xmms->configval_list;
52+
my $result = $xmms->config_list_values;
5353
$result->wait;
5454
my $value = $result->value;
5555

@@ -64,10 +64,10 @@
6464
$result = $xmms->medialib_get_info( 1 );
6565
$result->wait;
6666

67-
my $source_hash = $result->value->source_hash;
67+
my $propdict = $result->value;
6868

69-
for my $source (keys %{ $source_hash }) {
70-
while (my ($key, $val) = each %{ $source_hash->{$source} }) {
71-
print "$source:$key = $val\n";
69+
while (my ($key, $values) = each %{ $propdict } ) {
70+
while (my ($source, $val) = each %{ $values }) {
71+
print "[$source] $key = $val\n";
7272
}
7373
}

perl/tut6.pl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
# program first before returning here.
1919

2020
sub my_current_id {
21-
my ($result, $xmms) = @_;
21+
my ($value, $xc) = @_;
2222

2323
# At this point the result instance is filled with the answer and we can
2424
# now extract it as normal. The second argument is our connection object
2525
# which was passed in as the userdata.
2626

27-
printf "Current id is %d\n", $result->value;
28-
$xmms->quit_loop;
27+
printf "Current id is %d\n", $value;
28+
$xc->quit_loop;
2929
}
3030

3131
# Let's ask for the current id in an async way instead of the sync way as we
@@ -35,7 +35,8 @@ sub my_current_id {
3535
# my $request = $xmms->playback_current_id;
3636
# $request->notifier_set( \&my_current_id, $xmms );
3737

38-
$xmms->request( playback_current_id => \&my_current_id, $xmms );
38+
#$xmms->request( playback_current_id => \&my_current_id );
39+
$xmms->request( playback_current_id => sub { my_current_id (@_, $xmms) } );
3940

4041
# As you see we do it pretty much the same way that we did in tut2, but instead
4142
# of being able to access the current id directly (as we would have if we where

0 commit comments

Comments
 (0)