Audio-Daemon

 view release on metacpan or  search on metacpan

Daemon.pm  view on Meta::CPAN

  my $overall = '';
  foreach my $pos (0..$#sects) {
    my $current = '';
    vec($current, 0, 8) = 0;
    for (my $c = 1; $c < 255; $c*=2) {
      my $one = '';
      vec($one, 0, 8) = $c;
      if (! unpack("C", ($sects[$pos] & $one))) {
        $current = $current | $one;
      }
    }
    $overall .= $current;
  }
  return $overall;
}

sub convert_ip {
  my $self = shift;
  return join '', map {pack("C", $_)} (split /\./, shift);
}

sub convert_mask {
  my $self = shift;
  my $mask = shift;
  return $self->convert_ip($mask) if ($self->valid_ip($mask));
  my $overall;
  my $string = reverse sprintf("%032s", '1' x $mask);
  for (my $c=0; $c<32; $c+=8) {
    my $out = 0;
    my @wank = split '', substr($string, $c, 8);
    for (my $m=1; $m<255; $m*=2) {
      $out += $m if (pop @wank);
    }
    $overall .= pack("C", $out);
  }
  return $overall;
}
1;

__END__

=head1 NAME

Audio::Daemon - UDP Daemon for various Sound Players

=head1 SYNOPSIS

  This isn't called directly, but exists for inheritance reasons.

  For Servers :
  use Audio::Daemon::MPG123;
  use Audio::Daemon::Xmms;
  use Audio::Daemon::Shout;
  
  or for the single client interface:
  use Audio::Daemon::Client;

=head1 DESCRIPTION

Audio::Daemon is a udp service providing a single udp interface around various 
other modules, like Xmms, Audio::Play::MPG123 and libshout (for icecast streaming). 

=head1 AUTHOR

Jay Jacobs jayj@cpan.org

=head1 SEE ALSO

Audio::Daemon::MPG123
Audio::Daemon::Xmms
Audio::Daemon::Shout
Audio::Daemon::Client

=cut



( run in 1.649 second using v1.01-cache-2.11-cpan-140bd7fdf52 )