Skip to content

Commit

Permalink
v1.38.4
Browse files Browse the repository at this point in the history
	! re-added MooseX::ShortCut::BuildInstance::UnhideDebug I still use it for debugging
		The source filter is still not run till $ENV{log_shiras_filter_on} is set

Signed-off-by: Jed Lund <jandrew@cpan.org>
  • Loading branch information
Jed Lund committed Apr 13, 2016
1 parent a04d04b commit e5a5298
Show file tree
Hide file tree
Showing 10 changed files with 186 additions and 15 deletions.
7 changes: 6 additions & 1 deletion Changes
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ Uses the change tracking convention
* Place holder

{{$NEXT}}

* Another cool change

v1.38.4 2016-04-12 22:41:13-07:00 America/Los_Angeles

! re-added MooseX::ShortCut::BuildInstance::UnhideDebug I still use it for debugging
The source filter is still not run till $ENV{log_shiras_filter_on} is set

v1.38.2 2016-04-12 17:14:35-07:00 America/Los_Angeles

! Cleaned up a left-in debug print statement
Expand Down
1 change: 1 addition & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dist.ini
examples/MooseX/ShortCut/build_instance_example.pl
lib/MooseX/ShortCut/BuildInstance.pm
lib/MooseX/ShortCut/BuildInstance/Types.pm
lib/MooseX/ShortCut/BuildInstance/UnhideDebug.pm
t/Identity.pm
t/Mineral.pm
t/MooseX/ShortCut/01-build_instance.t
Expand Down
10 changes: 7 additions & 3 deletions META.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,15 @@
"provides" : {
"MooseX::ShortCut::BuildInstance" : {
"file" : "lib/MooseX/ShortCut/BuildInstance.pm",
"version" : "v1.38.2"
"version" : "v1.38.4"
},
"MooseX::ShortCut::BuildInstance::Types" : {
"file" : "lib/MooseX/ShortCut/BuildInstance/Types.pm",
"version" : "v1.38.2"
"version" : "v1.38.4"
},
"MooseX::ShortCut::BuildInstance::UnhideDebug" : {
"file" : "lib/MooseX/ShortCut/BuildInstance/UnhideDebug.pm",
"version" : "v1.38.4"
}
},
"release_status" : "stable",
Expand All @@ -95,7 +99,7 @@
"web" : "https://github.com/jandrew/MooseX-ShortCut-BuildInstance"
}
},
"version" : "v1.38.2",
"version" : "v1.38.4",
"x_authority" : "cpan:JANDREW"
}

9 changes: 6 additions & 3 deletions META.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ no_index:
provides:
MooseX::ShortCut::BuildInstance:
file: lib/MooseX/ShortCut/BuildInstance.pm
version: v1.38.2
version: v1.38.4
MooseX::ShortCut::BuildInstance::Types:
file: lib/MooseX/ShortCut/BuildInstance/Types.pm
version: v1.38.2
version: v1.38.4
MooseX::ShortCut::BuildInstance::UnhideDebug:
file: lib/MooseX/ShortCut/BuildInstance/UnhideDebug.pm
version: v1.38.4
requires:
Carp: '0'
Clone: '0'
Expand All @@ -67,5 +70,5 @@ resources:
bugtracker: https://github.com/jandrew/MooseX-ShortCut-BuildInstance/issues
homepage: https://github.com/jandrew/MooseX-ShortCut-BuildInstance
repository: https://github.com/jandrew/MooseX-ShortCut-BuildInstance.git
version: v1.38.2
version: v1.38.4
x_authority: cpan:JANDREW
2 changes: 1 addition & 1 deletion Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ my %WriteMakefileArgs = (
"lib" => 0,
"version" => "0.77"
},
"VERSION" => "v1.38.2",
"VERSION" => "v1.38.4",
"test" => {
"TESTS" => "t/MooseX/ShortCut/*.t t/MooseX/ShortCut/BuildInstance/*.t"
}
Expand Down
6 changes: 4 additions & 2 deletions lib/MooseX/ShortCut/BuildInstance.pm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package MooseX::ShortCut::BuildInstance;
# ABSTRACT: A shortcut to build Moose instances

