in reply to Re^4: BBCode Parser in configuration file
in thread BBCode Parser in configuration file
And the reason I didn't try'd it is because the object I want in the configuration file is only gonna work as an object and not as plain text.And that is where you are wrong.
Try this:
Output:use strict; use YAML; use YAML::Dumper; use YAML::Loader; use DateTime; my $dt = DateTime->new( year => 1964, month => 10, day => 16, hour => 16, minute => 12, second => 47, nanosecond => 500000000, time_zone => 'Asia/Taipei', ); my $dumper = YAML::Dumper->new; my $stream = $dumper->dump($dt); my $loader = YAML::Loader->new; my $new_dt = $loader->load($stream); print $new_dt->ymd;
Proving that you get a full fledged object back when you load the YAML stream.1964-10-16
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
|
|---|