NAME
App::Pimpd::Validate - Package exporting various functions for validating data
SYNOPSIS
use App::Pimpd;
use App::Pimpd::Validate;
if(to_terminal()) {
print "Yes, you can see me!\n";
}
$str = escape($str);
if(invalid_playlist_pos(42)) {
print STDERR "No song on playlist position 42!\n";
}
DESCRIPTION
App::Pimpd::Validate provides functions for verifying certain conditions that's crucial for other functions.
EXPORTS
- remote_host()
-
Returns true if the MPD server is located on a remote host.
The MPD server is assumed to be remote if the mpd_host configuration file variable is:
not defined or equals 'localhost' or equals '127.0.0.1'
- invalid_regex()
-
Parameters: $regex
Returns true if the provided regex is invalid.
- empty_playlist()
-
Returns true if the current playlist is empty.
- to_terminal()
-
Returns true if output is going to a TTY.
- invalid_playlist_pos()
-
Parameters: $integer
Returns true if supplied argument is an invalid playlist position.
- escape()
-
Parameters: $string Returns: $string
Takes the supplied string and escapes it from evil chars the shell might otherwise munch.
- get_valid_lists()
-
Parameters: @playlists Returns: @valid_playlists
Takes a list and traverses it, checking if every playlist exists.
If a playlist is found to be non-existant, tries to match the string against all known playlists. If a partial match is found, prompts for validation.
- isa_valid_playlist
SEE ALSO
App::Pimpd
AUTHOR
Magnus Woldrich
CPAN ID: WOLDRICH
m@japh.se
http://japh.se
COPYRIGHT
Copyright (C) 2010, 2011 Magnus Woldrich. All right reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.