Yang Bo
Recent Actions
-
Commented on New class of memory leaks inaugurated by Perl v5.40 (and we are unprepared for that)
Cannot see a circular reference here, so probably a bug....
-
Commented on Long Import Lists (and available strategies for managing them)
That's an interesting technique, I also found out that it's a good way to mess up with somebody: use JSON::PP; sub JSON::PP { 'lol' } my $obj = JSON::PP->new; This actually fails, so by declaring a subroutine named PP in...
-
Commented on Long Import Lists (and available strategies for managing them)
Lexical aliasing could actually be achieved with pure Perl. use strict; use warnings; use feature 'say'; package A { sub g { say 'I am A::g.'; } } package a::b::c::d::e::f { sub g { say 'I am a::b::c::d::e::f::g.'; } }...
- Posted A short video introduction to App::rs, the first reference counting CPAN client. to Yang Bo
-
Commented on A new object system for Perl
Suppose Foo::Bar is a module implementing a Dot class, you typically create an instance from it by saying: my $obj = Foo::Bar::mod({}, ...); If the methods of a Dot class only refer to the object through a weakened reference there...
-
Posted A new object system for Perl to Yang Bo
I just released Dot, it's a new object system for Perl, some of its highlight and difference:
- There's no code for this object system, you don't even have to install the module to use it.
- An object is a hash, a method is a closure, and a class is a subroutine.
- True pr…
-
Commented on A new Linux distribution with Perl as its heart
No, I never used gentoo, I did a quick read of relative documentation, and there is an equivalent in rs, build configurations are programmable in Perl, and different building instructions could be dynamically generated depending on the command line arguments...
-
Posted A new Linux distribution with Perl as its heart to Yang Bo
I just released RSLinux-v1.01, it's a new Linux distribution with its package in Perl. It offers complete freedom on how you want it to be, like LFS, but much much easier. And needless to say, if you're a Perl hacker you a…
Comment Threads
-
Tim King commented on
Long Import Lists (and available strategies for managing them)
However... (Thinking out loud here.) It might be possible to use this with another technique to achieve the desired effect.
BEGIN { my $bak; *A:: = $bak; BEGIN { $bak = \%A::; *A:: = \%a::b::c::d::e::f::; } sub A { return 'a::b::c::d::e::f'; }
A::g();
A->g();
}
That could also conceivably be done in a package.
What am I missing?
-
Toby Inkster commented on
Long Import Lists (and available strategies for managing them)
If the module uses Exporter::Tiny, then you'll get your "Export a hash of symbols" solution for free.
For example, List::MoreUtils uses Exporter::Tiny, so you can do this:
use v5.10; use strictures;
my %LMU;
use List::MoreUtils { into => \%LMU }, -all;# calls List::MoreUtils::uniq()
say for $LMU{uniq}->(qw/foo bar foo baz/);
-
Tim King commented on
Long Import Lists (and available strategies for managing them)
Exporter::Tiny: good tip. (Unfortunately, this depends on the implementation of the package being used. That kinda sucks.)
-
Tim King commented on
Long Import Lists (and available strategies for managing them)
Yes! That's it. (I had to run it through perltidy to make sense of it, but that's the code.)
-
Johan Vromans commented on
Long Import Lists (and available strategies for managing them)
Unfortunately the code stopped working in recent versions of Perl...
About blogs.perl.org
blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.