The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Treex::Block::Util::Eval - Special block for evaluating code given by parameters.

VERSION

version 2.20151210

SYNOPSIS

  # on the command line
  treex Util::Eval document='print $document->full_filename' -- *.treex
  treex Util::Eval language=en anode='print $anode->lemma."\n"' -- *.treex

  # The same two commands even shorter
  treex Util::Eval doc='print $.full_filename' -- *.treex
  treex -Len Util::Eval anode='say $.lemma' -- *.treex

  # other examples of parameters
  language=en,cs zone='say $.language, "\t", $.sentence'
  language=all ttree='say $.language, "\t", scalar $.get_children()'

DESCRIPTION

Evaluate an arbitrary Perl code for each document/bundle/zone/tree/node (according to which parameter is given). The corresponding object is accessible through a variable of the same name or $this.

More shortcuts: You can use doc= instead of document=. You can use "$." instead of "$this->" where $this is the current doc/bundle/zone/tree/node.

AUTHOR

Martin Popel <popel@ufal.mff.cuni.cz>

COPYRIGHT AND LICENSE

Copyright © 2011-2012 by Institute of Formal and Applied Linguistics, Charles University in Prague

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.