Thanks, Dan! I updated the gist
<https://gist.github.com/s1037989/479087c752d7461d3499c12971636678> with
your recommendation, and my new synopsis is this:
Mojo::AWS::Signature4->add_generator($ua => 'sign');
my $tx = $ua->build_tx(GET => '...' => sign => {service => 'ec2'});
Does add_generator feel like the right method name for this? Maybe
apply_generator, instead?
On Tue, Mar 12, 2019 at 4:45 PM Dan Book <[email protected]> wrote:
> That seems like the appropriate mechanism to me. If you want to provide a
> convenience method, I would instead provide one that takes the $ua object
> and an optional generator name, and calls ->add_generator itself. It would
> also be subclassable since it could call a method on $self instead of
> __PACKAGE__.
> -Dan
>
> On Tue, Mar 12, 2019 at 5:22 PM Stefan Adams <[email protected]> wrote:
>
>> I built a generator for AWS Signature4 requests
>> <https://gist.github.com/s1037989/479087c752d7461d3499c12971636678>.
>> This generator calculates a signed Authorization header for the request.
>> Is this a good use of the Transactor generator feature?
>>
>> As you can see from L13
>> <https://gist.github.com/s1037989/479087c752d7461d3499c12971636678#file-ec2-t-L13>
>> of the supplied test, I make my generator available this way:
>>
>> $ua->transactor->add_generator(Mojo::AWS::Signature4::generator);
>>
>>
>> Is this the best mechanism available to share this generator, or is there
>> a recommended standard convention? When I go to document it for
>> publishing, is that what I should have in the synopsis section? It almost
>> feels like there should be a plugin mechanism for Mojo::UserAgent.
>>
>> Thanks for any advice and comments you have!
>>
>> Stefan
>>
>> --
>> 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 https://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 https://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 https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.