I have a problem with using two conflicting CPAN modules which I don't know how to solve. Both of the modules in question make use of a select function and I'd really like to use them within the same subroutine.
Here's some code that demonstrates the problem
use Shell::POSIX::Select qw($Heading $Prompt);
use Config::Crontab;
$modcron = 1;
if (defined($modcron)) {
modifycron();
exit;
}
sub modifycron {
$Heading="\n Pick an Option\n\n";
$Prompt="Enter selection: ";
select ('Display','Activate') {
if ( $Reply == 1 ) {
$ct = new Config::Crontab; $ct->read; print $ct->dump;
} elsif ($Reply == 2) {
$ct = new Config::Crontab; $ct->read;
$block = $ct->block($ct->select(-command_re => "key=");
}
}
The test crontab looks like this
#
# Host specific jobs
####################
#
#00 8 * * * $MYBIN/my_prog.pl; # key=my_prog
#00 9 * * * $MYBIN/my_prog2.pl; # key=my_prog2
Running this gives me
syntax error at ./test.pl line 151, near ");"
Missing right curly or square bracket at ./test.pl line 186, at end of
+ line
syntax error at ./test.pl line 186, at EOF
Execution of ./test.pl aborted due to compilation errors.
I'm trying to build a (ksh style select) menu around the crontab module
Can I make use of these two modules in the same script ?
If so how ?
Any help appreciated
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.