Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re^8: Introspecting function signatures

by LanX (Saint)
on Mar 06, 2021 at 22:14 UTC ( [id://11129219]=note: print w/replies, xml ) Need Help??

in reply to Re^7: Introspecting function signatures
in thread Introspecting function signatures

Not sure what Python is implementing with that pattern, but I know it doesn't have block-scope, OTOH nesting functions is easier there.

So many things which are just blocks in Perl become named functions there, even lamda is useless for that.

But no need to copy their limitations.

My suggestion would be to apply attributes or explicit use

sub :test something { my :TEMPDIR $tempdir = shift; # or my :FIXTURE $tempdir = shift; # or use fixture qw/$tempdir/; #... }

This offers plenty of possibilities at compile time and is more flexible than Python's approach.


and I'd certainly put test-subs into their own package, if they lived in the same file.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^9: Introspecting function signatures
by jcb (Parson) on Mar 08, 2021 at 01:58 UTC
    I'd certainly put test-subs into their own package, if they lived in the same file.

    That does not reduce the overhead problem I mentioned — the test-subs will still be compiled every time the module containing them is loaded. Only putting the tests into a separate file solves that problem.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11129219]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (6)
As of 2024-04-13 21:23 GMT
Find Nodes?
    Voting Booth?

    No recent polls found