Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jk2addict (4946)

jk2addict
  (email not shown publicly)
http://today.icantfocus.com/blog/
AOL IM: chrislaco (Add Buddy, Send Message)
Yahoo! ID: chrislaco@sbcglobal.net (Add User, Send Message)
Jabber: laco@scribblewerks.com

Journal of jk2addict (4946)

Tuesday August 29, 2006
08:59 PM

Don't try this at home kids...

[ #30798 ]
I'm a trained shaved monkey. Take a look at FormValidator::Simple::ProfileManager::YAML. It allows one to load FVS profiles from YAML. That's a nice compliment to FormValidator::Simples ability to load error messages form a yaml file. But apparently, some things can't be easy. Using the [REGEX, qr//] validator is one of those things. With a little tinkering, the answer appears; assuming the various perl YAML parsers can grok it...YAML can at least.

cart/save:
  - name
  - [ [NOT_BLANK], [LENGTH, 1, 50] ]
cart/delete:
  - id
  -
    -
      - REGEX
      - !perl/regexp:
        REGEXP: '^[a-f0-9]{8}-([a-f0-9]{4}-){3}[a-f0-9]{12}$'
        MODIFIERS: i

That's one for the record books.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • It sounds like you might want to get a different serialization for that regexp object than what your YAML library gave you. If you feed that into some non-perl YAML library doesn't that mean they're either obligated to create a perl object, bail, or die or something?

    Either that or maybe go through your data and demote your regexps to strings before letting YAML see it.
  • I'm working within the constraints of what FV::S::ProfileManager::YAML does; mainly load profiles from yaml and feed them directly into FV::S.

    As for non-Perl YAML parsers, who cares. I'm working within the confines of perl modules (FV::S), in a perl application (Catalyst). IF it were a more general type of config, then I agree.