develooper Front page | perl.perl5.porters | Postings from January 2022

Re: Things you can't do in a signatured sub

Thread Previous | Thread Next
From:
Yuki Kimoto
Date:
January 20, 2022 07:14
Subject:
Re: Things you can't do in a signatured sub
Message ID:
CAExogxOKO7yi7_XC38xqLfy6n1BN1NXHLPK10EiGuXnJNTpMFA@mail.gmail.com
2022-1-20 14:20 Darren Duncan <darren@darrenduncan.net> wrote:

>
> So here's a question.  The way signatures work now, if one puts "@" at the
> end
> of the signature,
>

Would you recommend the following code to Perl users if they want the old
codes to be a signature without changing its behavior?

  # Old code
  sub f1 {
    my ($a1, $a2) = @_;
  }

  sub f2 {
    my ($a1, $a2) = @_;
  }

  # ...

  sub f1000 ($a1, $a2) {
    my ($a1, $a2) = @_;
  }

  # New codes
  use feature 'signatures';

  sub f1 ($a1, $a2, @) {

  }

  sub f2 ($a1, $a2, @) {

  }

  # ...

  sub f1000 ($a1, $a2, @) {

  }

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About