in reply to Re: Personalizing the linkers
in thread Personalizing the linkers

But nothing happened. :-(

  • 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?"

Replies are listed 'Best First'.
Re^3: Personalizing the linkers (happen)
by tye (Sage) on May 04, 2005 at 18:54 UTC

    Yes, because you never provided code that does such customization w/o opening up the server to denial of service (or worse) attacks. (insert emoticon)

    - tye        

      DOS attacks? This (looks like it) is a straight text substitution. I provide a list of however many linker types I want with a parameter for the stuff between linker:// and |. When I use foo://, you look up foo:// in my list and substitute, as appropriate. If foo:// doesn't exist, it's handled as it would be default.

      Maybe I'm missing something, but that shouldn't open you up to a DOS ...


      • 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?"

        Here are the current link-handling settings:

        Setting Value
        cpan my $escapedname=$query->escape($nodeloc); my $cpantitle= $title || $nodeloc; return qq[<a href="http://search.cpan.org/search?mode=module&query=$escapedname">$cpantitle</a>];
        dict my $escapedname = $query->escape($nodeloc); my $x = $title || $nodeloc; return qq[<a href="http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=$escapedname">$x</a>];
        doc if ($escapedname =~ /^perl/) {qq[<a href="http://perldoc.perl.org/$escapedname.html">$cpantitle</a>];} else {qq[<a href="http://perldoc.perl.org/functions/$escapedname.html">$cpantitle</a>];}
        ftp return $title ? qq[<a href="ftp://$nodeloc">$title</a>] : qq[<a href="ftp://$nodeloc">$nodeloc</a>];
        google my $escapedname=$query->escape($nodeloc); my $cpantitle= $title || $nodeloc; return qq[<a href="http://www.google.com/search?q=$escapedname">$cpantitle</a>];
        href return qq[<a href="$nodeloc">$cpantitle</a>]
        http return $title ? qq[<a href="http://$nodeloc">$title</a>] : qq[<a href="http://$nodeloc">http://$nodeloc</a>];
        https return $title ? qq[<a href="https://$nodeloc">$title</a>] : qq[<a href="https://$nodeloc">https://$nodeloc</a>];
        id if($nodeloc=~/\D/) {return "[$inner]"} else {return $title ? linkNode($nodeloc, $title) : linkNode($nodeloc)};
        isbn $nodeloc =~ tr/0-9Xx//cd; my $cpantitle = $title || "ISBN $nodeloc"; "<a href='http://isbn.nu/$nodeloc'>$cpantitle</a>";
        jargon return qq[<a href="http://www.science.uva.nl/cng/search/htsearch.CGI?words=$escapedname&restrict=%2F%7Emes%2Fjargon%2F">$cpantitle</a>];
        kobe return qq[<a href="http://cpan.uwinnipeg.ca/search?query=$escapedname&mode=module">$cpantitle</a>];
        kobes return qq[<a href="http://cpan.uwinnipeg.ca/search?query=$escapedname&mode=module">$cpantitle</a>];
        link return qq[<a href="$nodeloc">$cpantitle</a>]
        lj return qq[<a href="http://livejournal.com/users/$nodeloc">$cpantitle</a>];
        localtime $nodeloc="" if $nodeloc=~/now/i; return htmlcode('parseTimeInString', '', $nodeloc);
        lucky my $escapedname = $query->escape($nodeloc); my $cpantitle= $title || $nodeloc; return qq[<a href="http://www.google.com/search?q=$escapedname&btnI=I">$cpantitle</a>];
        node return htmlcode('node_link', '', $inner, $nodeloc, $title, $cpantitle);
        pad return htmlcode('scratchpad_link', '', $nodeloc||$AUTHOR->{title}, $title, {});
        perldoc return qq[<a href="http://www.perldoc.com/cgi-bin/htsearch?&words=$escapedname">$cpantitle</a>];
        pmdev return htmlcode('pmdev_link', '', $inner);

        Much of the complexity has been factored out already but there are still a lot of improvements for the infrastructure of link handling that are desired and partially implemented. But even what we have now isn't a simple text substitution. Provide the start of an enhancement to get your customization and it might get into the queue with the other enhancements that have yet to be deployed. Sometimes such a kick-start is exactly what is needed.

        If you are missing something, then implementing it will probably rectify that situation. I don't see the obvious right way to do something like what you have asked for that I'd consider flexible to the point of being worth implementing, but I haven't sat down and tried to design it (but it appears you haven't sat down and tried to design it in any detail either so I don't feel particularly lazy in comparison).

        - tye