App-Framework
view release on metacpan or search on metacpan
lib/App/Framework/GetStarted.pod view on Meta::CPAN
Specify the database name to use
-table=s Table name
Specify a different table
__#=============================================================================================================================
__DATA__ sql
-- --------------------------------------------------------
--
-- Table structure for table `$table`
--
DROP TABLE IF EXISTS `$table`;
CREATE TABLE IF NOT EXISTS `$table` (
`pid` varchar(128) NOT NULL,
`title` varchar(128) NOT NULL,
`date` date NOT NULL,
`start` time NOT NULL,
KEY `pid` (`pid`),
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
and script command arguments:
-table listings2
result in the data section 'sql' being expanded to:
-- --------------------------------------------------------
--
-- Table structure for table `listings2`
--
DROP TABLE IF EXISTS `listings2`;
CREATE TABLE IF NOT EXISTS `listings2` (
`pid` varchar(128) NOT NULL,
`title` varchar(128) NOT NULL,
`date` date NOT NULL,
`start` time NOT NULL,
KEY `pid` (`pid`),
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
For further details see L<App::Framework::Feature::Data>
=head3 Configurations
A configuration file may be used to provide all of the application's option settings, rather than supplying them at the command line. The default setup of the Config feature
is to attempt to read the configuration file named ${name}.conf (where ${name} is the script name). The framework, by default, will search for this file in three directories depending
on operating system. For example, a script 'test_script' will look for it's configuration file on Linux in:
$HOME/.test_script
/etc/test_script
/usr/local/bin/config
The configuration file contents, at simplest, are just variable=value pairs with optional descriptive comments. For example:
# Server port number
port = 32023
# stay alive tick interval
tick = 5
# log
logfile = /tmp/ate_snmp.log
For further details, and more advanced configurations, see L<App::Framework::Feature::Config>
=head3 Running external programs
You use the B<Run> feature to execute external programs. First, you should specify which programs you want to run in the script. This
step is not necessary, but it checks up front that all the programs you want to use are actually installed:
use App::Framework '+Run'
...
my $run = $app->run ;
# get the framework to abort if some programs are not installed
$run->on_error('fatal') ;
# check your programs
$run->required(
{
'lsvob' => 1,
'ffmpeg' => 1,
'transcode' => 1,
'vlc' => 1,
},
) ;
Once you know you can use the programs, you call them as (for example):
my $status = $app->run("ffmpeg", "-i move.avi movie.mpeg") ;
where the returned value is 0 for success; non-zero for program error code.
You can also get the program output by:
my $results_aref = $app->run->results ;
which returns an ARRAY ref of lines of text output.
For further details see L<App::Framework::Feature::Run>
=cut
( run in 2.129 seconds using v1.01-cache-2.11-cpan-df04353d9ac )