#################### main pod documentation begin ################### =head1 NAME Zymonic::Toolkit::Debugs - Implements methods needed for processing debugs via Toolkit. =head1 SYNOPSIS Implements methods needed for processing debugs via Toolkit. =head1 DESCRIPTION Implements methods needed for processing debugs via Toolkit. =head1 USAGE TODO =head1 BUGS NONE =head1 SUPPORT As in the license, Zymonic is provided without warranty or support unless purchased separately, however... If you email zymonic-support@zednax.com your issue will be noted and may receive a response. For security issues, please contact zymonic-security@zednax.com and someone will respond within 8 working hours. =head1 AUTHOR Alex Masidlover et al. CPAN ID: MODAUTHOR Zednax Limited alex.masidlover@zednax.com http://www.zednax.com =head1 COPYRIGHT This program is free software licensed under the... Zymonic Public License 1.0 The full text of the license can be found in the LICENSE file included with this module. Other licenses may be acceptable if including parts of Zymonic in larger projects, please contact Zednax for details. =head1 SEE ALSO Zymonic perl(1). =cut #################### main pod documentation end ################### package Zymonic::Toolkit::Debugs; use strict; BEGIN { use Exporter (); use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); $VERSION = '0.01'; @ISA = qw(Exporter); #Give a hoot don't pollute, do not export more than needed by default @EXPORT = qw(); @EXPORT_OK = qw(); %EXPORT_TAGS = (); } use base "Zymonic::Toolkit"; use Zymonic::Debugs; use Zymonic; use Exception::Class ( 'Zymonic::Exception::Toolkit::Debugs' => { isa => 'Zymonic::Exception::Toolkit', fields => [], description => 'Debugs Toolkit related exceptions' }, ); our $DEFINITION = { fields => [ { 'ZName' => { 'content' => 'incoming_debug_file' }, 'DisplayName' => { 'content' => 'Debug log file' }, 'ShortDescription' => { 'content' => 'The debug log file generated by zymonic.' }, 'ExtraCharacters' => { 'content' => '/.-_' }, 'RequiredField' => { 'content' => 'true' }, }, { 'ZName' => { 'content' => 'sqlite_filename' }, 'DisplayName' => { 'content' => 'SQLite file name' }, 'ShortDescription' => { 'content' => 'The SQLite file name that should be produced. If not set a random string will be used.' }, 'ExtraCharacters' => { 'content' => '/.-_' }, }, { 'ZName' => { 'content' => 'zymonicversion' }, 'DisplayName' => { 'content' => 'Zymonic Version' }, 'ShortDescription' => { 'content' => 'The Zymonic revision of the system that generated the debugs.' }, 'SQLFieldType' => { 'content' => 'integer' }, }, { 'ZName' => { 'content' => 'zcpsversion' }, 'DisplayName' => { 'content' => 'ZCPS Version' }, 'ShortDescription' => { 'content' => 'The ZCPS revision of the system that generated the debugs.' }, 'SQLFieldType' => { 'content' => 'integer' }, }, { 'ZName' => { 'content' => 'branch' }, 'DisplayName' => { 'content' => 'Code Branch' }, 'ShortDescription' => { 'content' => 'Code branch of the system that generated the debugs e.g. trunk, QA or Live' }, }, { 'ZName' => { 'content' => 'system' }, 'DisplayName' => { 'content' => 'System' }, 'ShortDescription' => { 'content' => 'The system used to generate the debug log.' }, }, { 'ZName' => { 'content' => 'host' }, 'DisplayName' => { 'content' => 'Host' }, 'ShortDescription' => { 'content' => 'The hostname of the machine used to generate the debug log.' }, }, { 'ZName' => { 'content' => 'debugs_dir' }, 'DisplayName' => { 'content' => 'Debug Directory' }, 'ShortDescription' => { 'content' => 'The debugs directory to place the file in, defaults to /tmp.' }, 'ExtraCharacters' => { 'content' => '/.-_' }, }, ], commands => { convert_to_sqlite => { ShortDescription => { content => 'Converts a debug log to an SQLite file usable by zymonicdebugs' }, fields => [ 'incoming_debug_file', 'sqlite_filename', 'branch', 'zymonicversion', 'zcpsversion', 'system', 'host', 'debugs_dir', ], } } }; #################### subroutine header begin #################### =head2 definition Usage : $definition = $mo->definition; Purpose : Returns the module definition hash. Returns : nothing Argument : nothing Throws : nothing Comment : See Also : =cut #################### subroutine header end #################### sub definition { my $self = shift; return $DEFINITION; } #################### subroutine header begin #################### =head2 convert_to_sqlite Usage : From Command Line Purpose : Converts a debug log file into an SQLite databsase. Returns : nothing Argument : nothing Throws : nothing Comment : See Also : =cut #################### subroutine header end #################### sub convert_to_sqlite { my $self = shift; my $zdo = Zymonic::Debugs->new( session => $Zymonic::session ); my $result = $zdo->convert_xml_to_sqlite( $self->get_param('incoming_debug_file'), $self->get_param('sqlite_filename') || '', { branch => $self->get_param('branch') || '', zymonicversion => $self->get_param('zymonicversion') || '', zcpsversion => $self->get_param('zcpsversion') || '', system => $self->get_param('system') || '', host => $self->get_param('host') || '', }, $self->get_param('debugs_dir') || '/tmp' ); $self->log( 'Added ' . $result->{count} . ' nodes to the SQLite file: ' . $result->{sqlite_file} ); } 1;