Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hi,

Thank you.

Have you seen https://metacpan.org/pod/Plack::Request#path_info/script_name?

After re-reading the Plack::Request docs, I'm struggling to understand why did I pick such misleading names in the first place. What I'm talking about here has nothing to do with peeking at low level/raw stuff.

So in neaf, the current convention is as follows:

  • script_name is the part of the path that matched current route, not the name of the script or the raw stuff from PSGI request.
  • path_info is anything that follows that matching part, for instance a wiki article name.
  • path_info_split is a newer version that takes regular expression capture groups into account.

This is arguably horrible and misleading. I would like to get rid of the middle part as it's superseded by the last one, and come up with sane names for (1) the part of path that matched current route and (2) the capture groups found in the remainder of the path. Other frameworks use param aliases for (2), except for sinatra (ruby) that calls it splat. The param approach doesn't play nicely with my "regexp filters everywhere" approach.

get_post

Could as well be put + patch. It's only delete that spoils everything and I have to maintain an any variant anyway.

Does route return a route object? Something like Routes::Tiny::Match?

I was thinking that route() should be a string, just the part of the path mathing current route. Apparently it's not the case with Dancer, so it's a misleading name after all. And I was also thinking about endpoint() method for providing the route details object, but it's not even in TODO yet.

route_suffix

Nice, although maybe a bit long.

I think you're too close to your code, and I'm too far far far away :)

This is why I have to ask. I need an outside view.


In reply to Re^2: Better names for SCRIPT_NAME/PATH_INFO in a web framework? by Dallaylaen
in thread Better names for SCRIPT_NAME/PATH_INFO in a web framework? by Dallaylaen

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2024-04-23 08:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found