Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return route objects when defining new ones #1088

Closed
wants to merge 2 commits into from

Conversation

xsawyerx
Copy link
Member

@xsawyerx xsawyerx commented Jan 1, 2016

This commit adds the ability to receive all the route objects
created with the call to the DSL that creates them.

This is helpful if you want to know which objects you just
created. An example could be a plugin that creates a route (or
receives a route created) and wants to inspect it or alter it.

Future thoughts:

  • What if we had hooks for route creation?
  • What if routes had unique IDs?

@veryrusty
Copy link
Member

We don't specify the return values of most keywords, however returning the route object(s) makes sense here. @xsawyerx++

We should document and add tests before merging though. ;)

@racke
Copy link
Member

racke commented Jan 2, 2016

Sounds like a good and useful idea - @xsawyerx ++

@xsawyerx
Copy link
Member Author

xsawyerx commented Jan 2, 2016

I'll add some tests and docs. As the ticket now reflects, I want this for what I'm playing with in #33. :)

This commit adds the ability to receive all the route objects
created with the call to the DSL that creates them.

This is helpful if you want to know which objects you just
created. An example could be a plugin that creates a route (or
receives a route created) and wants to inspect it or alter it.

Future thoughts:

* What if we had hooks for route creation?
* What if routes had unique IDs?
@xsawyerx xsawyerx force-pushed the feature/tracking-route-specs branch from 7943a73 to 2269bd3 Compare January 9, 2016 20:23
@xsawyerx
Copy link
Member Author

xsawyerx commented Jan 9, 2016

@racke Added a test showcasing it.

I prefer not to add documentation for it because:

  1. It's implementation detail.
  2. It's experimental.

Can I merge it now? :)

@xsawyerx xsawyerx added this to the 0.166000 milestone Jan 9, 2016
@racke
Copy link
Member

racke commented Jan 10, 2016

Good, go ahead!

@veryrusty
Copy link
Member

👍

@veryrusty
Copy link
Member

Rebased and merged as a73a8b2. @xsawyerx++

👯

@veryrusty veryrusty closed this Jan 12, 2016
@veryrusty veryrusty deleted the feature/tracking-route-specs branch January 12, 2016 01:30
xsawyerx added a commit that referenced this pull request Jan 12, 2016
    [ BUG FIXES ]
    * GH #1013, #1092: Remove race condition caused by caching available
      engines. (Sawyer X, Menno Blom, Russell Jenkins)
    * GH #1089: Exact macthing of route regex comments for tokens/splats.
      (Sawyer X)
    * GH #1079, #1082: Allow routes to return '0' as response content,
      and serializer hooks are called when default response content is
      to be returned. (Alberto Simões, Russell Jenkins)
    * GH #1093, 1095: Use a dynamic TT2 INCLUDE_PATH to allow relative
      views with relative includes; fixing regression introduced by #1037.
      (Russell Jenkins)
    * GH #1096, #1097: Return compatibility on Perl 5.8.x!
      (Peter Mottram - @SysPete)

    [ DOCUMENTATION ]
    * GH #1076: Typo in Dancer2::Core::Hook POD. (Jonathan Scott Duff)

    [ ENHANCEMENTS ]
    * GH #1074: Add sample session engine config to skeleton app.
      (Peter Mottram - @SysPete)
    * GH #1088: Return route objects when defining new routes.
      (Sawyer X)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants