Skip Menu |

This queue is for tickets about the Log-Any-Adapter CPAN distribution.

Maintainer(s)' notes

DO NOT FILE TICKETS HERE

This distribution has been merged with Log-Any. Instead, file tickets on Github here → Log Any Issues.

Report information
The Basics
Id: 88666
Status: resolved
Priority: 0/
Queue: Log-Any-Adapter

People
Owner: Nobody in particular
Requestors: NGLENN [...] cpan.org
Cc:
AdminCc:

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



Subject: allow adapter class in same file
The script below dies when Log::Any::Adapter tries to load the internal adapter class: use strict; use warnings; package MyApp::Log::Adapter; use base qw(Log::Any::Adapter::Base); use Log::Any::Adapter::Util qw(make_method); foreach my $method ( Log::Any->logging_methods() ) { make_method($method, sub { print $_[1] }); } foreach my $method ( Log::Any->detection_methods() ) { make_method($method, sub { 1 }); } package main; use Log::Any::Adapter; Log::Any::Adapter->set('+MyApp::Log::Adapter'); #dies here It would be nice if it were possible to put adapters in the same file that they are used in (I need to do this for a standalone script).
Subject: Re: [rt.cpan.org #88666] allow adapter class in same file
Date: Sun, 15 Sep 2013 14:06:04 -0400
To: bug-Log-Any-Adapter [...] rt.cpan.org
From: David Golden <dagolden [...] cpan.org>
Could you help me understand why you need to do this? Your trivial example seems unnecessary given Log::Any::Adapter::Stdout. Were you just trying to avoid the Log::Any::Adapter dependency or does your real code do something more complex?
My real code is also very simple: use base qw(Log::Any::Adapter::Base); use Log::Any::Adapter::Util qw(make_method); use Wx; foreach my $method ( Log::Any->logging_methods() ) { make_method($method, sub { Wx::LogMessage($_[1], undef) }); } foreach my $method ( Log::Any->detection_methods() ) { make_method($method, sub { 1 }); } I just wrote it out for a standalone script that creates a Wx frontend to another module's functionality. The key problem was that I wanted it to be standalone. If the patch is too weird (https://github.com/jonswar/perl-log-any-adapter/pull/3) then I can get around this (it's a cpan-style distro, so I can put more stuff in the lib folder). However, I would really be out of luck if it were standalone and not in a cpan-style distro.
Subject: Re: [rt.cpan.org #88666] allow adapter class in same file
Date: Mon, 16 Sep 2013 07:01:42 -0400
To: bug-Log-Any-Adapter [...] rt.cpan.org
From: David Golden <dagolden [...] cpan.org>
I've taken over Log::Any (and ::Adapter) and I'm doing some deep rewriting and simplification of parts of it. Could you please re-submit the PR against https://github.com/dagolden/log-any so I don't lose track of it? I'm pretty sure I can accommodate it somehow and having a test file is wonderful. (I should probably re-release as-is just with updated repo information) Thank you. David
Actually you won't be able to submit a PR because the code base is quite different. I'll open an issue myself and reference your PR.
There was no difference for the changed parts, so it was snappy to redo it on the new repo. I sent a new pull request.
This should be fixed in the 1.00 series.
Thanks! On Fri Jan 09 13:06:36 2015, DAGOLDEN wrote: Show quoted text
> This should be fixed in the 1.00 series.