1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070
|
<html>
<head>
<title>Apache::ASP::Objects</title>
<style type="text/css">
<!--
td { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px}
font { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px}
.title { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px}
-->
</style>
</head>
<body bgcolor=black link=#063678 alink=#ff5599 vlink=#993399
marginheight=0 marginwidth=0 leftMargin=0 topMargin=0>
<center>
<table border=0 cellpadding=0 width=99% cellspacing=8>
<tr><td align=center>
<table border=0 cellpadding=3 width=100% cellspacing=0>
<tr bgcolor=#063678>
<td>
<table border=0 cellpadding=1 cellspacing=0 width=100%>
<tr>
<td><img border=0 src=asptitlelogo.gif alt="Apache::ASP" width=267 height=44 ></td>
<td align=right></td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor=#005196 align=center>
<b>
<font color=#ffffff><% Web Applications with Apache & mod_perl %></font>
</b>
</td>
</tr>
</table>
<table border=0 cellpadding=10 cellspacing=0 width=100% bgcolor=#005196>
<tr>
<td valign=top width=120 bgcolor=#005196>
<table cellpadding=5 cellspacing=0 border=1 bgcolor=white><tr><td>
<table border=0 cellpadding=0 cellspacing=0 width=105 bgcolor=white>
<tr>
<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr> </nobr></b></font></td>
<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><a href="index.html" style="text-decoration:none"><font color=#063678>INTRO</font></a></nobr></b></font></td>
</tr>
<tr>
<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr> </nobr></b></font></td>
<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><a href="install.html" style="text-decoration:none"><font color=#063678>INSTALL</font></a></nobr></b></font></td>
</tr>
<tr>
<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr> </nobr></b></font></td>
<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><a href="config.html" style="text-decoration:none"><font color=#063678>CONFIG</font></a></nobr></b></font></td>
</tr>
<tr>
<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr> </nobr></b></font></td>
<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><a href="syntax.html" style="text-decoration:none"><font color=#063678>SYNTAX</font></a></nobr></b></font></td>
</tr>
<tr>
<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr> </nobr></b></font></td>
<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><a href="events.html" style="text-decoration:none"><font color=#063678>EVENTS</font></a></nobr></b></font></td>
</tr>
<tr>
<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr>%</nobr></b></font></td>
<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><font color=#993399>OBJECTS</font></nobr></b></font></td>
</tr>
<tr>
<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr> </nobr></b></font></td>
<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><a href="ssi.html" style="text-decoration:none"><font color=#063678>SSI</font></a></nobr></b></font></td>
</tr>
<tr>
<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr> </nobr></b></font></td>
<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><a href="sessions.html" style="text-decoration:none"><font color=#063678>SESSIONS</font></a></nobr></b></font></td>
</tr>
<tr>
<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr> </nobr></b></font></td>
<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><a href="xml.html" style="text-decoration:none"><font color=#063678>XML/XSLT</font></a></nobr></b></font></td>
</tr>
<tr>
<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr> </nobr></b></font></td>
<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><a href="cgi.html" style="text-decoration:none"><font color=#063678>CGI</font></a></nobr></b></font></td>
</tr>
<tr>
<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr> </nobr></b></font></td>
<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><a href="perlscript.html" style="text-decoration:none"><font color=#063678>PERLSCRIPT</font></a></nobr></b></font></td>
</tr>
<tr>
<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr> </nobr></b></font></td>
<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><a href="style.html" style="text-decoration:none"><font color=#063678>STYLE GUIDE</font></a></nobr></b></font></td>
</tr>
<tr>
<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr> </nobr></b></font></td>
<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><a href="faq.html" style="text-decoration:none"><font color=#063678>FAQ</font></a></nobr></b></font></td>
</tr>
<tr>
<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr> </nobr></b></font></td>
<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><a href="tuning.html" style="text-decoration:none"><font color=#063678>TUNING</font></a></nobr></b></font></td>
</tr>
<tr>
<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr> </nobr></b></font></td>
<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><a href="kudos.html" style="text-decoration:none"><font color=#063678>CREDITS</font></a></nobr></b></font></td>
</tr>
<tr>
<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr> </nobr></b></font></td>
<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><a href="support.html" style="text-decoration:none"><font color=#063678>SUPPORT</font></a></nobr></b></font></td>
</tr>
<tr>
<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr> </nobr></b></font></td>
<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><a href="sites.html" style="text-decoration:none"><font color=#063678>SITES USING</font></a></nobr></b></font></td>
</tr>
<tr>
<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr> </nobr></b></font></td>
<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><a href="testimonials.html" style="text-decoration:none"><font color=#063678>TESTIMONIALS</font></a></nobr></b></font></td>
</tr>
<tr>
<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr> </nobr></b></font></td>
<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><a href="resources.html" style="text-decoration:none"><font color=#063678>RESOURCES</font></a></nobr></b></font></td>
</tr>
<tr>
<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr> </nobr></b></font></td>
<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><a href="todo.html" style="text-decoration:none"><font color=#063678>TODO</font></a></nobr></b></font></td>
</tr>
<tr>
<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr> </nobr></b></font></td>
<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><a href="changes.html" style="text-decoration:none"><font color=#063678>CHANGES</font></a></nobr></b></font></td>
</tr>
<tr>
<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr> </nobr></b></font></td>
<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><a href="license.html" style="text-decoration:none"><font color=#063678>LICENSE</font></a></nobr></b></font></td>
</tr>
<tr><td colspan=2><hr size=1></td></tr>
<tr>
<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr> </nobr></b></font></td>
<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><a href="eg/index.html" style="text-decoration:none"><font color=#063678>EXAMPLES</font></a></nobr></b></font></td>
</tr>
</table>
</td></tr>
</table>
<br>
<center>
<a href=http://www.apache-asp.org/><img src="powered_by_apache_asp.jpg" width="88" height="31" alt="Powered by Apache::ASP" border="0"></a>
<br>
<a href=http://perl.apache.org><img src="powered_by_modperl.gif" width="88" height="31" alt="Powered by ModPerl and Apache" border="0"></a>
<br>
<a href=http://www.perl.com><img src="rectangle_power_perl.gif" width="88" height="31" alt="Powered by Perl" border="0"></a>
</center>
</td>
<td valign=top bgcolor=white>
<font size=+0 face=verdana,arial>
<font face=verdana><font class=title size=+1 color=#555555><b>OBJECTS</b></font>
<font face="courier new" size=3><pre>
</pre></font>The beauty of the ASP Object Model is that it takes the
burden of <a href=cgi.html><font size=-1 face=verdana><b>CGI</b></font></a> and Session Management off the developer,
and puts them in objects accessible from any
ASP script & include. For the perl programmer, treat these objects
as globals accessible from anywhere in your ASP application.
<font face="courier new" size=3><pre>
</pre></font>The Apache::ASP object model supports the following:
<font face="courier new" size=3><pre>
Object Function
------ --------
$Session - user session state
$Response - output to browser
$Request - input from browser
$Application - application state
$Server - general methods
</pre></font>These objects, and their methods are further defined in the
following sections.
<font face="courier new" size=3><pre>
</pre></font>If you would like to define your own global objects for use
in your scripts and includes, you can initialize them in
the global.asa Script_OnStart like:
<font face="courier new" size=3><pre>
use vars qw( $Form $Site ); # declare globals
sub Script_OnStart {
$Site = My::Site->new; # init $Site object
$Form = $Request->Form; # alias form data
$Server->RegisterCleanup(sub { # garbage collection
$Site->DESTROY;
$Site = $Form = undef;
});
}
</pre></font>In this way you can create site wide application objects
and simple aliases for common functions.</font>
<hr size=1>
<table width=100% border=0 cellpadding=1 cellspacing=3>
<tr>
<td valign=top><font face="lucida console" size=-1>
<tr>
<td valign=top bgcolor=#005196>
<font face="lucida console" size=-1>
<font color=white><b><a href=#%24Session%20Obj517fb3b8><font color=white>$Session Object</font></a></b></font>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3EW0307fe16>$Response->Write($data)</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Session-%3E%7BCa919a318>$Session->{CodePage}</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Session-%3E%7BL2343b3bf>$Session->{LCID}</a>
</font>
</td>
<td valign=top bgcolor=#005196>
<font face="lucida console" size=-1>
<font color=white><b><a href=#%24Request%20Objc3cab62e><font color=white>$Request Object</font></a></b></font>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Session-%3E%7BS1049f4e8>$Session->{SessionID}</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Request-%3E%7BM81641f4a>$Request->{Method}</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Session-%3E%7BTf539b225>$Session->{Timeout} [= $minutes]</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Request-%3E%7BT6acbcf5a>$Request->{TotalBytes}</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Session-%3EAbc5f4cea0>$Session->Abandon()</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Request-%3EBi2e1177cf>$Request->BinaryRead([$length])</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Session-%3ELocc872f91>$Session->Lock() </a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Request-%3ECled50cd44>$Request->ClientCertificate()</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Session-%3EUnc1c1024f>$Session->UnLock()</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Request-%3ECoe6d79e01>$Request->Cookies($name [,$key])</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Request-%3EFi6799fcec>$Request->FileUpload($form_field, $key)</a>
</font>
</td>
</tr>
<tr>
<td valign=top bgcolor=#005196>
<font face="lucida console" size=-1>
<font color=white><b><a href=#%24Response%20Ob5268b3d4><font color=white>$Response Object</font></a></b></font>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Request-%3EFo76659178>$Request->Form($name)</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3E%7B4a870234>$Response->{BinaryRef}</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Request-%3EPa455879ca>$Request->Params($name)</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3E%7Ba1012197>$Response->{Buffer}</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Request-%3EQu7330a0a3>$Request->QueryString($name)</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3E%7B5be79ef4>$Response->{CacheControl}</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Request-%3ESe3a73f873>$Request->ServerVariables($name)</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3E%7Bad3d9995>$Response->{Charset}</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3E%7Bd81fcef3>$Response->{Clean} = 0-9;</a>
</font>
</td>
<td valign=top bgcolor=#005196>
<font face="lucida console" size=-1>
<font color=white><b><a href=#%24Application971dfe6c><font color=white>$Application Object</font></a></b></font>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3E%7Bc7488fa7>$Response->{ContentType} = "text/html"</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Application7d01ce04>$Application->Lock()</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3E%7Bbbff130a>$Response->{Debug} = 1|0</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Application2899ee54>$Application->UnLock()</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3E%7Bf2954302>$Response->{Expires} = $time</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Applicationaeaabc29>$Application->GetSession($sess_id)</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3E%7B0a525d33>$Response->{ExpiresAbsolute} = $date</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Application7441b337>$Application->SessionCount()</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3E%7Bf2167225>$Response->{FormFill} = 0|1</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3E%7Bf284792c>$Response->{IsClientConnected}</a>
</font>
</td>
<td valign=top bgcolor=#005196>
<font face="lucida console" size=-1>
<font color=white><b><a href=#%24Server%20Objeed08cf85><font color=white>$Server Object</font></a></b></font>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3E%7Bc48a3e9e>$Response->{PICS}</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Server-%3E%7BSc74a89b4a>$Server->{ScriptTimeout} = $seconds</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3E%7B7098f2f6>$Response->{Status} = $status</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Server-%3ECon7d9785f8>$Server->Config($setting)</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3EA8c17d8af>$Response->AddHeader($name, $value)</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Server-%3ECre0144679e>$Server->CreateObject($program_id)</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3EA1b47bb43>$Response->AppendToLog($message)</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Server-%3EExec0fa247a>$Server->Execute($file, @args)</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3EB202b8013>$Response->BinaryWrite($data)</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Server-%3EFileaa99842>$Server->File()</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3EC08958c05>$Response->Clear()</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Server-%3EGetb3d1ac42>$Server->GetLastError()</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3ECd77d06d7>$Response->Cookies($name, [$key,] $value)</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Server-%3EHTMb165f10b>$Server->HTMLEncode( $string || \$string )</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3EDe321f073>$Response->Debug(@args)</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Server-%3EMapd3711f06>$Server->MapInclude($include)</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3EE295b6523>$Response->End()</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Server-%3EMap0fe1ebb5>$Server->MapPath($url);</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3EE0139cee1>$Response->ErrorDocument($code, $uri)</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Server-%3EMai03cc9918>$Server->Mail(\%mail, %smtp_args);</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3EF8d6e0efc>$Response->Flush()</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Server-%3EReg38562b5d>$Server->RegisterCleanup($sub) </a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3EI2a8df2f3>$Response->Include($filename, @args)</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Server-%3ETra98c592dc>$Server->Transfer($file, @args)</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3EIa3beea1e>$Response->Include(\%cache_args, @sub_args) *CACHE API*</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Server-%3EURL3674cef0>$Server->URLEncode($string)</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3EI368566a8>$Response->Include(\$script_text, @args)</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Server-%3EURL6c8bf743>$Server->URL($url, \%params) </a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3EIbe084bb0>$Response->IsClientConnected()</a>
</font>
</td>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Server-%3EXSL7df794aa>$Server->XSLT(\$xsl_data, \$xml_data)</a>
</font>
</td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3ER0203b227>$Response->Redirect($url)</a>
</font>
</td>
<td> </td>
</tr>
<tr>
<td valign=top >
<font face="lucida console" size=-1>
<a href=#%24Response-%3ET13ecbe6d>$Response->TrapInclude($file, @args)</a>
</font>
</td>
<td> </td>
</tr>
</table>
<hr size=1>
<p>
<p>
<a name=%24Session%20Obj517fb3b8></a>
<font face=verdana><font class=title size=+0 color=#555555><b>$Session Object</b></font>
<font face="courier new" size=3><pre>
</pre></font>The $Session object keeps track of user and web client state, in
a persistent manner, making it relatively easy to develop web
applications. The $Session state is stored across HTTP connections,
in database files in the Global or StateDir directories, and will
persist across web server restarts.
<font face="courier new" size=3><pre>
</pre></font>The user session is referenced by a 128 bit / 32 byte MD5 hex hashed cookie,
and can be considered secure from session id guessing, or session hijacking.
When a hacker fails to guess a session, the system times out for a
second, and with 2**128 (3.4e38) keys to guess, a hacker will not be
guessing an id any time soon.
<font face="courier new" size=3><pre>
</pre></font>If an incoming cookie matches a timed out or non-existent session,
a new session is created with the incoming id. If the id matches a
currently active session, the session is tied to it and returned.
This is also similar to the Microsoft ASP implementation.
<font face="courier new" size=3><pre>
</pre></font>The $Session reference is a hash ref, and can be used as such to
store data as in:
<font face="courier new" size=3><pre>
$Session->{count}++; # increment count by one
%{$Session} = (); # clear $Session data
</pre></font>The $Session object state is implemented through MLDBM,
and a user should be aware of the limitations of MLDBM.
Basically, you can read complex structures, but not write
them, directly:
<font face="courier new" size=3><pre>
$data = $Session->{complex}{data}; # Read ok.
$Session->{complex}{data} = $data; # Write NOT ok.
$Session->{complex} = {data => $data}; # Write ok, all at once.
</pre></font>Please see MLDBM for more information on this topic.
$Session can also be used for the following methods and properties:</font>
<p>
<a name=%24Session-%3E%7BCa919a318></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Session->{CodePage}</b></font>
<font face="courier new" size=3><pre>
</pre></font>Not implemented. May never be until someone needs it.</font>
<p>
<a name=%24Session-%3E%7BL2343b3bf></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Session->{LCID}</b></font>
<font face="courier new" size=3><pre>
</pre></font>Not implemented. May never be until someone needs it.</font>
<p>
<a name=%24Session-%3E%7BS1049f4e8></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Session->{SessionID}</b></font>
<font face="courier new" size=3><pre>
</pre></font>SessionID property, returns the id for the current session,
which is exchanged between the client and the server as a cookie.</font>
<p>
<a name=%24Session-%3E%7BTf539b225></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Session->{Timeout} [= $minutes]</b></font>
<font face="courier new" size=3><pre>
</pre></font>Timeout property, if minutes is being assigned, sets this
default timeout for the user session, else returns
the current session timeout.
<font face="courier new" size=3><pre>
</pre></font>If a user session is inactive for the full
timeout, the session is destroyed by the system.
No one can access the session after it times out, and the system
garbage collects it eventually.</font>
<p>
<a name=%24Session-%3EAbc5f4cea0></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Session->Abandon()</b></font>
<font face="courier new" size=3><pre>
</pre></font>The abandon method times out the session immediately. All Session
data is cleared in the process, just as when any session times out.</font>
<p>
<a name=%24Session-%3ELocc872f91></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Session->Lock() </b></font>
<font face="courier new" size=3><pre>
</pre></font>API extension. If you are about to use $Session for many consecutive
reads or writes, you can improve performance by explicitly locking
$Session, and then unlocking, like:
<font face="courier new" size=3><pre>
$Session->Lock();
$Session->{count}++;
$Session->{count}++;
$Session->{count}++;
$Session->UnLock();
</pre></font>This sequence causes $Session to be locked and unlocked only
1 time, instead of the 6 times that it would be locked otherwise,
2 for each increment with one to read and one to write.
<font face="courier new" size=3><pre>
</pre></font>Because of flushing issues with SDBM_File and DB_File databases,
each lock actually ties fresh to the database, so the performance
savings here can be considerable.
<font face="courier new" size=3><pre>
</pre></font>Note that if you have SessionSerialize set, $Session is
already locked for each script invocation automatically, as if
you had called $Session->Lock() in Script_OnStart. Thus you
do not need to worry about $Session locking for performance.
Please read the section on SessionSerialize for more info.</font>
<p>
<a name=%24Session-%3EUnc1c1024f></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Session->UnLock()</b></font>
<font face="courier new" size=3><pre>
</pre></font>API Extension. Unlocks the $Session explicitly. If you do not call this,
$Session will be unlocked automatically at the end of the
script.</font>
<p>
<a name=%24Response%20Ob5268b3d4></a>
<font face=verdana><font class=title size=+0 color=#555555><b>$Response Object</b></font>
<font face="courier new" size=3><pre>
</pre></font>This object manages the output from the ASP Application and the
client web browser. It does not store state information like the
$Session object but does have a wide array of methods to call.</font>
<p>
<a name=%24Response-%3E%7B4a870234></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->{BinaryRef}</b></font>
<font face="courier new" size=3><pre>
</pre></font>API extension. This is a perl reference to the buffered output of
the $Response object, and can be used in the Script_OnFlush
global.asa event to modify the buffered output at runtime
to apply global changes to scripts output without having to
modify all the scripts. These changes take place before
content is flushed to the client web browser.
<font face="courier new" size=3><pre>
sub Script_OnFlush {
my $ref = $Response->{BinaryRef};
$$ref =~ s/\s+/ /sg; # to strip extra white space
}
</pre></font>Check out the <a href=eg/global.asa>./site/eg/global.asa</a> for an example of its use.</font>
<p>
<a name=%24Response-%3E%7Ba1012197></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->{Buffer}</b></font>
<font face="courier new" size=3><pre>
</pre></font>Default 1, when TRUE sends output from script to client only at
the end of processing the script. When 0, response is not buffered,
and client is sent output as output is generated by the script.</font>
<p>
<a name=%24Response-%3E%7B5be79ef4></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->{CacheControl}</b></font>
<font face="courier new" size=3><pre>
</pre></font>Default "private", when set to public allows proxy servers to
cache the content. This setting controls the value set
in the HTTP header Cache-Control</font>
<p>
<a name=%24Response-%3E%7Bad3d9995></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->{Charset}</b></font>
<font face="courier new" size=3><pre>
</pre></font>This member when set appends itself to the value of the Content-Type
HTTP header. If $Response->{Charset} = 'ISO-LATIN-1' is set, the
corresponding header would look like:
<font face="courier new" size=3><pre>
Content-Type: text/html; charset=ISO-LATIN-1
</pre></font>
<p>
<a name=%24Response-%3E%7Bd81fcef3></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->{Clean} = 0-9;</b></font>
<font face="courier new" size=3><pre>
</pre></font>API extension. Set the Clean level, default 0, on a per script basis.
Clean of 1-9 compresses text/html output. Please see
the Clean config option for more information. This setting may
also be useful even if using compression to obfuscate HTML.</font>
<p>
<a name=%24Response-%3E%7Bc7488fa7></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->{ContentType} = "text/html"</b></font>
<font face="courier new" size=3><pre>
</pre></font>Sets the MIME type for the current response being sent to the client.
Sent as an HTTP header.</font>
<p>
<a name=%24Response-%3E%7Bbbff130a></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->{Debug} = 1|0</b></font>
<font face="courier new" size=3><pre>
</pre></font>API extension. Default set to value of Debug config. May be
used to temporarily activate or inactivate $Response->Debug()
behavior. Something like:
<font face="courier new" size=3><pre>
{
local $Response->{Debug} = 1;
$Response->Debug($values);
}
</pre></font>maybe be used to always log something. The Debug()
method can be better than AppendToLog() because it will
log data in data structures one level deep, whereas
AppendToLog prints just raw string/scalar values.</font>
<p>
<a name=%24Response-%3E%7Bf2954302></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->{Expires} = $time</b></font>
<font face="courier new" size=3><pre>
</pre></font>Sends a response header to the client indicating the $time
in SECONDS in which the document should expire. A time of 0 means
immediate expiration. The header generated is a standard
HTTP date like: "Wed, 09 Feb 1994 22:23:32 GMT".</font>
<p>
<a name=%24Response-%3E%7B0a525d33></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->{ExpiresAbsolute} = $date</b></font>
<font face="courier new" size=3><pre>
</pre></font>Sends a response header to the client with $date being an absolute
time to expire. Formats accepted are all those accepted by
HTTP::Date::str2time(), e.g.
<font face="courier new" size=3><pre>
"Wed, 09 Feb 1994 22:23:32 GMT" -- HTTP format
"Tuesday, 08-Feb-94 14:15:29 GMT" -- old rfc850 HTTP format
"08-Feb-94" -- old rfc850 HTTP format
"09 Feb 1994" -- proposed new HTTP format
"Feb 3 1994" -- Unix 'ls -l' format
"Feb 3 17:03" -- Unix 'ls -l' format
</pre></font>
<p>
<a name=%24Response-%3E%7Bf2167225></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->{FormFill} = 0|1</b></font>
<font face="courier new" size=3><pre>
</pre></font>If true, HTML forms generated by the script output will
be auto filled with data from $Request->Form. This feature
requires HTML::FillInForm to be installed. Please see
the FormFill <a href=config.html><font size=-1 face=verdana><b>CONFIG</b></font></a> for more information.
<font face="courier new" size=3><pre>
</pre></font>This setting overrides the FormFill config at runtime
for the script execution only.</font>
<p>
<a name=%24Response-%3E%7Bf284792c></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->{IsClientConnected}</b></font>
<font face="courier new" size=3><pre>
</pre></font>1 if web client is connected, 0 if not. This value
starts set to 1, and will be updated whenever a
$Response->Flush() is called. If BufferingOn is
set, by default $Response->Flush() will only be
called at the end of the HTML output.
<font face="courier new" size=3><pre>
</pre></font>As of version 2.23 this value is updated correctly
before global.asa Script_OnStart is called, so
global script termination may be correctly handled
during that event, which one might want to do
with excessive user STOP/RELOADS when the web
server is very busy.
<font face="courier new" size=3><pre>
</pre></font>An API extension $Response->IsClientConnected
may be called for refreshed connection status
without calling first a $Response->Flush</font>
<p>
<a name=%24Response-%3E%7Bc48a3e9e></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->{PICS}</b></font>
<font face="courier new" size=3><pre>
</pre></font>If this property has been set, a PICS-Label HTTP header will be
sent with its value. For those that do not know, PICS is a header
that is useful in rating the internet. It stands for
Platform for Internet Content Selection, and you can find more
info about it at: <a href=http://www.w3.org>http://www.w3.org</a></font>
<p>
<a name=%24Response-%3E%7B7098f2f6></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->{Status} = $status</b></font>
<font face="courier new" size=3><pre>
</pre></font>Sets the status code returned by the server. Can be used to
set messages like 500, internal server error</font>
<p>
<a name=%24Response-%3EA8c17d8af></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->AddHeader($name, $value)</b></font>
<font face="courier new" size=3><pre>
</pre></font>Adds a custom header to a web page. Headers are sent only before any
text from the main page is sent, so if you want to set a header
after some text on a page, you must turn BufferingOn.</font>
<p>
<a name=%24Response-%3EA1b47bb43></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->AppendToLog($message)</b></font>
<font face="courier new" size=3><pre>
</pre></font>Adds $message to the server log. Useful for debugging.</font>
<p>
<a name=%24Response-%3EB202b8013></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->BinaryWrite($data)</b></font>
<font face="courier new" size=3><pre>
</pre></font>Writes binary data to the client. The only
difference from $Response->Write() is that $Response->Flush()
is called internally first, so the data cannot be parsed
as an html header. Flushing flushes the header if has not
already been written.
<font face="courier new" size=3><pre>
</pre></font>If you have set the $Response->{ContentType}
to something other than text/html, cgi header parsing (see <a href=cgi.html><font size=-1 face=verdana><b>CGI</b></font></a>
notes), will be automatically be turned off, so you will not
necessarily need to use BinaryWrite for writing binary data.
<font face="courier new" size=3><pre>
</pre></font>For an example of BinaryWrite, see the binary_write.htm example
in <a href=eg/binary_write.htm>./site/eg/binary_write.htm</a>
<font face="courier new" size=3><pre>
</pre></font>Please note that if you are on Win32, you will need to
call binmode on a file handle before reading, if
its data is binary.</font>
<p>
<a name=%24Response-%3EC08958c05></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->Clear()</b></font>
<font face="courier new" size=3><pre>
</pre></font>Erases buffered ASP output.</font>
<p>
<a name=%24Response-%3ECd77d06d7></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->Cookies($name, [$key,] $value)</b></font>
<font face="courier new" size=3><pre>
</pre></font>Sets the key or attribute of cookie with name $name to the value $value.
If $key is not defined, the Value of the cookie is set.
ASP CookiePath is assumed to be / in these examples.
<font face="courier new" size=3><pre>
$Response->Cookies('name', 'value');
--> Set-Cookie: name=value; path=/
$Response->Cookies("Test", "data1", "test value");
$Response->Cookies("Test", "data2", "more test");
$Response->Cookies(
"Test", "Expires",
&HTTP::Date::time2str(time+86400)
);
$Response->Cookies("Test", "Secure", 1);
$Response->Cookies("Test", "Path", "/");
$Response->Cookies("Test", "Domain", "host.com");
--> Set-Cookie:Test=data1=test%20value&data2=more%20test; \
expires=Fri, 23 Apr 1999 07:19:52 GMT; \
path=/; domain=host.com; secure
</pre></font>The latter use of $key in the cookies not only sets cookie attributes
such as Expires, but also treats the cookie as a hash of key value pairs
which can later be accesses by
<font face="courier new" size=3><pre>
$Request->Cookies('Test', 'data1');
$Request->Cookies('Test', 'data2');
</pre></font>Because this is perl, you can (NOT PORTABLE) reference the cookies
directly through hash notation. The same 5 commands above could be compressed to:
<font face="courier new" size=3><pre>
$Response->{Cookies}{Test} =
{
Secure => 1,
Value =>
{
data1 => 'test value',
data2 => 'more test'
},
Expires => 86400, # not portable, see above
Domain => 'host.com',
Path => '/'
};
</pre></font>and the first command would be:
<font face="courier new" size=3><pre>
# you don't need to use hash notation when you are only setting
# a simple value
$Response->{Cookies}{'Test Name'} = 'Test Value';
</pre></font>I prefer the hash notation for cookies, as this looks nice, and is
quite perlish. It is here to stay. The Cookie() routine is
very complex and does its best to allow access to the
underlying hash structure of the data. This is the best emulation
I could write trying to match the Collections functionality of
cookies in IIS ASP.
<font face="courier new" size=3><pre>
</pre></font>For more information on Cookies, please go to the source at
<a href=http://home.netscape.com/newsref/std/cookie_spec.html>http://home.netscape.com/newsref/std/cookie_spec.html</a></font>
<p>
<a name=%24Response-%3EDe321f073></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->Debug(@args)</b></font>
<font face="courier new" size=3><pre>
</pre></font>API Extension. If the Debug config option is set greater than 0,
this routine will write @args out to server error log. refs in @args
will be expanded one level deep, so data in simple data structures
like one-level hash refs and array refs will be displayed. CODE
refs like
<font face="courier new" size=3><pre>
$Response->Debug(sub { "some value" });
</pre></font>will be executed and their output added to the debug output.
This extension allows the user to tie directly into the
debugging capabilities of this module.
<font face="courier new" size=3><pre>
</pre></font>While developing an app on a production server, it is often
useful to have a separate error log for the application
to catch debugging output separately. One way of implementing
this is to use the Apache ErrorLog configuration directive to
create a separate error log for a virtual host.
<font face="courier new" size=3><pre>
</pre></font>If you want further debugging support, like stack traces
in your code, consider doing things like:
<font face="courier new" size=3><pre>
$Response->Debug( sub { Carp::longmess('debug trace') };
$SIG{__WARN__} = \&Carp::cluck; # then warn() will stack trace
</pre></font>The only way at present to see exactly where in your script
an error occurred is to set the Debug config directive to 2,
and match the error line number to perl script generated
from your ASP script.
<font face="courier new" size=3><pre>
</pre></font>However, as of version 0.10, the perl script generated from the
asp script should match almost exactly line by line, except in
cases of inlined includes, which add to the text of the original script,
pod comments which are entirely yanked out, and <% # comment %> style
comments which have a \n added to them so they still work.
<font face="courier new" size=3><pre>
</pre></font>If you would like to see the HTML preceding an error
while developing, consider setting the BufferingOn
config directive to 0.</font>
<p>
<a name=%24Response-%3EE295b6523></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->End()</b></font>
<font face="courier new" size=3><pre>
</pre></font>Sends result to client, and immediately exits script.
Automatically called at end of script, if not already called.</font>
<p>
<a name=%24Response-%3EE0139cee1></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->ErrorDocument($code, $uri)</b></font>
<font face="courier new" size=3><pre>
</pre></font>API extension that allows for the modification the Apache
ErrorDocument at runtime. $uri may be a on site document,
off site URL, or string containing the error message.
<font face="courier new" size=3><pre>
</pre></font>This extension is useful if you want to have scripts
set error codes with $Response->{Status} like 401
for authentication failure, and to then control from
the script what the error message looks like.
<font face="courier new" size=3><pre>
</pre></font>For more information on the Apache ErrorDocument mechanism,
please see ErrorDocument in the CORE Apache settings,
and the Apache->custom_response() API, for which this method
is a wrapper.</font>
<p>
<a name=%24Response-%3EF8d6e0efc></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->Flush()</b></font>
<font face="courier new" size=3><pre>
</pre></font>Sends buffered output to client and clears buffer.</font>
<p>
<a name=%24Response-%3EI2a8df2f3></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->Include($filename, @args)</b></font>
<font face="courier new" size=3><pre>
</pre></font>This API extension calls the routine compiled from asp script
in $filename with the args @args. This is a direct translation
of the <a href=ssi.html><font size=-1 face=verdana><b>SSI</b></font></a> tag
<font face="courier new" size=3><pre>
<!--#include file=$filename args=@args-->
</pre></font>Please see the SSI section for more on SSI in general.
<font face="courier new" size=3><pre>
</pre></font>This API extension was created to allow greater modularization
of code by allowing includes to be called with runtime
arguments. Files included are compiled once, and the
anonymous code ref from that compilation is cached, thus
including a file in this manner is just like calling a
perl subroutine. The @args can be found in @_ in the
includes like:
<font face="courier new" size=3><pre>
# include.inc
<% my @args = @_; %>
</pre></font>As of 2.23, multiple return values can be returned from
an include like:
<font face="courier new" size=3><pre>
my @rv = $Response->Include($filename, @args);
</pre></font>
<p>
<a name=%24Response-%3EIa3beea1e></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->Include(\%cache_args, @sub_args) *CACHE API*</b></font>
<font face="courier new" size=3><pre>
</pre></font>As of version 2.23, output from an include may be
cached with this API and the <a href=config.html><font size=-1 face=verdana><b>CONFIG</b></font></a> settings CacheDir & CacheDB. This
can be used to execute expensive includes only rarely
where applicable, drastically increasing performance in
some cases.
<font face="courier new" size=3><pre>
</pre></font>This API extension applies to the entire include family:
<font face="courier new" size=3><pre>
my @rv = $Response->Include(\%cache_args, @include_args)
my $html_ref = $Response->TrapInclude(\%cache_args, @include_args)
$Server->Execute(\%cache_args, @include_args)
</pre></font>For this output cache to work, you must load Apache::ASP
in the Apache parent httpd like so:
<font face="courier new" size=3><pre>
# httpd.conf
PerlModule Apache::ASP
</pre></font>The cache arguments are shown here
<font face="courier new" size=3><pre>
$Response->Include({
File => 'file.inc',
Cache => 1, # to activate cache layer
Expires => 3600, # to expire in one hour
LastModified => time() - 600, # to expire if cached before 10 minutes ago
Key => $Request->Form, # to cache based on checksum of serialized form data,
Clear => 1, # always executes include & cache output
}, @include_args);
File - include file to execute, can be file name or \$script
script data passed in as a string reference.
Cache - activate caching, will run like normal include without this
Expires - only cache for this long in seconds
LastModified - if cached before this time(), expire
Key - The cache item identity. Can be $data, \$data, \%data, \@data,
this data is serialized and combined with the filename & @include_args
to create a MD5 checksum to fetch from the cache with. If you wanted
to cache the results of a search page from form data POSTed,
then this key could be
{ Key => $Request->Form }
Clear - If set to 1, or boolean true, will always execute the include
and update the cache entry for it.
</pre></font>Motivation: If an include takes 1 second to execute
because of complex SQL to a database, and you can
cache the output of this include because it is not realtime data,
and the cache layer runs at .01 seconds, then you have a
100 fold savings on that part of the script. Site scalability
can be dramatically increased in this way by intelligently
caching bottlenecks in the web application.
<font face="courier new" size=3><pre>
</pre></font>Use Sparingly: If you have a fast include, then it may execute faster
than the cache layer runs, in which case you may actually
slow your site down by using this feature. Therefore
try to use this sparingly, and only when sure you really
need it. Apache::ASP scripts generally execute very
quickly, so most developers will not need to use this feature
at all.</font>
<p>
<a name=%24Response-%3EI368566a8></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->Include(\$script_text, @args)</b></font>
<font face="courier new" size=3><pre>
</pre></font>Added in Apache::ASP 2.11, this method allows for executing ASP scripts
that are generated dynamically by passing in a reference to the script
data instead of the file name. This works just like the normal
$Response->Include() API, except a string reference is passed in
instead of a filename. For example:
<font face="courier new" size=3><pre>
<%
my $script = "<\% print 'TEST'; %\>";
$Response->Include(\$script);
%>
</pre></font>This include would output TEST. Note that tokens like
<% and %> must be escaped so Apache::ASP does not try
to compile those code blocks directly when compiling
the original script. If the $script data were fetched
directly from some external resource like a database,
then these tokens would not need to be escaped at all as in:
<font face="courier new" size=3><pre>
<%
my $script = $dbh->selectrow_array(
"select script_text from scripts where script_id = ?",
undef, $script_id
);
$Response->Include(\$script);
%>
</pre></font>This method could also be used to render other types of dynamic scripts,
like XML docs using XMLSubs for example, though for complex
runtime XML rendering, one should use something better suited like XSLT.
See the $Server->XSLT API for more on this topic.</font>
<p>
<a name=%24Response-%3EIbe084bb0></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->IsClientConnected()</b></font>
<font face="courier new" size=3><pre>
</pre></font>API Extension. 1 for web client still connected, 0 if
disconnected which might happen if the user hits the stop button.
The original API for this $Response->{IsClientConnected}
is only updated after a $Response->Flush is called,
so this method may be called for a refreshed status.
<font face="courier new" size=3><pre>
</pre></font>Note $Response->Flush calls $Response->IsClientConnected
to update $Response->{IsClientConnected} so to use this
you are going straight to the source! But if you are doing
a loop like:
<font face="courier new" size=3><pre>
while(@data) {
$Response->End if ! $Response->{IsClientConnected};
my $row = shift @data;
%> <%= $row %> <%
$Response->Flush;
}
</pre></font>Then its more efficient to use the member instead of
the method since $Response->Flush() has already updated
that value for you.</font>
<p>
<a name=%24Response-%3ER0203b227></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->Redirect($url)</b></font>
<font face="courier new" size=3><pre>
</pre></font>Sends the client a command to go to a different url $url.
Script immediately ends.</font>
<p>
<a name=%24Response-%3ET13ecbe6d></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->TrapInclude($file, @args)</b></font>
<font face="courier new" size=3><pre>
</pre></font>Calls $Response->Include() with same arguments as
passed to it, but instead traps the include output buffer
and returns it as as a perl string reference. This allows
one to postprocess the output buffer before sending
to the client.
<font face="courier new" size=3><pre>
my $string_ref = $Response->TrapInclude('file.inc');
$$string_ref =~ s/\s+/ /sg; # squash whitespace like Clean 1
print $$string_ref;
</pre></font>The data is returned as a referenece to save on what
might be a large string copy. You may dereference the data
with the $$string_ref notation.</font>
<p>
<a name=%24Response-%3EW0307fe16></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Response->Write($data)</b></font>
<font face="courier new" size=3><pre>
</pre></font>Write output to the HTML page. <%=$data%> syntax is shorthand for
a $Response->Write($data). All final output to the client must at
some point go through this method.</font>
<p>
<a name=%24Request%20Objc3cab62e></a>
<font face=verdana><font class=title size=+0 color=#555555><b>$Request Object</b></font>
<font face="courier new" size=3><pre>
</pre></font>The request object manages the input from the client browser, like
posts, query strings, cookies, etc. Normal return results are values
if an index is specified, or a collection / perl hash ref if no index
is specified. WARNING, the latter property is not supported in
ActiveState <a href=http://www.activestate.com/ActivePerl/><font size=-1 face=verdana><b>PerlScript</b></font></a>, so if you use the hashes returned by such
a technique, it will not be portable.
<font face="courier new" size=3><pre>
</pre></font>A normal use of this feature would be to iterate through the
form variables in the form hash...
<font face="courier new" size=3><pre>
$form = $Request->Form();
for(keys %{$form}) {
$Response->Write("$_: $form->{$_}<br>\n");
}
</pre></font>Please see the <a href=eg/server_variables.htm>./site/eg/server_variables.htm</a> asp file for this
method in action.
<font face="courier new" size=3><pre>
</pre></font>Note that if a form POST or query string contains duplicate
values for a key, those values will be returned through
normal use of the $Request object:
<font face="courier new" size=3><pre>
@values = $Request->Form('key');
</pre></font>but you can also access the internal storage, which is
an array reference like so:
<font face="courier new" size=3><pre>
$array_ref = $Request->{Form}{'key'};
@values = @{$array_ref};
</pre></font>Please read the <a href=perlscript.html><font size=-1 face=verdana><b>PERLSCRIPT</b></font></a> section for more information
on how things like $Request->QueryString() & $Request->Form()
behave as collections.</font>
<p>
<a name=%24Request-%3E%7BM81641f4a></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Request->{Method}</b></font>
<font face="courier new" size=3><pre>
</pre></font>API extension. Returns the client HTTP request method, as in
GET or POST. Added in version 2.31.</font>
<p>
<a name=%24Request-%3E%7BT6acbcf5a></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Request->{TotalBytes}</b></font>
<font face="courier new" size=3><pre>
</pre></font>The amount of data sent by the client in the body of the
request, usually the length of the form data. This is
the same value as $Request->ServerVariables('CONTENT_LENGTH')</font>
<p>
<a name=%24Request-%3EBi2e1177cf></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Request->BinaryRead([$length])</b></font>
<font face="courier new" size=3><pre>
</pre></font>Returns a string whose contents are the first $length bytes
of the form data, or body, sent by the client request.
If $length is not given, will return all of the form data.
This data is the raw data sent by the client, without any
parsing done on it by Apache::ASP.
<font face="courier new" size=3><pre>
</pre></font>Note that BinaryRead will not return any data for file uploads.
Please see the $Request->FileUpload() interface for access
to this data. $Request->Form() data will also be available
as normal.</font>
<p>
<a name=%24Request-%3ECled50cd44></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Request->ClientCertificate()</b></font>
<font face="courier new" size=3><pre>
</pre></font>Not implemented.</font>
<p>
<a name=%24Request-%3ECoe6d79e01></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Request->Cookies($name [,$key])</b></font>
<font face="courier new" size=3><pre>
</pre></font>Returns the value of the Cookie with name $name. If a $key is
specified, then a lookup will be done on the cookie as if it were
a query string. So, a cookie set by:
<font face="courier new" size=3><pre>
Set-Cookie: test=data1=1&data2=2
</pre></font>would have a value of 2 returned by $Request->Cookies('test','data2').
<font face="courier new" size=3><pre>
</pre></font>If no name is specified, a hash will be returned of cookie names
as keys and cookie values as values. If the cookie value is a query string,
it will automatically be parsed, and the value will be a hash reference to
these values.
<font face="courier new" size=3><pre>
</pre></font>When in doubt, try it out. Remember that unless you set the Expires
attribute of a cookie with $Response->Cookies('cookie', 'Expires', $xyz),
the cookies that you set will only last until you close your browser,
so you may find your self opening & closing your browser a lot when
debugging cookies.
<font face="courier new" size=3><pre>
</pre></font>For more information on cookies in ASP, please read $Response->Cookies()</font>
<p>
<a name=%24Request-%3EFi6799fcec></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Request->FileUpload($form_field, $key)</b></font>
<font face="courier new" size=3><pre>
</pre></font>API extension. The FileUpload interface to file upload data is
stabilized. The internal representation of the file uploads
is a hash of hashes, one hash per file upload found in
the $Request->Form() collection. This collection of collections
may be queried through the normal interface like so:
<font face="courier new" size=3><pre>
$Request->FileUpload('upload_file', 'ContentType');
$Request->FileUpload('upload_file', 'FileHandle');
$Request->FileUpload('upload_file', 'BrowserFile');
$Request->FileUpload('upload_file', 'Mime-Header');
$Request->FileUpload('upload_file', 'TempFile');
* note that TempFile must be use with the UploadTempFile
configuration setting.
</pre></font>The above represents the old slow collection interface,
but like all collections in Apache::ASP, you can reference
the internal hash representation more easily.
<font face="courier new" size=3><pre>
my $fileup = $Request->{FileUpload}{upload_file};
$fileup->{ContentType};
$fileup->{BrowserFile};
$fileup->{FileHandle};
$fileup->{Mime-Header};
$fileup->{TempFile};
</pre></font>
<p>
<a name=%24Request-%3EFo76659178></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Request->Form($name)</b></font>
<font face="courier new" size=3><pre>
</pre></font>Returns the value of the input of name $name used in a form
with POST method. If $name is not specified, returns a ref to
a hash of all the form data. One can use this hash to
create a nice alias to the form data like:
<font face="courier new" size=3><pre>
# in global.asa
use vars qw( $Form );
sub Script_OnStart {
$Form = $Request->Form;
}
# then in ASP scripts
<%= $Form->{var} %>
</pre></font>File upload data will be loaded into $Request->Form('file_field'),
where the value is the actual file name of the file uploaded, and
the contents of the file can be found by reading from the file
name as a file handle as in:
<font face="courier new" size=3><pre>
while(read($Request->Form('file_field_name'), $data, 1024)) {};
</pre></font>For more information, please see the <a href=cgi.html><font size=-1 face=verdana><b>CGI</b></font></a> / File Upload section,
as file uploads are implemented via the <a href=http://stein.cshl.org/WWW/software/CGI/cgi_docs.html><font size=-1 face=verdana><b>CGI.pm</b></font></a> module. An
example can be found in the installation
samples <a href=eg/file_upload.asp>./site/eg/file_upload.asp</a></font>
<p>
<a name=%24Request-%3EPa455879ca></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Request->Params($name)</b></font>
<font face="courier new" size=3><pre>
</pre></font>API extension. If RequestParams <a href=config.html><font size=-1 face=verdana><b>CONFIG</b></font></a> is set, the $Request->Params
object is created with combined contents of $Request->QueryString
and $Request->Form. This is for developer convenience simlar
to <a href=http://stein.cshl.org/WWW/software/CGI/cgi_docs.html><font size=-1 face=verdana><b>CGI.pm</b></font></a>'s param() method. Just like for $Response->Form,
one could create a nice alias like:
<font face="courier new" size=3><pre>
# in global.asa
use vars qw( $Params );
sub Script_OnStart {
$Params = $Request->Params;
}
</pre></font>
<p>
<a name=%24Request-%3EQu7330a0a3></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Request->QueryString($name)</b></font>
<font face="courier new" size=3><pre>
</pre></font>Returns the value of the input of name $name used in a form
with GET method, or passed by appending a query string to the end of
a url as in <tt>http://localhost/?data=value.</tt>
If $name is not specified, returns a ref to a hash of all the query
string data.</font>
<p>
<a name=%24Request-%3ESe3a73f873></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Request->ServerVariables($name)</b></font>
<font face="courier new" size=3><pre>
</pre></font>Returns the value of the server variable / environment variable
with name $name. If $name is not specified, returns a ref to
a hash of all the server / environment variables data. The following
would be a common use of this method:
<font face="courier new" size=3><pre>
$env = $Request->ServerVariables();
# %{$env} here would be equivalent to the cgi %ENV in perl.
</pre></font>
<p>
<a name=%24Application971dfe6c></a>
<font face=verdana><font class=title size=+0 color=#555555><b>$Application Object</b></font>
<font face="courier new" size=3><pre>
</pre></font>Like the $Session object, you may use the $Application object to
store data across the entire life of the application. Every
page in the ASP application always has access to this object.
So if you wanted to keep track of how many visitors there where
to the application during its lifetime, you might have a line
like this:
<font face="courier new" size=3><pre>
$Application->{num_users}++
</pre></font>The Lock and Unlock methods are used to prevent simultaneous
access to the $Application object.</font>
<p>
<a name=%24Application7d01ce04></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Application->Lock()</b></font>
<font face="courier new" size=3><pre>
</pre></font>Locks the Application object for the life of the script, or until
UnLock() unlocks it, whichever comes first. When $Application
is locked, this guarantees that data being read and written to it
will not suddenly change on you between the reads and the writes.
<font face="courier new" size=3><pre>
</pre></font>This and the $Session object both lock automatically upon
every read and every write to ensure data integrity. This
lock is useful for concurrent access control purposes.
<font face="courier new" size=3><pre>
</pre></font>Be careful to not be too liberal with this, as you can quickly
create application bottlenecks with its improper use.</font>
<p>
<a name=%24Application2899ee54></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Application->UnLock()</b></font>
<font face="courier new" size=3><pre>
</pre></font>Unlocks the $Application object. If already unlocked, does nothing.</font>
<p>
<a name=%24Applicationaeaabc29></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Application->GetSession($sess_id)</b></font>
<font face="courier new" size=3><pre>
</pre></font>This NON-PORTABLE API extension returns a user $Session given
a session id. This allows one to easily write a session manager if
session ids are stored in $Application during Session_OnStart, with
full access to these sessions for administrative purposes.
<font face="courier new" size=3><pre>
</pre></font>Be careful not to expose full session ids over the net, as they
could be used by a hacker to impersonate another user. So when
creating a session manager, for example, you could create
some other id to reference the SessionID internally, which
would allow you to control the sessions. This kind of application
would best be served under a secure web server.
<font face="courier new" size=3><pre>
</pre></font>The <a href=eg/global_asa_demo.asp>./site/eg/global_asa_demo.asp</a> script makes use of this routine
to display all the data in current user sessions.</font>
<p>
<a name=%24Application7441b337></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Application->SessionCount()</b></font>
<font face="courier new" size=3><pre>
</pre></font>This NON-PORTABLE method returns the current number of active sessions
in the application, and is enabled by the SessionCount configuration setting.
This method is not implemented as part of the original ASP
object model, but is implemented here because it is useful. In particular,
when accessing databases with license requirements, one can monitor usage
effectively through accessing this value.</font>
<p>
<a name=%24Server%20Objeed08cf85></a>
<font face=verdana><font class=title size=+0 color=#555555><b>$Server Object</b></font>
<font face="courier new" size=3><pre>
</pre></font>The server object is that object that handles everything the other
objects do not. The best part of the server object for Win32 users is
the CreateObject method which allows developers to create instances of
ActiveX components, like the ADO component.</font>
<p>
<a name=%24Server-%3E%7BSc74a89b4a></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Server->{ScriptTimeout} = $seconds</b></font>
<font face="courier new" size=3><pre>
</pre></font>Not implemented. May never be. Please see the
Apache Timeout configuration option, normally in httpd.conf.</font>
<p>
<a name=%24Server-%3ECon7d9785f8></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Server->Config($setting)</b></font>
<font face="courier new" size=3><pre>
</pre></font>API extension. Allows a developer to read the <a href=config.html><font size=-1 face=verdana><b>CONFIG</b></font></a>
settings, like Global, GlobalPackage, StateDir, etc.
Currently implemented as a wrapper around
<font face="courier new" size=3><pre>
Apache->dir_config($setting)
</pre></font>May also be invoked as $Server->Config(), which will
return a hash ref of all the PerlSetVar settings.</font>
<p>
<a name=%24Server-%3ECre0144679e></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Server->CreateObject($program_id)</b></font>
<font face="courier new" size=3><pre>
</pre></font>Allows use of ActiveX objects on Win32. This routine returns
a reference to an Win32::OLE object upon success, and nothing upon
failure. It is through this mechanism that a developer can
utilize ADO. The equivalent syntax in VBScript is
<font face="courier new" size=3><pre>
Set object = Server.CreateObject(program_id)
</pre></font>For further information, try 'perldoc Win32::OLE' from your
favorite command line.</font>
<p>
<a name=%24Server-%3EExec0fa247a></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Server->Execute($file, @args)</b></font>
<font face="courier new" size=3><pre>
</pre></font>New method from ASP 3.0, this does the same thing as
<font face="courier new" size=3><pre>
$Response->Include($file, @args)
</pre></font>and internally is just a wrapper for such. Seems like we
had this important functionality before the IIS/ASP camp!</font>
<p>
<a name=%24Server-%3EFileaa99842></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Server->File()</b></font>
<font face="courier new" size=3><pre>
</pre></font>Returns the absolute file path to current executing script.
Same as Apache->request->filename when running under <a href=http://perl.apache.org><font size=-1 face=verdana><b>mod_perl</b></font></a>.
<font face="courier new" size=3><pre>
</pre></font>ASP API extension.</font>
<p>
<a name=%24Server-%3EGetb3d1ac42></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Server->GetLastError()</b></font>
<font face="courier new" size=3><pre>
</pre></font>Not implemented, will likely not ever be because this is dependent
on how IIS handles errors and is not relevant in Apache.</font>
<p>
<a name=%24Server-%3EHTMb165f10b></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Server->HTMLEncode( $string || \$string )</b></font>
<font face="courier new" size=3><pre>
</pre></font>Returns an HTML escapes version of $string. &, ", >, <, are each
escapes with their HTML equivalents. Strings encoded in this nature
should be raw text displayed to an end user, as HTML tags become
escaped with this method.
<font face="courier new" size=3><pre>
</pre></font>As of version 2.23, $Server->HTMLEncode() may take a string reference
for an optmization when encoding a large buffer as an API extension.
Here is how one might use one over the other:
<font face="courier new" size=3><pre>
my $buffer = '&' x 100000;
$buffer = $Server->HTMLEncode($buffer);
print $buffer;
- or -
my $buffer = '&' x 100000;
$Server->HTMLEncode(\$buffer);
print $buffer;
</pre></font>Using the reference passing method in benchmarks on 100K of
data was 5% more efficient, but maybe useful for some.
It saves on copying the 100K buffer twice.</font>
<p>
<a name=%24Server-%3EMapd3711f06></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Server->MapInclude($include)</b></font>
<font face="courier new" size=3><pre>
</pre></font>API extension. Given the include $include, as an absolute or relative file name to the current
executing script, this method returns the file path that the include would
be found from the include search path. The include search path is the
current script directory, Global, and IncludesDir directories.
<font face="courier new" size=3><pre>
</pre></font>If the include is not found in the includes search path, then undef, or bool false,
is returned. So one may do something like this:
<font face="courier new" size=3><pre>
if($Server->MapInclude('include.inc')) {
$Response->Include('include.inc');
}
</pre></font>This code demonstrates how one might only try to execute an include if
it exists, which is useful since a script will error if it tries to execute an include
that does not exist.</font>
<p>
<a name=%24Server-%3EMap0fe1ebb5></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Server->MapPath($url);</b></font>
<font face="courier new" size=3><pre>
</pre></font>Given the url $url, absolute, or relative to the current executing script,
this method returns the equivalent filename that the server would
translate the request to, regardless or whether the request would be valid.
<font face="courier new" size=3><pre>
</pre></font>Only a $url that is relative to the host is valid. Urls like "." and
"/" are fine arguments to MapPath, but <tt>http://localhost</tt> would not be.
<font face="courier new" size=3><pre>
</pre></font>To see this method call in action, check out the sample <a href=eg/server.htm>./site/eg/server.htm</a>
script.</font>
<p>
<a name=%24Server-%3EMai03cc9918></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Server->Mail(\%mail, %smtp_args);</b></font>
<font face="courier new" size=3><pre>
</pre></font>With the Net::SMTP and Net::Config modules installed, which are part of the
perl libnet package, you may use this API extension to send email. The
\%mail hash reference that you pass in must have values for at least
the To, From, and Subject headers, and the Body of the mail message.
<font face="courier new" size=3><pre>
</pre></font>The return value of this routine is 1 for success, 0 for failure. If the MailHost
SMTP server is not available, this will have a return value of 0.
<font face="courier new" size=3><pre>
</pre></font>You could send an email like so:
<font face="courier new" size=3><pre>
$Server->Mail({
To => '<b>somebody@yourdomain.com.foobar</b>',
From => '<b>youremail@yourdomain.com.foobar</b>',
Subject => 'Subject of Email',
Body =>
'Body of message. '.
'You might have a lot to say here!',
Organization => 'Your Organization',
CC => '<b>youremailcc@yourdomain.com.foobar</b>',
BCC => '<b>youremailbcc@yourdomain.com.foobar</b>',
Debug => 0 || 1,
});
</pre></font>Any extra fields specified for the email will be interpreted
as headers for the email, so to send an HTML email, you
could set 'Content-Type' => 'text/html' in the above example.
<font face="courier new" size=3><pre>
</pre></font>If you have MailFrom configured, this will be the default
for the From header in your email. For more configuration
options like the MailHost setting, check out the <a href=config.html><font size=-1 face=verdana><b>CONFIG</b></font></a> section.
<font face="courier new" size=3><pre>
</pre></font>The return value of this method call will be boolean for
success of the mail being sent.
<font face="courier new" size=3><pre>
</pre></font>If you would like to specially configure the Net::SMTP
object used internally, you may set %smtp_args and they
will be passed on when that object is initialized.
"perldoc Net::SMTP" for more into on this topic.
<font face="courier new" size=3><pre>
</pre></font>If you would like to include the output of an ASP page as the
body of the mail message, you might do something like:
<font face="courier new" size=3><pre>
my $mail_body = $Response->TrapInclude('mail_body.inc');
$Server->Mail({ %mail, Body => $$mail_body });
</pre></font>
<p>
<a name=%24Server-%3EReg38562b5d></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Server->RegisterCleanup($sub) </b></font>
<font face="courier new" size=3><pre>
non-portable extension
</pre></font>Sets a subroutine reference to be executed after the script ends,
whether normally or abnormally, the latter occurring
possibly by the user hitting the STOP button, or the web server
being killed. This subroutine must be a code reference
created like:
<font face="courier new" size=3><pre>
$Server->RegisterCleanup(sub { $main::Session->{served}++; });
or
sub served { $main::Session->{served}++; }
$Server->RegisterCleanup(\&served);
</pre></font>The reference to the subroutine passed in will be executed.
Though the subroutine will be executed in anonymous context,
instead of the script, all objects will still be defined
in main::*, that you would reference normally in your script.
Output written to $main::Response will have no affect at
this stage, as the request to the www client has already completed.
<font face="courier new" size=3><pre>
</pre></font>Check out the <a href=eg/register_cleanup.asp>./site/eg/register_cleanup.asp</a> script for an example
of this routine in action.</font>
<p>
<a name=%24Server-%3ETra98c592dc></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Server->Transfer($file, @args)</b></font>
<font face="courier new" size=3><pre>
</pre></font>New method from ASP 3.0. Transfers control to another script.
The Response buffer will not be cleared automatically, so if you
want this to serve as a faster $Response->Redirect(), you will need to
call $Response->Clear() before calling this method.
<font face="courier new" size=3><pre>
</pre></font>This new script will take over current execution and
the current script will not continue to be executed
afterwards. It differs from Execute() because the
original script will not pick up where it left off.
<font face="courier new" size=3><pre>
</pre></font>As of Apache::ASP 2.31, this method now accepts optional
arguments like $Response->Include & $Server->Execute.
$Server->Transfer is now just a wrapper for:
<font face="courier new" size=3><pre>
$Response->Include($file, @args);
$Response->End;
</pre></font>
<p>
<a name=%24Server-%3EURL3674cef0></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Server->URLEncode($string)</b></font>
<font face="courier new" size=3><pre>
</pre></font>Returns the URL-escaped version of the string $string. +'s are substituted in
for spaces and special characters are escaped to the ascii equivalents.
Strings encoded in this manner are safe to put in urls... they are especially
useful for encoding data used in a query string as in:
<font face="courier new" size=3><pre>
$data = $Server->URLEncode("test data");
$url = "<tt>http://localhost?data=$data";</tt>
$url evaluates to <tt>http://localhost?data=test+data,</tt> and is a
valid URL for use in anchor <a> tags and redirects, etc.
</pre></font>
<p>
<a name=%24Server-%3EURL6c8bf743></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Server->URL($url, \%params) </b></font>
<font face="courier new" size=3><pre>
</pre></font>Will return a URL with %params serialized into a query
string like:
<font face="courier new" size=3><pre>
$url = $Server->URL('test.asp', { test => value });
</pre></font>which would give you a URL of test.asp?test=value
<font face="courier new" size=3><pre>
</pre></font>Used in conjunction with the SessionQuery* settings, the returned
URL will also have the session id inserted into the query string,
making this a critical part of that method of implementing
cookieless sessions. For more information on that topic
please read on the setting
in the <a href=config.html><font size=-1 face=verdana><b>CONFIG</b></font></a> section, and the SESSIONS section too.</font>
<p>
<a name=%24Server-%3EXSL7df794aa></a>
<font face=verdana><font class=title size=-1 color=#555555><b>$Server->XSLT(\$xsl_data, \$xml_data)</b></font>
<font face="courier new" size=3><pre>
* NON-PORTABLE API EXTENSION *
</pre></font>This method takes string references for XSL and XML data
and returns the XSLT output as a string reference like:
<font face="courier new" size=3><pre>
my $xslt_data_ref = $Server->XSLT(\$xsl_data, \$xml_data)
print $$xslt_data_ref;
</pre></font>The XSLT parser defaults to <a href=http://xmlxslt.sourceforge.net/><font size=-1 face=verdana><b>XML::XSLT</b></font></a>, and is configured with the
XSLTParser setting, which can also use XML::Sablotron ( support added in 2.11 ),
and XML::LibXSLT ( support added in 2.29 ).
Please see the <a href=config.html><font size=-1 face=verdana><b>CONFIG</b></font></a> section for more information on the
XSLT* settings that drive this API. The XSLT setting itself
uses this API internally to do its rendering.
<font face="courier new" size=3><pre>
</pre></font>This API was created to allow developers easy XSLT component
rendering without having to render the entire ASP scripts
via XSLT. This will make an easy plugin architecture for
those looking to integrate XML into their existing ASP
application frameworks.
<font face="courier new" size=3><pre>
</pre></font>At some point, the API will likely take files as arguments,
but not as of the 2.11 release.</font>
</font>
</td>
<td bgcolor=white valign=top>
</td>
</tr>
</table>
</td></tr>
</table>
</center>
</body>
</html>
|