Skip Menu |

This queue is for tickets about the Sub-Call-Tail CPAN distribution.

Report information
The Basics
Id: 68816
Status: stalled
Priority: 0/
Queue: Sub-Call-Tail

People
Owner: ether [...] cpan.org
Requestors: hakim.cassimally [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



CC: nothingmuch [...] woobling.org
Subject: Patch for Sub::Call::Tail to move to Sub::Exporter
Date: Tue, 14 Jun 2011 15:22:02 +0100
To: bugs-Sub-Call-Tail [...] rt.cpan.org
From: Hakim Cassimally <hakim.cassimally [...] gmail.com>
From 68b7f89af39c399bfe06bcea8dceefcb1058b9e7 Mon Sep 17 00:00:00 2001 From: Hakim Cassimally <hakim@eschew.local> Date: Tue, 14 Jun 2011 15:09:22 +0100 Subject: Move to Sub::Exporter to allow import renaming (Will be useful for examples in https://github.com/osfameron/pure-fp-book ) --- Changes | 3 +++ Makefile.PL | 1 + lib/Sub/Call/Tail.pm | 11 +++++++---- t/05_as.t | 25 +++++++++++++++++++++++++ 4 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 t/05_as.t diff --git a/Changes b/Changes index 92ec599..a650e4b 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,6 @@ +NEXT + - allow renaming of import with Sub::Exporter (osfameron) + 0.04 - Correct fallback definition of AvREIFY_only (Andrew Rodland) diff --git a/Makefile.PL b/Makefile.PL index 0e6ae7f..8af7b87 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -12,6 +12,7 @@ all_from 'lib/Sub/Call/Tail.pm'; requires_external_cc; requires 'parent'; +build_requires 'Sub::Exporter'; configure_requires 'ExtUtils::Depends' => 0.302; #minimum version that works on Win32+gcc foreach my $mod qw(B::Hooks::OP::Check::EntersubForCV) { diff --git a/lib/Sub/Call/Tail.pm b/lib/Sub/Call/Tail.pm index 3239ee4..9b5d394 100644 --- a/lib/Sub/Call/Tail.pm +++ b/lib/Sub/Call/Tail.pm @@ -4,15 +4,13 @@ use strict; use warnings; require 5.008001; -use parent qw(Exporter DynaLoader); +use parent qw(DynaLoader); use B::Hooks::OP::Check::EntersubForCV; +use Sub::Exporter -setup => { exports => [qw( tail )] }; our $VERSION = '0.04'; $VERSION = eval $VERSION; -our @EXPORT = our @EXPORT_OK = qw(tail); -our %EXPORT_TAGS = ( all => \@EXPORT_OK ); - __PACKAGE__->bootstrap($VERSION); pop our @ISA; @@ -39,6 +37,11 @@ Sub::Call::Tail - Tail calls for subroutines and methods # instead of @_ = @blah; goto &foo tail foo(@blah); + # We use Sub::Exporter, so you can use a different keyword if it clashes + use Sub::Call::Tail 'tail' => { -as => 'tail_call' }; + + tail_call foo(@blah); + =head1 DESCRIPTION This module provides a C<tail> modifier for subroutine and method calls that diff --git a/t/05_as.t b/t/05_as.t new file mode 100644 index 0000000..7a82b40 --- /dev/null +++ b/t/05_as.t @@ -0,0 +1,25 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More; + +use Sub::Call::Tail tail => { -as => 'tail_call' }; + +sub bar { "baz" }; + +sub foo { + tail_call bar(); +} + +sub tests { + is foo(), 'baz', 'tail_call worked ok'; +} + +tests(); + +done_testing; + +# ex: set sw=4 et: + -- 1.6.6.1
Subject: Re: [rt.cpan.org #68816] Patch for Sub::Call::Tail to move to Sub::Exporter
Date: Tue, 14 Jun 2011 17:36:12 +0300
To: bug-Sub-Call-Tail [...] rt.cpan.org
From: Yuval Kogman <nothingmuch [...] woobling.org>
Want comaint? Also, cf github On Jun 14, 2011 5:22 PM, "Hakim via RT" <bug-Sub-Call-Tail@rt.cpan.org> wrote: Show quoted text
> Tue Jun 14 10:22:12 2011: Request 68816 was acted upon. > Transaction: Ticket created by Hakim > Queue: Sub-Call-Tail > Subject: Patch for Sub::Call::Tail to move to Sub::Exporter > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: hakim.cassimally@gmail.com > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=68816 > > > > From 68b7f89af39c399bfe06bcea8dceefcb1058b9e7 Mon Sep 17 00:00:00 2001 > From: Hakim Cassimally <hakim@eschew.local> > Date: Tue, 14 Jun 2011 15:09:22 +0100 > Subject: Move to Sub::Exporter to allow import renaming > > (Will be useful for examples in https://github.com/osfameron/pure-fp-book) > --- > Changes | 3 +++ > Makefile.PL | 1 + > lib/Sub/Call/Tail.pm | 11 +++++++---- > t/05_as.t | 25 +++++++++++++++++++++++++ > 4 files changed, 36 insertions(+), 4 deletions(-) > create mode 100644 t/05_as.t > > diff --git a/Changes b/Changes > index 92ec599..a650e4b 100644 > --- a/Changes > +++ b/Changes > @@ -1,3 +1,6 @@ > +NEXT > + - allow renaming of import with Sub::Exporter (osfameron) > + > 0.04 > - Correct fallback definition of AvREIFY_only (Andrew Rodland) > > diff --git a/Makefile.PL b/Makefile.PL > index 0e6ae7f..8af7b87 100644 > --- a/Makefile.PL > +++ b/Makefile.PL > @@ -12,6 +12,7 @@ all_from 'lib/Sub/Call/Tail.pm'; > requires_external_cc; > > requires 'parent'; > +build_requires 'Sub::Exporter'; > configure_requires 'ExtUtils::Depends' => 0.302; #minimum version > that works on Win32+gcc > > foreach my $mod qw(B::Hooks::OP::Check::EntersubForCV) { > diff --git a/lib/Sub/Call/Tail.pm b/lib/Sub/Call/Tail.pm > index 3239ee4..9b5d394 100644 > --- a/lib/Sub/Call/Tail.pm > +++ b/lib/Sub/Call/Tail.pm > @@ -4,15 +4,13 @@ use strict; > use warnings; > > require 5.008001; > -use parent qw(Exporter DynaLoader); > +use parent qw(DynaLoader); > use B::Hooks::OP::Check::EntersubForCV; > +use Sub::Exporter -setup => { exports => [qw( tail )] }; > > our $VERSION = '0.04'; > $VERSION = eval $VERSION; > > -our @EXPORT = our @EXPORT_OK = qw(tail); > -our %EXPORT_TAGS = ( all => \@EXPORT_OK ); > - > __PACKAGE__->bootstrap($VERSION); > > pop our @ISA; > @@ -39,6 +37,11 @@ Sub::Call::Tail - Tail calls for subroutines and
methods Show quoted text
> # instead of @_ = @blah; goto &foo > tail foo(@blah); > > + # We use Sub::Exporter, so you can use a different keyword if it clashes > + use Sub::Call::Tail 'tail' => { -as => 'tail_call' }; > + > + tail_call foo(@blah); > + > =head1 DESCRIPTION > > This module provides a C<tail> modifier for subroutine and method calls
that Show quoted text
> diff --git a/t/05_as.t b/t/05_as.t > new file mode 100644 > index 0000000..7a82b40 > --- /dev/null > +++ b/t/05_as.t > @@ -0,0 +1,25 @@ > +#!/usr/bin/perl > + > +use strict; > +use warnings; > + > +use Test::More; > + > +use Sub::Call::Tail tail => { -as => 'tail_call' }; > + > +sub bar { "baz" }; > + > +sub foo { > + tail_call bar(); > +} > + > +sub tests { > + is foo(), 'baz', 'tail_call worked ok'; > +} > + > +tests(); > + > +done_testing; > + > +# ex: set sw=4 et: > + > -- > 1.6.6.1 >
Subject: Re: [rt.cpan.org #68816] Patch for Sub::Call::Tail to move to Sub::Exporter
Date: Tue, 14 Jun 2011 15:41:26 +0100
To: bug-Sub-Call-Tail [...] rt.cpan.org
From: Hakim Cassimally <hakim.cassimally [...] gmail.com>
eeek, sure, for comaint. I cloned the repo before I realised it was on github... ;-) On 14 June 2011 15:36, nothingmuch@woobling.org via RT <bug-Sub-Call-Tail@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=68816 > > > Want comaint? Also, cf github > On Jun 14, 2011 5:22 PM, "Hakim via RT" <bug-Sub-Call-Tail@rt.cpan.org> > wrote:
>> Tue Jun 14 10:22:12 2011: Request 68816 was acted upon. >> Transaction: Ticket created by Hakim >> Queue: Sub-Call-Tail >> Subject: Patch for Sub::Call::Tail to move to Sub::Exporter >> Broken in: (no value) >> Severity: (no value) >> Owner: Nobody >> Requestors: hakim.cassimally@gmail.com >> Status: new >> Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=68816 > >> >> >> From 68b7f89af39c399bfe06bcea8dceefcb1058b9e7 Mon Sep 17 00:00:00 2001 >> From: Hakim Cassimally <hakim@eschew.local> >> Date: Tue, 14 Jun 2011 15:09:22 +0100 >> Subject: Move to Sub::Exporter to allow import renaming >> >> (Will be useful for examples in https://github.com/osfameron/pure-fp-book) >> --- >> Changes | 3 +++ >> Makefile.PL | 1 + >> lib/Sub/Call/Tail.pm | 11 +++++++---- >> t/05_as.t | 25 +++++++++++++++++++++++++ >> 4 files changed, 36 insertions(+), 4 deletions(-) >> create mode 100644 t/05_as.t >> >> diff --git a/Changes b/Changes >> index 92ec599..a650e4b 100644 >> --- a/Changes >> +++ b/Changes >> @@ -1,3 +1,6 @@ >> +NEXT >> + - allow renaming of import with Sub::Exporter (osfameron) >> + >> 0.04 >> - Correct fallback definition of AvREIFY_only (Andrew Rodland) >> >> diff --git a/Makefile.PL b/Makefile.PL >> index 0e6ae7f..8af7b87 100644 >> --- a/Makefile.PL >> +++ b/Makefile.PL >> @@ -12,6 +12,7 @@ all_from 'lib/Sub/Call/Tail.pm'; >> requires_external_cc; >> >> requires 'parent'; >> +build_requires 'Sub::Exporter'; >> configure_requires 'ExtUtils::Depends' => 0.302; #minimum version >> that works on Win32+gcc >> >> foreach my $mod qw(B::Hooks::OP::Check::EntersubForCV) { >> diff --git a/lib/Sub/Call/Tail.pm b/lib/Sub/Call/Tail.pm >> index 3239ee4..9b5d394 100644 >> --- a/lib/Sub/Call/Tail.pm >> +++ b/lib/Sub/Call/Tail.pm >> @@ -4,15 +4,13 @@ use strict; >> use warnings; >> >> require 5.008001; >> -use parent qw(Exporter DynaLoader); >> +use parent qw(DynaLoader); >> use B::Hooks::OP::Check::EntersubForCV; >> +use Sub::Exporter -setup => { exports => [qw( tail )] }; >> >> our $VERSION = '0.04'; >> $VERSION = eval $VERSION; >> >> -our @EXPORT = our @EXPORT_OK = qw(tail); >> -our %EXPORT_TAGS = ( all => \@EXPORT_OK ); >> - >> __PACKAGE__->bootstrap($VERSION); >> >> pop our @ISA; >> @@ -39,6 +37,11 @@ Sub::Call::Tail - Tail calls for subroutines and
> methods
>> # instead of @_ = @blah; goto &foo >> tail foo(@blah); >> >> + # We use Sub::Exporter, so you can use a different keyword if it clashes >> + use Sub::Call::Tail 'tail' => { -as => 'tail_call' }; >> + >> + tail_call foo(@blah); >> + >> =head1 DESCRIPTION >> >> This module provides a C<tail> modifier for subroutine and method calls
> that
>> diff --git a/t/05_as.t b/t/05_as.t >> new file mode 100644 >> index 0000000..7a82b40 >> --- /dev/null >> +++ b/t/05_as.t >> @@ -0,0 +1,25 @@ >> +#!/usr/bin/perl >> + >> +use strict; >> +use warnings; >> + >> +use Test::More; >> + >> +use Sub::Call::Tail tail => { -as => 'tail_call' }; >> + >> +sub bar { "baz" }; >> + >> +sub foo { >> + tail_call bar(); >> +} >> + >> +sub tests { >> + is foo(), 'baz', 'tail_call worked ok'; >> +} >> + >> +tests(); >> + >> +done_testing; >> + >> +# ex: set sw=4 et: >> + >> -- >> 1.6.6.1 >>
> >
On 2011-06-14 07:22:12, Hakim wrote: Show quoted text
> From 68b7f89af39c399bfe06bcea8dceefcb1058b9e7 Mon Sep 17 00:00:00 2001 > From: Hakim Cassimally <hakim@eschew.local> > Date: Tue, 14 Jun 2011 15:09:22 +0100 > Subject: Move to Sub::Exporter to allow import renaming > > (Will be useful for examples in https://github.com/osfameron/pure-fp- > book )
I'm not sure this is a good idea to do this here. I think Import::Into supports sub renaming; would that be sufficient?