So what do we have:
  > While it is not proven
a) If it's not proven, we can agree that it doesn't prevent circular references at all (for me it's obvious), before someone can proof that is does, right? b) You've fixed the misleading part of the documentation with my help, because of a) right?


At least I've heard something that makes sense: you test your code with the help of Devel::Cycle and want hide leaks outside an object. We are not talking about is this good or bad, it just has a reason. If someone told me that before closing a ticket (showing how smart he is), I would have saved a lot of time and only would point that the documentation is incorrect.

I also can show an example where and when to use IOC. I'm working on Mango right now and found a big security issue:

https://metacpan.org/pod/Mango#credentials
my $m = Mango::->new('mongodb://user:[email protected]');
say Dumper $m;

I was very surprised when I found that Mango keeps my password as is. (I hope don't need to explain why). So this is a good candidate for H::U::F (but we also have to prepare creds before saving it)

P.S.:
And about to being civil. Did you ever think maybe we have a kind of cultural differences? In my country the word doesn't matter, only an action matter. Words are used as a way to communicate only and can't be offensive, but actions can be.

And if one person knows, that other one is mistaken, the first one should push as hard as he can to prove it and help, and the other one will be grateful in the future. Why? Because if you had a chance to help other person and missed it (or did nothing) - you did a very bad thing. There is a special boiler in the Hell for indifferent people. But in the other hand there are cultures where almost every sentence without "dear" or "friend" sounds like a personal offence. But we still can communicate east cultures, right? Because computers work the same way for everyone, no matter what is a color of your skin (with the exception for redheads, for redheads comptures work 15% slower).

And instead of "alexbyk, ur right, thank you, ur awesome" I got a ban for "changing comments and being offensive". This is ridiculous. If I find some critical bug in the future, how do I suppose to report it? Developers should see things more widely and wisely



    So the question is, which one of equal variants is better and more
    simple?


While it is not proven that using fieldhash actively prevents circular references in the Mojo::IOLoop::Delay scenario, it does help avoiding false positives with Devel::Cycle.

perl -Ilib -Mojo -MDevel::Cycle -E 'my $ua = Mojo::UserAgent->new; Mojo::IOLoop->delay(sub { my $d = shift; $ua->get("mojolicio.us" => $d->begin); find_cycle $d }, sub { $ua->get("mojolicio.us" => shift->begin) }, sub {})->wait'

Without fieldhash you would see a circular reference here.

    Cycle (1):
$Mojo::IOLoop::Delay::A->{'remaining'} => \@B
                    $B->[0] => \&C
            $C variable $ua => \$D
                        $$D => \%Mojo::UserAgent::E
$Mojo::UserAgent::E->{'connections'} => \%F
$F->{'c92d527d9db95e50179b96ba1d71d8dd'} => \%G
                 $G->{'cb'} => \&H
          $H variable $self => \$I
                        $$I => \%Mojo::IOLoop::Delay::A

But a totally harmless one, because it gets automatically resolved once the callback has been consumed. I'd rather not have these false positives in Devel::Cycle output, and therefore consider the current solution superior.

--
sebastian
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[email protected]>.
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to