Skip to content

Commit

Permalink
v8.23
Browse files Browse the repository at this point in the history
  • Loading branch information
mche committed Sep 9, 2019
1 parent 708952d commit 8aa67f2
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 59 deletions.
34 changes: 16 additions & 18 deletions Makefile.old
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This Makefile is for the Mojolicious::Che extension to perl.
#
# It was generated automatically by MakeMaker version
# 7.24 (Revision: 72400) from the contents of
# 7.36 (Revision: 73600) from the contents of
# Makefile.PL. Don't edit this file, edit Makefile.PL instead.
#
# ANY CHANGES MADE HERE WILL BE LOST!
Expand Down Expand Up @@ -62,11 +62,11 @@ DIRFILESEP = /
DFSEP = $(DIRFILESEP)
NAME = Mojolicious::Che
NAME_SYM = Mojolicious_Che
VERSION = 0.0812
VERSION = 0.0823
VERSION_MACRO = VERSION
VERSION_SYM = 0_0812
VERSION_SYM = 0_0823
DEFINE_VERSION = -D$(VERSION_MACRO)=\"$(VERSION)\"
XS_VERSION = 0.0812
XS_VERSION = 0.0823
XS_VERSION_MACRO = XS_VERSION
XS_DEFINE_VERSION = -D$(XS_VERSION_MACRO)=\"$(XS_VERSION)\"
INST_ARCHLIB = blib/arch
Expand Down Expand Up @@ -143,9 +143,9 @@ PERM_DIR = 755
PERM_RW = 644
PERM_RWX = 755

MAKEMAKER = /home/guest/perl5/perlbrew/perls/perl-5.26.1/lib/5.26.1/ExtUtils/MakeMaker.pm
MM_VERSION = 7.24
MM_REVISION = 72400
MAKEMAKER = /home/guest/perl5/perlbrew/perls/perl-5.26.1/lib/site_perl/5.26.1/ExtUtils/MakeMaker.pm
MM_VERSION = 7.36
MM_REVISION = 73600

# FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle).
# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle)
Expand Down Expand Up @@ -194,13 +194,12 @@ PERL_ARCHIVE_AFTER =


TO_INST_PM = Config.pm \
README.pod \
lib/Mojo/Base/Che.pm \
lib/Mojolicious/Che.pm


# --- MakeMaker platform_constants section:
MM_Unix_VERSION = 7.24
MM_Unix_VERSION = 7.36
PERL_MALLOC_DEF = -DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc -Dfree=Perl_mfree -Drealloc=Perl_realloc -Dcalloc=Perl_calloc


Expand Down Expand Up @@ -266,7 +265,7 @@ RCS_LABEL = rcs -Nv$(VERSION_SYM): -q
DIST_CP = best
DIST_DEFAULT = tardist
DISTNAME = Mojolicious-Che
DISTVNAME = Mojolicious-Che-0.0812
DISTVNAME = Mojolicious-Che-0.0823