use version 0.77; our $VERSION = version->declare('v1.38.2');
use version 0.77; our $VERSION = version->declare('v1.38.4');
###LogSD warn "You uncovered internal logging statements for MooseX::ShortCut::BuildInstance-$VERSION";
use 5.010;
use Moose 2.1213;
Expand All @@ -24,7 +24,9 @@ use lib '../../../lib',;
use MooseX::ShortCut::BuildInstance::Types 1.036 qw(
BuildClassDict
);
###LogSD use Log::Shiras::Telephone;
###LogSD use Log::Shiras::Telephone;
###LogSD use Log::Shiras::UnhideDebug;
use MooseX::ShortCut::BuildInstance::UnhideDebug;

#########1 Package Variables 3#########4#########5#########6#########7#########8#########9

Expand Down
2 changes: 1 addition & 1 deletion lib/MooseX/ShortCut/BuildInstance/Types.pm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package MooseX::ShortCut::BuildInstance::Types;
use version; our $VERSION = version->declare('v1.38.2');
use version; our $VERSION = version->declare('v1.38.4');

use strict;
use warnings;
Expand Down
157 changes: 157 additions & 0 deletions lib/MooseX/ShortCut/BuildInstance/UnhideDebug.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
package MooseX::ShortCut::BuildInstance::UnhideDebug;
use version; our $VERSION = version->declare('v1.38.4');

use 5.010;
use strict;
use warnings;

#########1 Package Variables 3#########4#########5#########6#########7#########8#########9

my $debug_flag = 0;

#########1 import 2#########3#########4#########5#########6#########7#########8#########9

sub import {
my( $class, ) = @_;

if( defined $ENV{log_shiras_filter_on} ) {
print "Running MooseX::ShortCut::BuildInstance::UnhideDebug filter!\n" if $debug_flag;
my $FILTER_MODULE = "Filter::Util::Call";
if(! "require $FILTER_MODULE" ) {
die "$FILTER_MODULE required with :debug" .
"(install from CPAN)";
}

eval "require $FILTER_MODULE" or die "Cannot pull in $FILTER_MODULE";
Filter::Util::Call::filter_add(
sub{
my $status;
if( ($status = Filter::Util::Call::filter_read()) > 0 ){
print "-->$_" if $debug_flag;
s/^(\s*)###LogSD\s/$1 /mg;
print "<--$_\n" if $debug_flag;
}
return $status;
}
);
}
}

#########1 Phinish 3#########4#########5#########6#########7#########8#########9

1;

