NAME

Test::WWW::Mechanize::Driver::MagicValues - Define Magic Value classes

Magic Classes

FileContents

Stringification of a scalar reference in this class will slurp the file whose name was stored in the reference.

my $file = "Foo.txt";
print bless(\$file, "FileContents");  # prints contents of Foo.txt

ApplyTemplate

Stringification of a scalar reference in this class will pass the text of the reference through Template.pm. Some useful variables will be defined.

my $tmpl = "[% now.strftime('%Y-%m-%d') %]";
print bless(\$tmpl, "ApplyTemplate");  # prints current date
t

The value of $Test::WWW::Mechanize::Driver::CURRENT_GROUP

now

The current date as a DateTime object.

Stacked

Stringification of a scalar reference in this class will slurp the file whose name was stored in the reference.

my @stack = ( "Foo.txt", "FileContents", "ApplyTemplate" );
print bless(\@stack, "Stacked");  # fills in and prints template in Foo.txt

AUTHOR

Dean Serenevy
dean@serenevy.net
https://serenevy.net/

COPYRIGHT

This software is hereby placed into the public domain. If you use this code, a simple comment in your code giving credit and an email letting me know that you find it useful would be courteous but is not required.

The software is provided "as is" without warranty of any kind, either expressed or implied including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.

SEE ALSO

perl(1).