The Module:
Config::Yacp
The test:
eval{ $CY1->set_value("INI","lf2"); };
ok( $@ eq "Can't Change Internal Parameter" , "Catch attempted changin
+g of internal parameter");
The subroutine that is being tested:
sub set_value{
my ($self,$section,$para,$value)=@_;
croak"Can't Change Internal Parameter" if $section~=/^INI|CM$/i;
croak"Missing arguments" if scalar @_ < 4;
croak"Non-Existent section" if !exists $self->{$section};
croak"Non-Existent parameter" if !exists $self->{$section}->{$para};
$self->{$section}->{$para}->[0]=$value;
}
The problem:
When the above test runs, the error that is being returned inside $@ is "Missing arguments". However, the error that I am expecting is "Can't Change Internal Parameter" (the INI parameter stores the name of the configuration file). The behavior is correct, as you shouldn't be able to change the INI file, but I would like it to send back the correct error message.
TStanley
--------
The only thing necessary for the triumph of evil is for good men to do nothing -- Edmund Burke
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.