EchoAngel has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, I was wondering if there was a perl package for expanding trees. I have seen some javascript trees where the links would expand and close. Is there anything like this but in perl?

Replies are listed 'Best First'.
Re: Perl/Cgi : Any packages for Trees?
by Thilosophy (Curate) on Jan 24, 2005 at 21:57 UTC
    You have to appreciate that Perl/CGI is running on the web server whereas JavaScript runs inside the web browser, which means that JS can do these "instant" effects while Perl always needs to reload the page.

    In any case, Perl/CGI uses a combination of HTML/CSS/JS to render its output in a web browser, and there are a few modules on CPAN that help you in producing this HTML/CSS/JS code.

    I have not tested any of them, though.

Re: Perl/Cgi : Any packages for Trees?
by punkish (Priest) on Jan 25, 2005 at 01:15 UTC
    Perl is a server-side language. JavaScript is a client-side language. For a tree widget you need JavaScript. Google, and ye shall find many readymade solutions. Wrt Perl, all you can do is use Perl to create the JavaScript. But why do that if it already exists? Well, you might want to pull info from a database to create a dynamic tree that is, then, controlled by JavaScript in the user's browser. That would be a good integration of server-side Perl and client-side JavaScript.