- LICENSE AND COPYRIGHT
- SEE ALSO
Dancer2::Plugin::Tail - Tail a file from Dancer2
use Dancer2; use Dancer2::Plugin::Tail;
This plugin will allow you to tail a file from within Dancer2. It's designed to be unobtrusive. So, it is functional just by calling it from your scripts. Edit entries in the Dancer configuration to setup routes and activate files that may be tailed. Additionally, you may define or restrict definition of tailed files.
You may specify the route to files. The plugin will only read files so Dancer2 must have read access to them. The following configuration will generate two routes: '/tail/display' and '/tail/read'.
A sample HTML page with Bootstrap and jQuery is included in the samples directory. Use it as an example to build your own page.
plugins: Tail: update_interval: 3000 stop_on_empty_cnt: 5 tmpdir: '/tmp' display: method: 'get' url: '/tail/display' template: 'tail.tt' layout: 'nomenu.tt' data: method: 'get' url: '/tail/read' files: id1: heading: 'Server Access Log' file: '/var/logs/access_log' id2: heading: 'Server Error Log' file: '/var/logs/error_log'
Specify an update interval. Default is 3 seconds (3000). This value is passed to your web page or window. See example that's included.
Specify the number of empty responses before stopping. Default is 10. This value is passed to your web page or window. See example that's included.
location of user generted files to tail. Default is '/tmp'.
Defines display settings.
Route in Dancer2 to display template for tailing. Default = '/tail/display'
Template of tail screen. Default = 'tail.tt'
Layout of template. This is useful when opening a window to tail files.
Defines file tail settings.
Route in Dancer2 to tail files. Default = '/tail/read'
List of predefined files that can be tailed.
Define a unique ID for this file
This is a heading or title of the html page to be passed to the template. Use it as a short description to the file you're taiing.
Full path and file name to tail.
Note that you must have a session provider configured to dynamically tail files using this plugin. This plugin requires sessions in order to track information about user defined tailed files for the logged in user. Please see Dancer2::Core::Session for information on how to configure session management within your application.
This function displays the specified template with the data from the configuration file.
A function called to dynamically define a file to tail. This is useful for launching long running applications and having their out put tailed. In general, this will generate a 32 character string that you should use to direct the output of your process. Then, Dancer2::Plugin::Tail will tail the content of this file.
This private function does the actual job of tailing the file.
An internal functio that returns a 32 character string when called from define_file_to_tail.
Hagop "Jack" Bilemjian,
<jck000 at gmail.com>
You can find documentation for this module with the perldoc command.
You can also look for information at:
Report bugs on github
AnnoCPAN: Annotated CPAN documentation
Copyright 2016-2017 Hagop "Jack" Bilemjian.
This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:
Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license.
If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license.
This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder.
This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed.
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.