Perl-Critic / PPI

53 stars 44 forks source link

actual filename and filename attribute #182

Open van-de-bugger opened 8 years ago

van-de-bugger commented 8 years ago

PPI::Document constructor creates an object either from string or from file. However, even if object was created from a file, created object does not know name of the file it was created from. It makes error reporting difficult.

Code changed to let constructor save filename for latter use. BTW, filename constructor attribute introduced. It allows to specify filename even if an object is creating from a string. It may be useful if caller code reads file and creates PPI document from a string.

Test added. All the tests (including the new one) pass on my system.

See also: #180