S
samwyse
This code is working, but I'd like to make it "better". In particular,
I'm dissatisfied with my method of deciding if the end-user has
ActiveState Perl installed. I'd also like to suppress the "BEGIN
failed--compilation aborted" message when the "die" executes. Any
suggestions? Thanks!
#!/usr/bin/perl
BEGIN {
eval "use DBI";
if ($@) {
my @cf_email;
eval "use Config";
@cf_email = Config::config_re("cf_email") unless $@;
if (join(' ', @cf_email) =~ /\bActiveState.com\b/) {
die <<__ActiveState__;
You need to install the Perl DBI and DBD::ODBC modules.
To do so, try using these commands while connected to the Internet:
ppm install DBI
ppm install DBD-ODBC
__ActiveState__
} else {
die <<__CPAN__;
You need to install the Perl DBI and DBD::ODBC modules.
To do so, try using this command while connected to the Internet:
cpan DBI DBD::ODBC
Note that the CPAN command frequently requires that a C compiler be
installed on your computer.
__CPAN__
}
}
}
__END__
I'm dissatisfied with my method of deciding if the end-user has
ActiveState Perl installed. I'd also like to suppress the "BEGIN
failed--compilation aborted" message when the "die" executes. Any
suggestions? Thanks!
#!/usr/bin/perl
BEGIN {
eval "use DBI";
if ($@) {
my @cf_email;
eval "use Config";
@cf_email = Config::config_re("cf_email") unless $@;
if (join(' ', @cf_email) =~ /\bActiveState.com\b/) {
die <<__ActiveState__;
You need to install the Perl DBI and DBD::ODBC modules.
To do so, try using these commands while connected to the Internet:
ppm install DBI
ppm install DBD-ODBC
__ActiveState__
} else {
die <<__CPAN__;
You need to install the Perl DBI and DBD::ODBC modules.
To do so, try using this command while connected to the Internet:
cpan DBI DBD::ODBC
Note that the CPAN command frequently requires that a C compiler be
installed on your computer.
__CPAN__
}
}
}
__END__