What is “stringification” in Perl?

后端 未结 3 668
误落风尘
误落风尘 2021-02-01 04:18

In the documentation for the CPAN module DateTime I found the following:

Once you set the formatter, the overloaded stringification method will use th

3条回答
  •  无人共我
    2021-02-01 04:32

    Stringification methods are called when an object is used in a context where a string is expected. The method describes how to represent the object as a string. So for instance, if you say print object; then since print is expecting a string, it's actually passing the result of the stringify method to print.

提交回复
热议问题