AmphetaDesk::Utilities - A potpourri of minor utilities for AmphetaDesk
# generic stuff. $modified = encode_to_dec($data); # encodes to decimal equivalents. $modified = strip_newlines_and_tabs($data); # what do you think? $modified = add_link_targets($data, $target); # add <a target="">'s. $modified = remove_utf_bom($data); # stops older expats from crashing. # logging routines. set_logfile($filepath); note("this is a note to our log"); note("this is a note to our log and OS GUI", 1); note("this is a note to our log, our OS GUI, and the browser", 1, 1); error("this is a note everywhere, that then dies"); # webpage communication set_response("add a message to the web page note buffer"); my @responses = get_response; # gets/deletes all messages in buffer.
This package contains all the minor utilities needed through out AmphetaDesk, like logging, newline and tab removal, decimal encoding, HTML removal, and so on. It's really a dumping ground of routines that didn't fit anywhere else.
$data, looking for HTML links and then adding targets to them, to focus the link into a new (or existing) window. The target name to add is defined by
$target. AmphetaDesk calls this routine automatically for every item in the user's subscribed feeds. It returns the modified
URI::Escape(we used to homebrew this, but felt more comfortable blaming another module instead of our own code).
get_responsereturns an array of the current batch of responses, created by the
get_responsewill remove the saved response(s) once retrieved. One possible way of handling responses is with
my $response = join("<br>", get_response()).
noteto write a note to the GUI window, AmphetaDesk.log, or the web page (see
get_reponse) - it'll always return with a 1. What happens to the GUI window is controlled by one of the various OS libraries, located under AmphetaDesk::OS. If you use
die. Example usage demonstrating the possible output locations:
note("this is a note to our log"); note("this is a note to our log and OS GUI", 1); note("this is a note to our log, our OS GUI, and the browser", 1, 1); error("this is a note everywhere, that then dies");
set_logfilehas been configured.
errorroutines will use this LOG filehandle when logging, and STDERR will be redirected there. If the current
$logfileexists, it will be deleted after 250k so we don't go squirrels with evil. This routine returns 1 if the log was opened successfully, and dies if it wasn't.
Morbus Iff, <email@example.com>
Copyright 2000-2004 Morbus Iff <firstname.lastname@example.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.