Open Source Web Development with LAMP Using Linux, Apache, MySQL, Perl, and PHP [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Open Source Web Development with LAMP Using Linux, Apache, MySQL, Perl, and PHP [Electronic resources] - نسخه متنی

James Lee, Brent Ware

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید










10.4 A Quick Example


Let's start with a quick example to display "hello, world!" with Embperl (what else?). Create the file /var/www/html/embperl/indexl with the following contents (remember to chmod a+r indexl
[3]):

[3] In general, if you have any problems, check your permissions. Don't make us say this again.



[-
$msg = ´hello, world!´;
-]
<html>
<head>
<title>hello, world with Embperl</title>
</head>
<body bgcolor="#ffffff">
[+ $msg +]
</body>
</html>

To see the result of this page, load one of the following into your browser: http://localhost/embperl/ or www.opensourcewebbook.com/embperl/. You should see something like Figure 10.1.


Figure 10.1. hello, world! with Embperl


The first part of indexl is an Embperl command denoted by [- ... -]. We discuss this later in this chapter, but for now suffice it to say that the code within this command is executed as Perl code. In this example, $msg is set to a familiar message that is included in the HTML within the <body> tags.

To include the contents of the variable $msg, use the Embperl command [+ $msg +]. This command is replaced by the value of the variable $msg. This value is then displayed in the browser.


/ 136