in reply to Re^3: BBCode Parser in configuration file
in thread BBCode Parser in configuration file

This node falls below the community's threshold of quality. You may see it by logging in.
  • Comment on Re^4: BBCode Parser in configuration file

Replies are listed 'Best First'.
Re^5: BBCode Parser in configuration file
by CountZero (Bishop) on Jul 05, 2009 at 18:04 UTC
    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:

    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;
    Output:
    1964-10-16
    Proving that you get a full fledged object back when you load the YAML stream.

    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