#########1 Documentation 3#########4#########5#########6#########7#########8#########9
__END__
=head1 NAME
MooseX::ShortCut::BuildInstance::UnhideDebug - Unhides debug lines for Log::Shiras
=head1 DESCRIPTION
This package definitly falls in the dark magic catagory of perl and it is a source filter
using L<Filter::Util::Call>. Activiation (exposure) of debug lines will only slow your
code down. Don't do it if you arn't willing to pay the price. The value of exposing
those lines is all the interesting information you receive from the debugging code. To
use this file you must install as a minimum L<Log::Shiras::Switchboard
|https://github.com/jandrew/Log-Shiras/blob/master/lib/Log/Shiras/Switchboard.pm> and
L<Log::Shiras::Telephone
|https://github.com/jandrew/Log-Shiras/blob/master/lib/Log/Shiras/Telephone.pm> from
github in one of your module L<lib>raries. I<Yes that code is definitly in alpha state
(at best).>
B<The good news for anyone that is not interested in using this class is that none of the
L<DEPENDENCIES|/DEPENDENCIES> are activated and none of the package debug lines are exposed
to slow the code down unless the ':debug' flag is sent to L<Log::Shiras::Switchboard
|https://github.com/jandrew/Log-Shiras/blob/master/lib/Log/Shiras/SwitchBoard.pm>.>
I<Read that as it won't happen if you don't install and use Log::Shiras and the package will
run just fine without installing it.>
This class is a source filter with the single purpose of uhiding '###LogSD' (B<S>hiras
B<D>ebug) debug lines written in this package and activated by L<Log::Shiras
|https://github.com/jandrew/Log-Shiras>. L<MooseX::ShortCut::BuildInstance> is used by
Log-Shiras internally and gets 'used' there so that the specific timing of any source
filter implementation for this package must fall after the L<Switchboard
|https://github.com/jandrew/Log-Shiras/blob/master/lib/Log/Shiras/SwitchBoard.pm>
':debug'ing is set on or off and before any other classes can be called like
L<Log::Shiras::UnhideDebug
|https://github.com/jandrew/Log-Shiras/blob/master/lib/Log/Shiras/UnhideDebug.pm>. The
implementation of the delay in calling MooseX::ShortCut::BuildInstance within Log::Shiras
till after a decision on debug implementation is accomplished with an L<eval EXPR
|http://perldoc.perl.org/functions/eval.html> line.
The source filter is then needed immediatly so it cannot be implemented with a generic
source filter like Log::Shiras::UnhideDebug. A class specific source filter is therefore
needed to resolve that. The source filter here triggers off the environmental variable
$ENV{log_shiras_filter_on} which is set when the ':debug' flag is passed to 'use
Log::Shiras::Switchboard @args' in the @args. Since this package provides only a functional
interface all the debug namespaces of the exposed functions are the names of the functions
themselves. The namespaces in this package do not inherit pre-fixes from the consuming class.
(Generally I write namespaces for object methods that do inherit pre-fixes from the parent
class.)
For this class to work any call for 'use MooseX::ShortCut::BuildInstance' must occur after
the call to 'use Log::Shiras::Switchboard qw( :debug );'. Otherwize the class will be
loaded without the debug lines exposed. After that you have to activate each method using
namespaces L<Log::Shiras::Switchboard/add_name_space_bounds( $ref )>
=head1 SUPPORT
=over
L<MooseX-ShortCut-BuildInstance/issues|https://github.com/jandrew/MooseX-ShortCut-BuildInstance/issues>
or
L<github Log-Shiras/issues|https://github.com/jandrew/Log-Shiras/issues>
=back
=head1 TODO
=over
B<1.> Remove raw links to Log-Shiras files in the github repo when Log-Shiras is published to CPAN
B<2.> Write a test suit for this class - pending release of Log-Shiras to CPAN
(also skip the test if Log::Shiras is not installed)
=back
=head1 AUTHOR
=over
=item Jed Lund
=item jandrew@cpan.org
=back
=head1 COPYRIGHT
This program is free software; you can redistribute
it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the
LICENSE file included with this module.
This software is copyrighted (c) 2012 and 2016 by Jed Lund
=head1 DEPENDENCIES
=over
L<version>
L<Filter::Util::Call>
L<Log::Shiras::Switchboard>
L<Log::Shiras::Telephone>
=back
=cut
#########1#########2 main pod documentation end 5#########6#########7#########8#########9
6 changes: 3 additions & 3 deletions t/01-load.t
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ BEGIN{ use_ok( Type::Library,
BuildClassDict
) ) };
use lib '../lib', 'lib',;
BEGIN{ use_ok( MooseX::ShortCut::BuildInstance::UnhideDebug, 1.034 ) };
BEGIN{ use_ok( MooseX::ShortCut::BuildInstance::Types, 1.034 ) };
BEGIN{ use_ok( MooseX::ShortCut::BuildInstance, 1.034 ) };
BEGIN{ use_ok( MooseX::ShortCut::BuildInstance::UnhideDebug, 1.038 ) };
BEGIN{ use_ok( MooseX::ShortCut::BuildInstance::Types, 1.038 ) };
BEGIN{ use_ok( MooseX::ShortCut::BuildInstance, 1.038 ) };
done_testing();
1 change: 0 additions & 1 deletion t/MooseX/ShortCut/01-build_instance.t
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use lib '../../../../Log-Shiras/lib',
###LogSD },
###LogSD );
###LogSD use Log::Shiras::Telephone;
###LogSD use Log::Shiras::UnhideDebug;
use MooseX::ShortCut::BuildInstance;
my(
$pet_rock_class, $paco, $pacos_evil_twin, $pacos_good_twin,
Expand Down

0 comments on commit e5a5298

Please sign in to comment.