Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Checking number of values returned

by LanX (Saint)
on Feb 08, 2015 at 16:24 UTC ( [id://1115941]=note: print w/replies, xml ) Need Help??


in reply to Checking number of values returned

Perl is a dynamic language and this kind of static typing with compile time checking belongs to Java or Haskell.

Theoretically you could do runtime checking by replacing your function with a wrapper in the middle checking

  • the returned values from the original
  • parsing the code of the calling code line.

    The wrapper could be installed by an attribute.

    But I doubt the outcome justifies the effort, cause it'll come with notable performance loss for an unusual case.

    You should rather question your strategy if you're passing around too many positional parameters.

    Smells a bit like an XY problem...

    Cheers Rolf

    PS: Je suis Charlie!

  • Log In?
    Username:
    Password:

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

    How do I use this?Last hourOther CB clients
    Other Users?
    Others admiring the Monastery: (5)
    As of 2024-04-24 01:57 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found