Skip Menu |

This queue is for tickets about the Debuggit CPAN distribution.

Report information
The Basics
Id: 84846
Status: open
Priority: 0/
Queue: Debuggit

People
Owner: Nobody in particular
Requestors: piemas25 [...] gmail.com
Cc:
AdminCc:

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



Subject: Naive idea: dbg() as an alias for debuggit()
Date: Thu, 25 Apr 2013 10:28:27 +0100
To: bug-Debuggit [...] rt.cpan.org
From: Pierre M <piemas25 [...] gmail.com>
It would be nice to be able to type dbg() instead of debuggit() It's a very naive proposal :-) And it's easy to implement it oneself (which i will do). If you want I can type it, with the doc that goes with it, and submit a pull request.
Show quoted text
> It would be nice to be able to type > dbg() > instead of > debuggit() > > It's a very naive proposal :-) And it's easy to implement it oneself > (which i will do). > If you want I can type it, with the doc that goes with it, and submit > a pull request.
It's not an unreasonable request. But the reason I named it "debuggit" in the first place, as opposed to "debug" (which is what I really wanted to call it), was to make sure it didn't conflict with anything, since it's exported by default. The shorter the name, the more likely that is. Of course, if the user requests it, then it's okay to call it whatever you like. Perhaps something like: use Debuggit Alias => 'dbg'; This of course would be something that you could do in a policy module so that you wouldn't have to constantly type the extra parameters. How does that sound?
Subject: Re: [rt.cpan.org #84846] Naive idea: dbg() as an alias for debuggit()
Date: Thu, 25 Apr 2013 19:12:01 +0100
To: bug-Debuggit [...] rt.cpan.org
From: Pierre M <piemas25 [...] gmail.com>
Sounds good :-) It's really a small detail, It's just one line: use Debuggit; sub dbg { debuggit(@_) }; I'm a bit too obsessed with ergonomy (^c^) Something else: i'm doing this, do you think it's a good practice? use Debuggit DEBUG => %ENV{DEBUG} and then i have these two aliases: alias p ='export DEBUG=0 && perl' # to launch a script without debug alias p1='export DEBUG=1 && perl' # to launch with debug statements It feels a bit awkward but it's very handy. If i used perl to setup aliases (soon), i could have p1, p2, p3, p4, etc. If that's a good thing to do, that could be shared in the documentation. It really makes things a lot nicer to me. But it might be wrong and i still haven't seen it; and there might be a better way. On 25 April 2013 18:45, Buddy Burden via RT <bug-Debuggit@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=84846 > >
>> It would be nice to be able to type >> dbg() >> instead of >> debuggit() >> >> It's a very naive proposal :-) And it's easy to implement it oneself >> (which i will do). >> If you want I can type it, with the doc that goes with it, and submit >> a pull request.
> > It's not an unreasonable request. But the reason I named it "debuggit" in the first place, as opposed to "debug" (which is what I really wanted to call it), was to make sure it didn't conflict with anything, since it's exported by default. The shorter the name, the more likely that is. > > Of course, if the user requests it, then it's okay to call it whatever you like. Perhaps something like: > > use Debuggit Alias => 'dbg'; > > This of course would be something that you could do in a policy module so that you wouldn't have to constantly type the extra parameters. > > How does that sound?
Show quoted text
> Sounds good :-)
Okay. Do you want to do a pull request, or do you want me to tackle it? Show quoted text
> It's really a small detail, It's just one line: > > use Debuggit; > sub dbg { debuggit(@_) };
Well, that would probably be better expressed as: sub dbg { goto &debuggit } but it's still an extra function call for no good reason, when we're just going to install the thing in the symbol table anyway. So we may as well install it with the name that the user wants. :-) Show quoted text
> Something else: i'm doing this, do you think it's a good practice? > > use Debuggit DEBUG => %ENV{DEBUG}
Presuming you mean $ENV{DEBUG} here. Unless you're using Perl 6. ;-> Having Debuggit pull from an environment variable is one of those things I've always thought was a good idea to add; I just never personally had the need, so I never have. I noted in my comparison matrix that several other modules have that feature. And it would be fairly trivial to add. I would probably go with something like `DEBUGGIT_DEBUG` as the env var. I would definitely consider a pull request along these lines. Show quoted text
> and then i have these two aliases: > alias p ='export DEBUG=0 && perl' # to launch a script without > debug > alias p1='export DEBUG=1 && perl' # to launch with debug statements
If I remember my bash correctly, you should be able to do just alias p1='DEBUG=1 perl' and that should set the var just for the one command. Then you wouldn't have to worry about resetting it with another alias. If you want to do a pull request, please do add some failing tests first. That always makes the process go faster. I'm glad you're finding Debuggit useful! Keep the ideas coming. :-)
From: mascip [...] gmail.com
Nice :-) The author of Attribute::Alias does it differently. His (3 lines) code is here: https://metacpan.org/source/DANKOGAI/Attribute-Util-1.07/lib/Attribute/Alias.pm He uses a glob or something. Arg! I have to read Larry's "big book" one of these days, to understand the details. Is goto &debuggit better, then? From what i've read, it gets out of the current subroutine and does "as if" it had been called by the target subroutine". Which makes sense. If you feel like doing it and have the time, go ahead. If you don't feel like it I'll do a pull request later. But i might not do it right now, if that's alright: I've got a deadline this week and one in 2 weeks.
Subject: Re: [rt.cpan.org #84846] Naive idea: dbg() as an alias for debuggit()
Date: Thu, 23 May 2013 11:33:26 +0100
To: bug-Debuggit [...] rt.cpan.org
From: Pierre M <piemas25 [...] gmail.com>
Pull request :-) On 29 Apr 2013 00:27, "mascip via RT" <bug-Debuggit@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=84846 > > > Nice :-) > > The author of Attribute::Alias does it differently. His (3 lines) code is > here: > https://metacpan.org/source/DANKOGAI/Attribute-Util-1.07/lib/Attribute/Alias.pm > He uses a glob or something. Arg! I have to read Larry's "big book" > one of these days, to understand the details. > > Is goto &debuggit better, then? > From what i've read, it gets out of the current subroutine and does > "as if" it had been called by the target subroutine". Which makes > sense. > > If you feel like doing it and have the time, go ahead. > If you don't feel like it I'll do a pull request later. But i might not do > it right now, if that's alright: I've got a deadline this week and one in 2 > weeks. >