Commit | Line | Data |
---|---|---|
e1b4b35c | 1 | package HTML::String::Overload; |
2 | ||
3 | use strictures 1; | |
f27b509e | 4 | use HTML::String::Value; |
e1b4b35c | 5 | use B::Hooks::EndOfScope; |
ed99cbb4 | 6 | use overload (); |
e1b4b35c | 7 | |
8 | sub import { | |
f27b509e | 9 | my ($class, @opts) = @_; |
10 | overload::constant q => sub { | |
11 | HTML::String::Value->new($_[1], @opts); | |
12 | }; | |
ed99cbb4 | 13 | on_scope_end { __PACKAGE__->unimport }; |
14 | } | |
15 | ||
16 | sub unimport { | |
e1b4b35c | 17 | overload::remove_constant('q'); |
e1b4b35c | 18 | } |
19 | ||
20 | 1; |