# --- MakeMaker macro section:
Expand Down Expand Up @@ -504,7 +503,7 @@ metafile : create_distdir
$(NOECHO) $(ECHO) 'configure_requires:' >> META_new.yml
$(NOECHO) $(ECHO) ' ExtUtils::MakeMaker: '\''0'\''' >> META_new.yml
$(NOECHO) $(ECHO) 'dynamic_config: 1' >> META_new.yml
$(NOECHO) $(ECHO) 'generated_by: '\''ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150010'\''' >> META_new.yml
$(NOECHO) $(ECHO) 'generated_by: '\''ExtUtils::MakeMaker version 7.36, CPAN::Meta::Converter version 2.150010'\''' >> META_new.yml
$(NOECHO) $(ECHO) 'license: perl' >> META_new.yml
$(NOECHO) $(ECHO) 'meta-spec:' >> META_new.yml
$(NOECHO) $(ECHO) ' url: http://module-build.sourceforge.net/META-spec-v1.4.html' >> META_new.yml
Expand All @@ -520,7 +519,7 @@ metafile : create_distdir
$(NOECHO) $(ECHO) ' perl: '\''5.006'\''' >> META_new.yml
$(NOECHO) $(ECHO) 'resources:' >> META_new.yml
$(NOECHO) $(ECHO) ' repository: git://github.com/mche/Mojolicious-Che.git' >> META_new.yml
$(NOECHO) $(ECHO) 'version: '\''0.0812'\''' >> META_new.yml
$(NOECHO) $(ECHO) 'version: '\''0.0823'\''' >> META_new.yml
$(NOECHO) $(ECHO) 'x_serialization_backend: '\''CPAN::Meta::YAML version 0.018'\''' >> META_new.yml
-$(NOECHO) $(MV) META_new.yml $(DISTVNAME)/META.yml
$(NOECHO) $(ECHO) Generating META.json
Expand All @@ -530,13 +529,13 @@ metafile : create_distdir
$(NOECHO) $(ECHO) ' "Михаил Че <mche@cpan.org>"' >> META_new.json
$(NOECHO) $(ECHO) ' ],' >> META_new.json
$(NOECHO) $(ECHO) ' "dynamic_config" : 1,' >> META_new.json
$(NOECHO) $(ECHO) ' "generated_by" : "ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150010",' >> META_new.json
$(NOECHO) $(ECHO) ' "generated_by" : "ExtUtils::MakeMaker version 7.36, CPAN::Meta::Converter version 2.150010",' >> META_new.json
$(NOECHO) $(ECHO) ' "license" : [' >> META_new.json
$(NOECHO) $(ECHO) ' "perl_5"' >> META_new.json
$(NOECHO) $(ECHO) ' ],' >> META_new.json
$(NOECHO) $(ECHO) ' "meta-spec" : {' >> META_new.json
$(NOECHO) $(ECHO) ' "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",' >> META_new.json
$(NOECHO) $(ECHO) ' "version" : "2"' >> META_new.json
$(NOECHO) $(ECHO) ' "version" : 2' >> META_new.json
$(NOECHO) $(ECHO) ' },' >> META_new.json
$(NOECHO) $(ECHO) ' "name" : "Mojolicious-Che",' >> META_new.json
$(NOECHO) $(ECHO) ' "no_index" : {' >> META_new.json
Expand Down Expand Up @@ -572,8 +571,8 @@ metafile : create_distdir
$(NOECHO) $(ECHO) ' "web" : "https://github.com/mche/Mojolicious-Che"' >> META_new.json
$(NOECHO) $(ECHO) ' }' >> META_new.json
$(NOECHO) $(ECHO) ' },' >> META_new.json
$(NOECHO) $(ECHO) ' "version" : "0.0812",' >> META_new.json
$(NOECHO) $(ECHO) ' "x_serialization_backend" : "JSON::PP version 2.27400_02"' >> META_new.json
$(NOECHO) $(ECHO) ' "version" : "0.0823",' >> META_new.json
$(NOECHO) $(ECHO) ' "x_serialization_backend" : "JSON::PP version 4.04"' >> META_new.json
$(NOECHO) $(ECHO) '}' >> META_new.json
-$(NOECHO) $(MV) META_new.json $(DISTVNAME)/META.json

Expand Down Expand Up @@ -882,7 +881,7 @@ testdb_static :: static pure_all
# --- MakeMaker ppd section:
# Creates a PPD (Perl Package Description) for a binary distribution.
ppd :
$(NOECHO) $(ECHO) '<SOFTPKG NAME="Mojolicious-Che" VERSION="0.0812">' > Mojolicious-Che.ppd
$(NOECHO) $(ECHO) '<SOFTPKG NAME="Mojolicious-Che" VERSION="0.0823">' > Mojolicious-Che.ppd
$(NOECHO) $(ECHO) ' <ABSTRACT>Мой базовый модуль для приложений Mojolicious. Нужен только развернутый конфиг.</ABSTRACT>' >> Mojolicious-Che.ppd
$(NOECHO) $(ECHO) ' <AUTHOR>Михаил Че &lt;mche@cpan.org&gt;</AUTHOR>' >> Mojolicious-Che.ppd
$(NOECHO) $(ECHO) ' <IMPLEMENTATION>' >> Mojolicious-Che.ppd
Expand All @@ -900,7 +899,6 @@ ppd :
pm_to_blib : $(FIRST_MAKEFILE) $(TO_INST_PM)
$(NOECHO) $(ABSPERLRUN) -MExtUtils::Install -e 'pm_to_blib({@ARGV}, '\''$(INST_LIB)/auto'\'', q[$(PM_FILTER)], '\''$(PERM_DIR)'\'')' -- \
'Config.pm' '$(INST_LIB)/Mojolicious/Config.pm' \
'README.pod' '$(INST_LIB)/Mojolicious/README.pod' \
'lib/Mojo/Base/Che.pm' 'blib/lib/Mojo/Base/Che.pm' \
'lib/Mojolicious/Che.pm' 'blib/lib/Mojolicious/Che.pm'
$(NOECHO) $(TOUCH) pm_to_blib
Expand Down
72 changes: 33 additions & 39 deletions lib/Mojo/Base/Che.pm
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
package Mojo::Base::Che;
# ABSTRACT: some patch for Mojo::Base(current 8.02)
# ABSTRACT: some patch for Mojo::Base(current 8.23)

