CWB::CEQL::String - String-like objects with category information (as return values of DPP rules)
use CWB::CEQL::String; $op = new CWB::CEQL::String ">="; $op->type("Operator"); ## SAME AS: $op = new CWB::CEQL::String ">=", "Operator"; print "42 $op 0\n"; # prints "42 >= 0" if ($op->type eq "Operator") { ... } $string = new CWB::CEQL::String "my string", "String"; $string .= " is beautiful"; # changes string, but not its type $string->value("another string"); # $string = "..."; would replace with ordinary string print $string->value, "\n"; # access string value explicitly $string->attribute("charset", "ascii"); # declare and/or set user-defined attribute if ($string->attribute("charset") eq "utf8") { ... } $new_string = $string->copy; # $new_string = $string; would point to same object
** TODO **
Note: automatic conversion to number in numerical expression does usually not work -- use value() method explicitly in this case
Returns new CWB::CEQL::String object $obj holding string value $string. If $type is given, $obj is assigned to the specified type.
CWB::CEQL::String
Return string value of CWB::CEQL::String object $obj. Overloading ensures that this value is accessed automatically if $obj is used in a string context (such as interpolation).
Change string value of $obj. Note that a simple assignment $obj = $string would overwrite $obj with a plain string.
$obj = $string
Append $string to string value of $obj.
Define new user attribute $name with value $value, or change value of existing attribute.
Returns value of user attribute $name. It is an error to read an attribute that has not been defined before.
Returns a copy of the CWB::CEQL::String object $obj. Note that after a simple assignment $new_obj = $obj, the two variables would contain the same object (so changing one of them would also modify the other).
$new_obj = $obj
The copy method makes a flat copy of the internal hash of user attributes. Therefore, complex data structures used as attribute values will be shared between $new_obj and $obj.
The cmp method implements string comparison operators for CWB::CEQL::String objects. The second operand $obj2 must either be a plain string or another CWB::CEQL::String object. If the optional argument $reverse is TRUE, the comparison is reversed (so a string as first operand can be compared with a CWB::CEQL::String object).
Copyright (C) 1999-2010 Stefan Evert [http::/purl.org/stefan.evert]
This software is provided AS IS and the author makes no warranty as to its use and performance. You may use the software, redistribute and modify it under the same terms as Perl itself.
To install Alt::CWB::ambs, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Alt::CWB::ambs
CPAN shell
perl -MCPAN -e shell install Alt::CWB::ambs
For more information on module installation, please visit the detailed CPAN module installation guide.