[sf-perl] Meaning of an asterisk (*)

nheller at silcon.com nheller at silcon.com
Tue Feb 26 11:59:16 PST 2008


I got a few questions about the following snippet of code.
The questions follow the code.
I appreciate any answers I can get.

#! /usr/bin/perl

use strict;
use warnings;

can_ok('SongPlayer', 'new');
.
.
.
can_ok( $song, 'player');

{
    package SongPlayer;
    use subs 'system';
    package main;
    my $fail = 0;
    my @args;

    *SongPlayer::system = sub;
    {
        @args = @_;
        return $fail;
    };

My questions:

1.  What is the meaning of the line "use subs 'system';"?

2.  Why were two package statements used in the space of 3 lines?

3.  What is the meaning of the asterisk in this code?

4.  For that matter, what is the meaning of this entire line, and why are
the lines below it set into a block by braces?



More information about the SanFrancisco-pm mailing list