use Mojo::Base -strict;
use mro;# weak
#~ use mro;# weak

# copy-paste sub Mojo::Base::attr + patch 1 line
# copy-paste sub Mojo::Base::attr + patch 1 line #~
sub Mojo::Base::attr {
my ($self, $attrs, $value, %kv) = @_;
return unless (my $class = ref $self || $self) && $attrs;

Carp::croak 'Default has to be a code reference or constant value'
if ref $value && ref $value ne 'CODE';

Carp::croak 'Unsupported attribute option' if grep { $_ ne 'weak' } keys %kv;

# Weaken
if ($kv{weak}) {
state %weak_names;
unless ($weak_names{$class}) {
my $names = $weak_names{$class} = [];
my $sub = sub {
my $sub = sub {
my $self = shift->next::method(@_);
ref $self->{$_} and Scalar::Util::weaken $self->{$_} for @$names;
return $self;
Expand All @@ -27,16 +28,16 @@ sub Mojo::Base::attr {
unshift @{"${class}::ISA"}, $base;
}
push @{$weak_names{$class}}, ref $attrs eq 'ARRAY' ? @$attrs : $attrs;
}

}
for my $attr (@{ref $attrs eq 'ARRAY' ? $attrs : [$attrs]}) {
# patch
#~ Carp::croak qq{Attribute "$attr" invalid} unless $attr =~ /^[a-zA-Z_]\w*$/;

# Very performance-sensitive code with lots of micro-optimizations
my $sub;
if ($kv{weak}) {
if (ref $value) {
my $sub = sub {
$sub = sub {
return exists $_[0]{$attr}
? $_[0]{$attr}
: (
Expand All @@ -47,44 +48,37 @@ sub Mojo::Base::attr {
ref($_[0]{$attr} = $_[1]) and Scalar::Util::weaken($_[0]{$attr});
$_[0];
};
Mojo::Util::monkey_patch($class, $attr, $sub);
}
else {
my $sub = sub {
$sub = sub {
return $_[0]{$attr} if @_ == 1;
ref($_[0]{$attr} = $_[1]) and Scalar::Util::weaken($_[0]{$attr});
$_[0];
};
Mojo::Util::monkey_patch($class, $attr, $sub);
}
}
elsif (ref $value) {
$sub = sub {
return
exists $_[0]{$attr} ? $_[0]{$attr} : ($_[0]{$attr} = $value->($_[0]))
if @_ == 1;
$_[0]{$attr} = $_[1];
$_[0];
};
}
elsif (defined $value) {
$sub = sub {
return exists $_[0]{$attr} ? $_[0]{$attr} : ($_[0]{$attr} = $value)
if @_ == 1;
$_[0]{$attr} = $_[1];
$_[0];
};
}
else {
if (ref $value) {
my $sub = sub {
return
exists $_[0]{$attr}
? $_[0]{$attr}
: ($_[0]{$attr} = $value->($_[0]))
if @_ == 1;
$_[0]{$attr} = $_[1];
$_[0];
};
Mojo::Util::monkey_patch($class, $attr, $sub);
}
elsif (defined $value) {
my $sub = sub {
return exists $_[0]{$attr} ? $_[0]{$attr} : ($_[0]{$attr} = $value)
if @_ == 1;
$_[0]{$attr} = $_[1];
$_[0];
};
Mojo::Util::monkey_patch($class, $attr, $sub);
}
else {
Mojo::Util::monkey_patch($class, $attr,
sub { return $_[0]{$attr} if @_ == 1; $_[0]{$attr} = $_[1]; $_[0] });
}
$sub
= sub { return $_[0]{$attr} if @_ == 1; $_[0]{$attr} = $_[1]; $_[0] };
}
Mojo::Util::monkey_patch($class, $attr, $sub);
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Mojolicious/Che.pm
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ sub Mojolicious::dispatch {
}


our $VERSION = '0.0812';# as to Mojolicious/100+0.000<minor>
our $VERSION = '0.0823';# as to Mojolicious/100+0.000<minor>

=pod
Expand All @@ -303,7 +303,7 @@ our $VERSION = '0.0812';# as to Mojolicious/100+0.000<minor>
=head1 VERSION
0.0812
0.0823
=head1 NAME
Expand Down

0 comments on commit 8aa67f2

Please sign in to comment.