in reply to Re^5: Personalizing the linkers (happen)
in thread Personalizing the linkers

I think for the case of CPAN we could do:

my $escapedname=$query->escape($nodeloc); my $cpantitle= $title || $no +deloc; my $mode=$VARS->{cpan_link_opts} || 'mode=module'; return qq[< +a href="http://search.cpan.org/search?$mode&query=$escapedname">$cpan +title</a>];

IMO there isnt so much need for a general solution, I dont think that many of the link types can really benefit from such tricks.

---
$world=~s/war/peace/g

Replies are listed 'Best First'.
Re^7: Personalizing the linkers (happen)
by dragonchild (Archbishop) on May 06, 2005 at 12:54 UTC
    The idea behind this was to get pmdev out of the business of providing linker methods, especially the more esoteric ones. Maybe I link a lot to foobar.com in my posts, but no-one else does. Why should the Monastery provide a linker method just for me and my closest friends? But, why should I have to do what a computer can easily do for me? Enter custom linkers.

    I'm thinking of a way that I can create a linker that I call foobar:// and it would look like:

    foobar: <a href="www.foobar.com?baz=%L">Foobar: %T</a>

    Now, you don't have to wade through yet another discussion of how PM does/doesn't provide a linker for foobar.com. I can just go make one. If you like it, add it to the default linkers.


    • In general, if you think something isn't in Perl, try it out, because it usually is. :-)
    • "What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?"

      Maybe im not understanding things properly, but i dont see how this makes sense. Theres no point in special links that only your userid understands. I can understand the desire to overload the behaviour of the CPAN link and maybe a few more, but I dont really see how customized link types on a per user basis can be made to work, nor why they should be made to work.

      ---
      $world=~s/war/peace/g

        They'd be expanded based on $AUTHOR's settings instead of $USER's settings. Which makes more sense to me on the mode= choice for search.CPAN links. But I could see reasons people would want to customize the links they see, but not in such a restricted way. Now, providing both features would be quite an interesting challenge.

        - tye        

        . . ., but I dont really see how customized link types on a per user basis can be made to work, nor why they should be made to work.

        I make a post that includes a foobar:// link. $reader comes along and wants to read it. The Everything Engine retrieves the text I wrote and post-processes it to generate HTML. It sees [foobar://abcd|ABCD]. The [] brackets say "Go look up a linker method". It does so, checking my personal linkers first. It sees the foobar:// definition and creates a href from it. EE then goes ahead and displays the HTML.

        From $reader's perspective, he has no idea whether or not I did [http://foobar.com?q=abcd|ABCD] or [foobar://abcd|ABCD]. All $reader knows is that s/he can click on the link, be sent to the useful page at foobar.com, and be englightened.

        From my perspective, since I link to foobar.com in over half my posts, my PM experience is improved. And, when I decide to improve how I like to foobar.com, I can change my definition and the EE will go ahead and change the href it generates (if my understand of the EE is correct).

        This makes things like the change from www.perldoc.com to perldoc.perldrunks.org to perldoc.perl.org much easier to manage.


        • In general, if you think something isn't in Perl, try it out, because it usually is. :-)
        • "What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?"
Re^7: Personalizing the linkers (amp)
by tye (Sage) on May 05, 2005 at 18:26 UTC

    Note that & should be &amp; for URLs that are part of HTML. Most of the time, there is no practical difference. I just noticed that (and assume the problem pre-existed, since that problem exists all over PerlMonks) in the trimmed-down code, so FYI to anyone updating such code.

    - tye