Skip to content

Commit

Permalink
Item14237: Intermediate commit.
Browse files Browse the repository at this point in the history
Just to preserve current progress.
  • Loading branch information
vrurg committed Feb 11, 2017
1 parent 8c0d138 commit 966ed62
Show file tree
Hide file tree
Showing 17 changed files with 1,860 additions and 386 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
core/lib/.specCache
core/test/unit/testlogs
core/testlogs
10 changes: 7 additions & 3 deletions UnitTestContrib/test/unit/ConfigTests.pm
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,12 @@ sub test_specRegister {
$cfg->spec(
source => __FILE__,
specs => [
-section => Extensions => -text => "Just extensions" => [
-section => TestExt => -text => "Test extension" => [
-section => Extensions => [
-text => "Just extensions",
-section => TestExt => [
-text => "Test extension",
-modprefix => 'Foswiki::Extension::TestExt',
-expert => 1,
'ANewKey.NewSubKey' => [
Valid => { -type => 'BOOL', },
Text => { -type => 'TEXT', },
Expand All @@ -113,7 +116,8 @@ sub test_specRegister {
StrKey => { -type => 'TEXT(32)', }
},
],
-section => SampleExt => -text => "Sample extension" => [
-section => SampleExt => [
-text => "Sample extension",
-modprefix => 'Foswiki::Extension::SampleExt',
'Extensions.SampleExt' => [
Option => {
Expand Down
26 changes: 12 additions & 14 deletions core/lib/Foswiki.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ use CGI (); # Always required to get html generation tags;
use Digest::MD5 (); # For passthru and validation
use Scalar::Util ();

use Try::Tiny;
use Assert;

use Exporter qw(import);

our @EXPORT_OK = qw(
%regex urlEncode urlDecode make_params load_package load_class
expandStandardEscapes findCaller findCallerByPrefix isTrue
fetchGlobal getNS
$TRUE $FALSE
);

# Item13331 - use CGI::ENCODE_ENTITIES introduced in CGI>=4.14 to restrict encoding
# in CGI's html rendering code to only these; note that CGI's default values
# still breaks some unicode byte strings
Expand Down Expand Up @@ -54,20 +66,6 @@ our $CC = "\0-->";
# corrupting data spaces.
our $inUnitTestMode = 0;

use Try::Tiny;

#use Moo;
#use namespace::clean;
#extends qw( Foswiki::Object );

use Assert;
use Exporter qw(import);
our @EXPORT_OK = qw(
%regex urlEncode urlDecode make_params load_package load_class
expandStandardEscapes findCaller findCallerByPrefix isTrue
fetchGlobal getNS
);

sub SINGLE_SINGLETONS { 0 }
sub SINGLE_SINGLETONS_TRACE { 0 }

Expand Down
12 changes: 6 additions & 6 deletions core/lib/Foswiki/Class.pm
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,14 @@ sub _fw_extends {
if ( $ENV{FOSWIKI_ASSERTS} ) {

# Moo doesn't provide a clean way to get all object's attributes. The only
# really clean way to distinguish between a key on object's hash and an
# really good way to distinguish between a key on object's hash and an
# attribute is to record what is passed to Moo's sub 'has'. Since Moo
# generates it for each class separately (as well as other 'keywords') and
# since Moo::Role does it on its own too then the only really clean way to
# catch everything is to tap into Moo's guts. And the best way to do so is
# to intercept calls to _install_tracked() as this sub is used to register
# every single Moo-generated code ref. Though this is a hacky way on its own
# but the rest approaches seem to be even more hacky and no doubt
# since Moo::Role does it on its own too then the only correct approach to
# intercept everything is to tap into Moo's guts. And the best way to do so
# is to intercept calls to _install_tracked() as this sub is used to
# register every single Moo-generated code ref. Though this is a hacky way
# on its own but the rest approaches seem to be even more hacky and no doubt
# unreliable.
foreach my $module (qw(Moo Moo::Role)) {
my $ns = Foswiki::getNS($module);
Expand Down
Loading

0 comments on commit 966ed62

Please sign in to comment.