costas has asked for the wisdom of the Perl Monks concerning the following question:
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: I love perl but....
by Beatnik (Parson) on May 22, 2001 at 14:09 UTC | |
Greetz Beatnik ... Quidquid perl dictum sit, altum viditur. | [reply] |
Re: I love perl but....
by jeroenes (Priest) on May 22, 2001 at 14:10 UTC | |
Embedding perl in html can be done, but the reverse is more versatile. Generate HTML with perl! Look at CGI and the Template toolkit for convenient methods. Including is no problem at all. Example: The local and {} make the code cleaner, it works even without them. On unix, you can also use the following shorthand: Hope this helps, Jeroen | [reply] [d/l] [select] |
by japhy (Canon) on May 22, 2001 at 19:49 UTC | |
japhy -- Perl and Regex Hacker | [reply] |
Re:(Zigster) I love perl but....
by zigster (Hermit) on May 22, 2001 at 14:45 UTC | |
Quote:
In truth tho, perl is a very flexible language as you will often see on this site TIMTOWTDI (there is more than one way to do it) your are placing the solution before the problem. ASP and the like are cool SOLUTIONS but so is perl it's SOLUTIONS are just different. I would suggest taking a look at perl script. It will allow you to map your current methodology. I would futher sugest taking a fresh look at your PROBLEMS and see how you may solve them in perl. The rest of this thread gives some excellent advice regarding using perl with web based applications.
| [reply] |
by Odud (Pilgrim) on May 22, 2001 at 18:41 UTC | |
Perhaps it is just my local configuration but I've found PerlScript to be very slow. I'd assumed that it was suffering from reloading the interpreter everytime the page was displayed - i.e. the problem that mod_perl fixes at the server end. Do you find the performance to be acceptable? | [reply] |
by zigster (Hermit) on May 23, 2001 at 11:57 UTC | |
-- Zigster | [reply] |
Re: embedding PERL in HTML
by gregor42 (Parson) on May 22, 2001 at 19:25 UTC | |
Well I won't belabor the point of "lack of web oriented functions" other than to suggest looking at http://search.cpan.org and putting HTML into the search field. However, I will underline a point made briefly by my fellow monks above: Mixing Programming Code & HTML is a Bad Idea. There are a lot of reasons for this, but the basic idea is that HTML coders & programmers are not usually the same people. They have different skill-sets & pay-scales. Most companies are smart enough not to waste a programmer's salary to have someone make changes to web pages that are buried in code. Further, it is an unofficial, but still hard & fast rule that programmers are not designers & designers are not programmers. As such you will find that companies tend to go outside to agencies when giving the web site a 'face lift.' This introduces a lot of people with no business having access to the programming code mucking around in the HTML. Active Server Pages & Java Server Pages have the ability to embed code directly in them. However you will notice that JSP aithors are encouraged to encapsulate their code in JavaBeans to keep the HTML clean and ASP is currently migrating towards the '.NET' paradigm which is similar. So I would also advise you, as others have above, to have a look at the Module in CPAN called HTML::Template. It's a very good starting point for thinking in terms of separation of logic & content with PERL. Wait! This isn't a Parachute, this is a Backpack! | [reply] |
Re: I love perl but....
by Hero Zzyzzx (Curate) on May 22, 2001 at 18:19 UTC | |
If you really want to bump up your perl/HTML skillz, check out HTML::Template. I love this module. It's very simple, and it allows you to plug perl output into pure HTML files. Very elegant and powerful, and works EXCELLENTLY with mod_perl. It's not embedding perl in HTML, but I think it makes for MUCH more maintainable and understandable web apps by separating code from HTML clearly. Using HTML::Template, you don't end up with nasty code that mixes HTML in to perl scripts, seriously impeding maintability. Update:Umm, yeah. . . what gregor42 said below. . . | [reply] |
Re: I love perl but....
by runrig (Abbot) on May 22, 2001 at 19:57 UTC | |
Update: Hero Zzyzzx is right, HTML::Template could be made valid HTML, but then your template is even uglier than before. And viewing the file in a browser, you have blank areas where data would go (unless you actually run the 'program'), whereas with HTML::Tree you can view real sample data (in a WYSIWYG sort of way). | [reply] |
by Hero Zzyzzx (Curate) on May 22, 2001 at 20:07 UTC | |
Not to be nitpicky, but you can have 100% valid HTML with HTML::Template too. You can embed the variables, if-thens, and loops in HTML comments. You can then run the HTML through a validator, if you desire. | [reply] |
Re: I love perl but....
by ozzy (Sexton) on May 22, 2001 at 20:52 UTC | |
HTML::Mason HTML::Embperl HTML::Template Are great templating systems, which will make your life just as easy as those ASP/JSP style functions. -= Ozzy =- | [reply] |
Re: I love perl but....
by Anonymous Monk on May 22, 2001 at 21:36 UTC | |
Check these out: Enjoy! Eric | [reply] |
Re: I love perl but....
by blue_cowdawg (Monsignor) on May 23, 2001 at 00:44 UTC | |
I'm sorry, but you must not have checked out the CPAN site very closely. There are scads of (well maybe not scads... how many is a scad anyway...) ways to embed Perl inside of HTML. As far as ASP goes I must say that in my experience I haven't really seen anything done with ASP that either embedded perl, mod_perl, or just plain CGI couldn't accomplish. I also seem to remember that benchmark comparisons between PHP and Perl seemed to favor Perl FWIW. Check out the following on CPAN: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Peter L. Berghold --- Peter@Berghold.Net "Those who fail to learn from history are condemned to repeat it." | [reply] |
Re: I love perl but....
by tachyon (Chancellor) on May 22, 2001 at 22:46 UTC | |
You are aware of CGI.pm I presume. After a review of the free standard modules, what functionality do you miss??? Here is a list of web related free modules that come with the *standard* distribution of perl. Sincere apologies to the hundred of authors of thousands of modules not explicitly mentioned. For details see http://www.CPAN.org NB: CPAN is the Comprehensive Perl Archive Network. tachyon Benchmark Bundle DBD CSV mysql DBI LWP Business CreditCard Carp CGI Apache Carp Cookie Fast Imagemap Pretty Push Screen Switch XMLForm Chart Class Compress Zlib Config CPAN Crypt Date Calc Format Manip Parse DB DBD ADO CSV DB2 dbd-sybase File Multiplex mysql ODBC Oracle Proxy Sybase DBI DBD FAQ Format ProxyServer Shell W32ODBC DB_File Digest DirHandle Fatal Fcntl File Basename CheckTree Compare Copy CounterFile DosGlob Find Glob Listing Path Recurse Slurp Spec Functions Mac OS2 Unix VMS Win32 stat Tools FileCache FileHandle Filter cpp decrypt exec sh tee Util Call Exec FindBin Font AFM Graph Kruskal HTML AsSubs Element Entities Filter Form FormatPS Formatter FormatText HeadParser LinkExtor Parse Parser Stream Template TokeParser TreeBuilder HTTP Cookies Daemon Date Headers Util Message Negotiate Request Common Response Status I18N Image Size IO AtomicFile Dir File Handle Lines Pipe Poll Scalar ScalarArray Seekable Select Socket INET UNIX Stringy Wrap WrapTie IPC Locale Country Language LWP Debug MediaTypes MemberMixin Protocol RobotUA Simple UserAgent Mail POP3Client Math MD5 MIME Base64 Lite QuotedPrint MLDBM Mysql NDBM_File Net Bind Resolv Utils Cmd DNS Header Packet Question Resolver RR A AAAA AFSDB CNAME EID HINFO ISDN LOC MB MG MINFO MR MX NAPTR NIMLOC NS NSAP NULL PTR PX RP RT SOA SRV TXT X25 Update Domain DummyInetd FTP hostent LDAP BER Constant Entry FAQ Filter LDIF Message Reference Schema Search Util netent Netrc NNTP PH Ping POP3 protoent servent SMTP SNPP Telnet Time Whois Netscape History HistoryURL News Newsrc NNTPClient POE POSIX PPM SOAPClient SOAPServer SGMLS Output Refs SHA Shell SOAP Defs Envelope EnvelopeMaker GenericHashSerializer GenericInputStream GenericScalarSerializer OutputStream Packager Parser HTTP Apache CGI Client Server TypeMapper Socket Sort PolySort SQL Eval Statement Statistics Storable String Sybase BCP Symbol Sys Hostname Syslog Test Harness Text Abbrev CSV_XS German Metaphone ParseWords Soundex Striphigh Tabs Template Vpp Wrap Thread Queue Semaphore Signal Specific Tie Time gmtime HiRes Local localtime Period tm Zone Tk User Win32 Win32API WWW RobotRules AnyDBM_File Search AltaVista AdvancedNews AdvancedWeb Careers Intranet News Web Classifieds Employment Crawler Dice EuroSeek Excite News ExciteForWebServers Fireball FolioViews Google Gopher GoTo HeadHunter HotFiles Infoseek Companies Email News Web Livelink LookSmart Lycos Pages Sites MetaCrawler Metapedia Monster MSIndexServer NetFind NorthernLight Null PLweb Search97 SFgate Simple Snap Test Verity VoilaFr WebCrawler Classifieds Employment ZDNet SearchResult XML DOM Element Parser Expat PPD PPMConfig ValidatingElement | [reply] |
Re: I love perl but....
by Anonymous Monk on May 23, 2001 at 01:37 UTC | |
| [reply] |