Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
There's more than one way to do things
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Where did the slashes go? That would assemble URIs such as http://example.net/appadminjoebobdoc rather than http://example.net/app/admin/joebob/doc.

You also broke down on my ornery $is_admin_link requirements. First of all the clause is the wrong way around, it would have to be ( $is_admin_link && $admin ) – but since $is_admin_link is always 0 or 1, that would leave spurious zeroes in the output, so you need to boolify: ( !! $is_admin_link and $admin ).

All things considered, we get this:

my $part = ( 'http://example.net/app' . ( !! $is_admin_link && '/' . $admin ) . ( defined $subsite && '/' . $subsite ) . '/' . $mode . ( defined $id && '/' . $id ) . ( defined $submode && '/' . $submode ) );

I definitely feel like a broken record now.

Not to mention that all of this misses my point because it’s specific to join, and I’ve needed to pass a variable list to some function or method often enough where really needed the sub-list to be empty depending on the condition – winging it by combining && and the false evaluates to the empty string factoid wouldn’t have done me any good.

Makeshifts last the longest.


In reply to Re^2: Secret Perl Operators: the boolean list squash operator, x!! by Aristotle
in thread Secret Perl Operators: the boolean list squash operator, x!! by Aristotle

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others taking refuge in the Monastery: (8)
    As of 2014-04-19 17:59 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (483 votes), past polls