[22121] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4343 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jan 5 00:05:37 2003

Date: Sat, 4 Jan 2003 21:05:05 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 4 Jan 2003     Volume: 10 Number: 4343

Today's topics:
        Bullet-proof, complaint-resistant web hosting.  Guarant sales@net4india.com
    Re: help writing regular expression <goldbb2@earthlink.net>
    Re: help writing regular expression <bongie@gmx.net>
    Re: How can split ignore quoted characters? (Tad McClellan)
    Re: new "use Threads" vs old  "use Thread" <webmaster@neverseenbefore.com>
    Re: new "use Threads" vs old  "use Thread" <goldbb2@earthlink.net>
        Perl City, online Perl articles <rdsteph@earthlink.net>
    Re: Preventing Perl from trying to execute printed ASCI <sbryce@singlepoint.net>
        Thanks for the help! (Stephen Adam)
    Re: Thanks for the help! (Tad McClellan)
        Threads, dynamic loading programs, and using globals? (Joe)
    Re: Threads, dynamic loading programs, and using global <goldbb2@earthlink.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sun, 4 Jan 2003 23:40:14 GMT
From: sales@net4india.com
Subject: Bullet-proof, complaint-resistant web hosting.  Guaranteed.
Message-Id: <ea0ef664.2af41459@new.net4india.net>

<html>
<head>
<title>Net4Domains.com - Domian Name Registration &amp; Hosting Services, register
domain name, domain name search, cheap domain name, internet domain name, domain
name hosting, domain name for sale, purchase internet domain name, buy domain
name</title>
<meta name="keywords" content="domain, domains, domain name, domain name registration, ICANN, internet address, internic, internet name, net name, web address, net, org, registrar, web address, whois, india, com, .com, .net, .org, .biz, .info, india, name, .as, .at, .biz,.ch, dk, .co.at, .co.il , .co.nz , .co.uk, .co.uk, .co.za, .com, .com.hk, .com.lv, .com.my, .com.ph, .com.ru, .com.sg, .com.th, .com.ua, .info, .li , .lt , .lv, .net, .net.nz, .net.ph, .nu, .org, .org.il, .org.lv, .org.nz , .org.ph, .org.uk, .org.uk, .ph, .ru, .tv, keyword, keywords, real names">
<meta name="description" content="Registration of .com,.net, .org, .info, .biz domains and Internet Keywords with full control panel starting from $12 or Rs 399. Keywords are better web addresses.Registration.">
<style type="text/css">
<!--
font {  font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px}
fontbold { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt; font-weight: bold}
fonterror { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px ; font-weight: bold; ; color: #FF0000}
p {  text-align: justify}
select {  font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px}
alink {  font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt; color: #663300; font-weight: normal}
fontboldheading { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt; font-weight: bold; color: #CC6600}
tdbg {  background-color: #E2E2E2}
error { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt; font-weight: normal; ; color: #FF0000 }
-->
</style>
<script>
function selectDefault()        {

        defaultValueSelected = false
        for (i = 0; i < document.frm.ext.options.length; i++)   {
                if (document.frm.ext.options[i].defaultSelected)
                        defaultValueSelected = true
        }

        if (!defaultValueSelected)
                document.frm.ext.options[0].selected = true

}

function popUpWindow(myUrl,winName)
        {
                myTarget = winName;
                myArgs = "height=400,width=749,location=no,menubars=no,scrollbars=yes,toolbars=no,resizable=no,titlebar=no";
                newWindow = open(myUrl, myTarget, myArgs);

                newWindow.focus();
        }

function OpenWin()
{
window.open("java-hosting-pop.html","JavaHosting","height=330,width=230,noscrollbars");
}

function OpenFirst()
{
window.open("http://www.net4domains.com/net4domains.com/tmpl/phonewala.html","Phonewala","height=230,width=330,noscrollbars");
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
</script>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" vlink="#663300" alink="#663300" link="#663300">
<table width="100%" border="0" cellspacing="0" cellpadding="0" vspace="0" hspace="0">
  <tr>
    <td width="231" background="http://www.net4domains.com/net4domains.com/images/bg.gif"><img src="http://www.net4domains.com/net4domains.com/images/net4.gif" width="231" height="26"></td>
    <td  background="http://www.net4domains.com/net4domains.com/images/bg.gif" width="148" class="fontbold" align="right">&nbsp;</td>
    <td  background="http://www.net4domains.com/net4domains.com/images/bg.gif" width="375" class="fontbold" align="left" valign="middle"><a href="/perl/net4.cgi?frm=aboutUs"  class="alink">About
      us</a> :: <a href="/perl/net4.cgi?frm=contactUs" class="alink">Contacts</a>
      :: <a href="/perl/info/supportInfo.cgi?frm=support&s=###s###" class="alink">Support
      Centre</a> </td>
    <td  background="http://www.net4domains.com/net4domains.com/images/bg.gif" width="10" class="fontbold" align="center">&nbsp;</td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr align="left" valign="top" background="http://www.net4domains.com/net4domains.com/images/bgThin.gif">
    <td height="2" colspan="7" background="http://www.net4domains.com/net4domains.com/images/bgThin.gif"><img src="http://www.net4domains.com/net4domains.com/images/bgThin.gif" width="4" height="2"></td>
  </tr>
  <tr>
    <td background="http://www.net4domains.com/net4domains.com/images/html/bg-new.gif" width="66"><img src="http://www.net4domains.com/net4domains.com/images/html/bg-new.gif" width="9" height="23"></td>
    <td align="left" background="http://www.net4domains.com/net4domains.com/images/html/bg-new.gif" colspan="6" width="698"><span class="fontboldheading"><a href="/perl/users.cgi?frm=usermypage " class="fontboldheading">User
      Control Panel</a> -<a href="/perl/partners.cgi?frm=resellermypage " class="fontboldheading">
      Partners Control Panel</a> -&nbsp;<a href="/perl/info/domInfo.cgi?frm=domInfo" class="fontboldheading" >Domains</a>
      - <a href="/perl/info/bizMailInfo.cgi?frm=bizMailInfo" class="fontboldheading">BIZMai</a></span><a href="/perl/info/bizMailInfo.cgi?frm=bizMailInfo" class="fontboldheading">l</a><span class="fontboldheading">
      - <a href="/perl/info/hostInfo.cgi?frm=hostInfo" class="fontboldheading">Website
      Hosting</a> - <a href="/perl/info/domInfo.cgi?frm=colocation" target="_self" class="fontboldheading">Colocation</a>
      </span></td>
  </tr>
</table>
<br>
<br>

<table width="755" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF">
  <tr>
    <td width="319" align="center" valign="top" >
      <table border="0" cellspacing="0" cellpadding="0" vspace="0" hspace="0" width="313">
        <tr>
          <td colspan="2"><img src="http://www.net4domains.com/net4domains.com/images/tmpl/n4ddomsearch.gif" width="228" height="20"></td>
          <td width="12">&nbsp;</td>
        </tr>
        <tr>
          <td height="8" width="11" valign="top" align="left"><img src="http://www.net4domains.com/net4domains.com/images/tmpl/left1.gif" width="11" height="11"></td>
          <td height="8" background="http://www.net4domains.com/net4domains.com/images/tmpl/left_t.gif" width="300" valign="top" align="left"><img src="http://www.net4domains.com/net4domains.com/images/tmpl/left_t.gif" width="14" height="11"></td>
          <td height="8" width="12" align="left" valign="top"><img src="http://www.net4domains.com/net4domains.com/images/tmpl/left3.gif" width="11" height="11"></td>
        </tr>
        <tr>
          <td background="http://www.net4domains.com/net4domains.com/images/tmpl/left_l.gif" width="11" valign="top" align="left"><img src="http://www.net4domains.com/net4domains.com/images/tmpl/left_l.gif" width="11" height="12"></td>
          <td bgcolor="#FFCC33" valign="top" width="300" align="left">
            <table width="297" border="0" cellspacing="0" cellpadding="0" vspace="0" hspace="0">
              <tr align="left" valign="middle" bgcolor="#FFCC33">
                <td class="font" width="297" height="2"><img src="http://www.net4domains.com/net4domains.com/images/tmpl/one-domain.gif" width="23" height="21" align="absmiddle"><span class="font">Enter</span>
                  <a href="javascript:popUpWindow('http://www.net4domains.com/net4domains.com/html/help/help-domain.html', '')" class="fontbold">Domain
                  Name</a> to search</td>
              </tr>
              <!--Form started -->
              <form name="frm" method="post" action="/perl/whois.cgi" target=_self >
                <input type="hidden" name="act" value="Search Domain">
                <input type="hidden" name="lookup" value="OK">
                <input type="hidden" name="s" value="0">
                <tr align="left" valign="middle" bgcolor="#FFCC33">
                  <td class="fontbold" align="left" height="2" valign="middle" width="297">
                    www.
                    <input type="text" class="font"  name="domain" size="23" value="" maxlength="63">
                    &nbsp; </td>
                </tr>
                <tr align="left" valign="middle" bgcolor="#FFCC33">
                  <td class="font" valign="middle" bgcolor="#FFCC33" align="left" width="297"><img src="http://www.net4domains.com/net4domains.com/images/tmpl/two-domain.gif" width="23" height="21" align="absmiddle">Select
                    desired Domain <a href="javascript:popUpWindow('http://www.net4domains.com/net4domains.com/html/help/help-tld.html', '')" class="fontbold">Extensions</a></td>
                </tr>
                <tr align="left" valign="top" bgcolor="#FFCC33">
                  <td width="297" align="left" valign="top">
                    <table width="100%" border="0" cellspacing="0" cellpadding="1" align="left">
                      <tr>
                        <td class="font" width="23%">
                          <input type="checkbox" name="ext" value="com" class="font" checked >
                          <span class="fontbold">COM</span> </td>
                        <td class="font" width="29%">
                          <input type="checkbox" name="ext" value="net" class="font" >
                          <span class="fontbold">NET </span> </td>
                        <td class="font" width="21%">
                          <input type="checkbox" name="ext" value="org" class="font" >
                          <span class="fontbold">ORG </span> </td>
                        <td class="font" width="27%">&nbsp; </td>
                      </tr>
                      <tr>
                        <td class="font" width="23%" height="2">
                          <input type="checkbox" name="ext" value="info" class="font" >
                          <span class="fontbold">INFO</span> </td>
                        <td class="font" width="29%" height="2">
                          <input type="checkbox" name="ext" value="biz" class="font" >
                          <span class="fontbold">BIZ</span> </td>
                        <td class="fontbold" width="21%" height="2">
                          <input type="checkbox" name="ext" value="tv" class="font" >
                          <span class="fontbold">TV </span> </td>
                        <td class="fontbold" width="27%" height="24"> </td>
                      </tr>
                      <tr>
                        <td class="font" colspan="2" height="12">Select a country
                          Domain </td>
                        <td align="left" class="fontbold" colspan="2" height="12">
                          <select name="ext" class="font">
                            <option value="" selected>Select</option>
                            <option value="as">.as</option>
                            <option value="at">.at</option>
                            <option value="co.at">.co.at</option>
                            <option value="ch">.ch</option>
                            <option value="dk">.dk</option>
                            <option value="com.hk">.com.hk</option>
                            <option value="co.il">.co.il</option>
                            <option value="org.il">.org.il</option>
                            <option value="li">.li</option>
                            <option value="lt">.lt</option>
                            <option value="lv">.lv</option>
                            <option value="com.lv">.com.lv</option>
                            <option value="org.lv">.org.lv</option>
                            <option value="com.my">.com.my</option>
                            <option value="nu">.nu</option>
                            <option value="co.nz">.co.nz</option>
                            <option value="net.nz">.net.nz</option>
                            <option value="org.nz">.org.nz</option>
                            <option value="ph">.ph</option>
                            <option value="com.ph">.com.ph</option>
                            <option value="net.ph">.net.ph</option>
                            <option value="org.ph">.org.ph</option>
                            <option value="ru">.ru</option>
                            <option value="com.ru">.com.ru</option>
                            <option value="com.sg">.com.sg</option>
                            <option value="com.th">.com.th</option>
                            <option value="com.ua">.com.ua</option>
                            <option value="co.uk">.co.uk</option>
                            <option value="org.uk">.org.uk</option>
                            <option value="co.za">.co.za</option>
                          </select>
                          <input type="submit" value="Search" name="submit" class="font">
                        </td>
                      </tr>
                    </table>
                  </td>
                </tr>
              </form>
            </table>
          </td>
          <td background="http://www.net4domains.com/net4domains.com/images/tmpl/left_r.gif" width="12" valign="top" align="left"><img src="http://www.net4domains.com/net4domains.com/images/tmpl/left_r.gif" width="11" height="12"></td>
        </tr>
        <tr>
          <td height="2" width="11" valign="top" align="left"><img src="http://www.net4domains.com/net4domains.com/images/tmpl/left2.gif" width="11" height="13"></td>
          <td background="http://www.net4domains.com/net4domains.com/images/tmpl/left.gif" height="2" width="300" valign="top" align="left"><img src="http://www.net4domains.com/net4domains.com/images/tmpl/left.gif" width="12" height="13"></td>
          <td height="2" width="12" valign="top" align="left"><img src="http://www.net4domains.com/net4domains.com/images/tmpl/left4.gif" width="11" height="13"></td>
        </tr>
      </table>
    </td>
    <td width="272" align="center" valign="top">
      <table width="82%" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr>
          <td align="left" valign="top" width="248">&nbsp;<img src="http://www.net4domains.com/net4domains.com/images/tmpl/n4dbizmail.gif" width="228" height="20">
          </td>
        </tr>
        <tr>
          <td align="left" valign="top" width="248">
            <table bgcolor="#FFCC33" cellpadding="1" cellspacing="0" width="240">
              <tr>
                <td align="center" valign="top">
                  <table width="240" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFF7E0">
                    <tr>
                      <td colspan="5" class="font" height="28" align="center" valign="middle"><img src="http://www.net4domains.com/net4domains.com/images/bizmail/getyournameasemail.gif" width="238" height="20"></td>
                    </tr>
                    <tr>
                      <td colspan="5" height="3" class="font">&nbsp;</td>
                    </tr>
                    <tr align="center" valign="top">
                      <td colspan="5" class="error" height="106">
                        <table border="0" cellspacing="0" cellpadding="2" align="center" width="240">
                          <tr>
                            <td width="81" height="6"><img src="http://www.net4domains.com/net4domains.com/images/bizmail/yourname.gif" width="81" height="20"></td>
                            <td width="11" class="font" height="6">&nbsp;</td>
                            <td colspan="2" height="6"><img src="http://www.net4domains.com/net4domains.com/images/bizmail/domainname.gif" width="82" height="18"></td>
                          </tr>
                          <form action="/perl/bizMail.cgi" target=_self method="post">
                            <input type="hidden" name="act" value="Search Domain For Biz Mail">
                            <input type="hidden" name="s" value="0">
                            <tr>
                              <td width="0" align="right" valign="middle">
                                <input type="text" name="emailAlias" size="10" class="font" value="">
                              </td>
                              <td width="0" class="font">@</td>
                              <td width="0" align="left" valign="middle">
                                <input type="text" name="domainName" size="10" class="font" value="">
                              </td>
                              <td width="0" align="left" valign="middle">
                                <select name="ext" class="font">
                                  <option value="com" selected>com</option>
                                  <option value="net">net</option>
                                  <option value="org">org</option>
                                  <option value="biz">biz</option>
                                  <option value="info">info</option>
                                </select>
                              </td>
                            </tr>
                            <tr align="left" valign="middle">
                              <td colspan="4" height="14">&nbsp;<span class="error">e.g.
                                vijay@vijayexports.com</span></td>
                            </tr>
                            <tr>
                              <td colspan="2" height="43" align="right" valign="top">
                                <input type="image" border="0" name="imageField" src="http://www.net4domains.com/net4domains.com/images/bizmail/search.gif" width="87" height="32">
                              </td>
                              <td colspan="2" height="43" align="left" valign="top"><span class="fontbold"><a href="/perl/info/bizMailInfo.cgi?frm=bizMailInfo"><img src="http://www.net4domains.com/net4domains.com/images/bizmail/only140perid.gif" width="132" height="16" border="0"><br>
                                Tell me more...</a></span></td>
                            </tr>
                          </form>
                        </table>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>

          </td>
        </tr>
      </table>
    </td>
    <td rowspan="2" align="center" valign="top">
      <table border="0" cellspacing="0" cellpadding="0" height="100%" width="1">
        <tr>
          <td class="tdbg" align="left" valign="top" width="0" height="400"><img src="http://www.net4domains.com/net4domains.com/images/pix.gif" width="1" height="1"></td>
        </tr>
      </table>
    </td>
    <td rowspan="2" align="left" valign="top">&nbsp;</td>
    <td rowspan="2" align="center" valign="top">
      <table width="150" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="140" class="fontbold" align="left" valign="top"><img src="http://www.net4domains.com/net4domains.com/images/solutionsFor.gif" width="139" height="19"></td>
        </tr>
        <tr>
          <td align="left" valign="top" width="140"> <table width="150" border="0" cellspacing="0" cellpadding="0">
              <tr valign="middle">
                <td align="left" class="normalText" width="10"><img src="http://www.net4domains.com/net4domains.com/images/arrow.gif" width="14" height="8"></td>
                <td align="left" class="font" height="25"><a href="/perl/info/bsInfo.cgi?frm=sfbc">Business/Corporates</a></td>
              </tr>
              <tr >
                <td align="left" colspan="2" background="http://www.net4domains.com/net4domains.com/images/hor-dotline.gif" valign="middle">
                  <img src="http://www.net4domains.com/net4domains.com/images/blank.gif" height="3"></td>
              </tr>
              <tr valign="middle">
                <td align="left" width="10"><img src="http://www.net4domains.com/net4domains.com/images/arrow.gif" width="14" height="8"></td>
                <td align="left" class="font" height="25"><a href="/perl/info/bsInfo.cgi?frm=sfi">Individuals</a></td>
              </tr>
              <tr >
                <td align="left" colspan="2" background="http://www.net4domains.com/net4domains.com/images/hor-dotline.gif">
                  <img src="http://www.net4domains.com/net4domains.com/images/blank.gif" width="5" height="3"></td>
              </tr>
              <tr valign="middle">
                <td align="left" width="10" class="normalText"><img src="http://www.net4domains.com/net4domains.com/images/arrow.gif" width="14" height="8"></td>
                <td align="left" class="font" height="25"><a href="/perl/info/bsInfo.cgi?frm=sfp">Partners</a></td>
              </tr>
              <tr valign="middle" >
                <td align="left" colspan="2" background="http://www.net4domains.com/net4domains.com/images/hor-dotline.gif" height="3">
                  <img src="http://www.net4domains.com/net4domains.com/images/blank.gif" width="5" height="3"></td>
              </tr>
            </table></td>
        </tr>
        <tr>
          <td align="left" valign="top" width="140">&nbsp;</td>
        </tr>
        <tr>
          <td align="left" valign="top" width="140"><a href="/perl/transfer.cgi?frm=dtInfo"><img src="http://www.net4domains.com/net4domains.com/images/transferdomain.gif" width="150" height="116" border="1"></a></td>
        </tr>
        <tr>
          <td align="left" valign="top" width="140">&nbsp;</td>
        </tr>
        <tr>
          <td align="left" valign="top" width="140"><a href="http://www.net4domains.com/perl/whois.cgi?frm=searchDotName"><img src="http://www.net4domains.com/net4domains.com/images/dotname/home-banner.gif" width="150" height="58" border="0"></a></td>
        </tr>
        <tr>
          <td align="left" valign="top" width="140">&nbsp;</td>
        </tr>
        <tr>
          <td align="left" valign="top" width="140"><a href="http://www.phonewala.com" target="parent"><img src="http://www.phonewala.com/images/gift-banner.jpg" width="150" height="58" border="0" align="middle"></a></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td colspan="2" valign="top" height="106">
      <table border="0" cellspacing="0" cellpadding="0" width="575">
        <tr>
          <td class="tdbg" align="left" valign="top"><img src="http://www.net4domains.com/net4domains.com/images/pix.gif" width="1" height="1"></td>
        </tr>
      </table>
      <br>
      <table width="575" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="120" width="245" align="left" valign="top"><a href="/perl/info/hostInfo.cgi?frm=hostInfo"><img src="http://www.net4domains.com/net4domains.com/images/sharedhostingHome.gif" width="234" height="105" border="0"></a></td>
          <td height="120" width="34" align="center" valign="top">
            <table border="0" cellspacing="0" cellpadding="0" height="100%" width="1">
              <tr>
                <td class="tdbg" align="left" valign="top" width="0" height="100"><img src="http://www.net4domains.com/net4domains.com/images/pix.gif" width="1" height="1"></td>
              </tr>
            </table>
          </td>
          <td height="120" width="296" align="right" valign="top"><a href="/perl/info/domInfo.cgi?frm=colocation"><img src="http://www.net4domains.com/net4domains.com/images/colocationHome.gif" width="315" height="105" border="0"></a></td>
        </tr>
      </table>
      <table border="0" cellspacing="0" cellpadding="0" width="575">
        <tr>
          <td class="tdbg" align="left" valign="top"><img src="http://www.net4domains.com/net4domains.com/images/pix.gif" width="1" height="1"></td>
        </tr>
      </table>
      <table width="575" border="0" cellspacing="0" cellpadding="0">

        <tr>
          <td height="2" valign="bottom" align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><br>
            &copy; 2001 Net 4 India Ltd, All Rights Reserved <br>
            <a href="http://www.net4domains.com/net4domains.com/html/disclaimer.html" target="_blank"><font color="#0033FF">Disclaimer</font></a>
            | <a href="http://www.net4domains.com/net4domains.com/html/privacy-policy.html" target="_blank"><font color="#0033FF">Privacy
            Policy </font></a> </font></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<p>&nbsp;</p></body>
</html>


------------------------------

Date: Sat, 04 Jan 2003 21:18:01 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: help writing regular expression
Message-Id: <3E1795D9.1FE51427@earthlink.net>

les wrote:
> 
> Hi,
> i have a file with lines such as this
> 
> word1 = " some text here . G{\"o}del wrote ..."
> word2 = { some other text here ... }
> word3 = 1234
> 
> in other words: numbers need not be surrounded by
> quotes or brackets. Text must be surrounded by quotes or brackets. If
> there is a nested bracket then this text must be surrounded by quotes.
> 
> i would like to make a hashtable with key and value value pair:
> 
> word1 => 'some text here ..G{\"o}del wrote ..."
> word2 => 'some other text here ...'

while( my $line = <FH> ) {
   local *_ = \$line;
   next unless s/^(\w+)\s*=>\s*//;
   my $k = $1;
   /^(\w+)$/ or /^"(.*)"$/ or /^\{(.*)}$/ or next;
   my $v = $2;
   # stuff.
}

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


------------------------------

Date: Sun, 05 Jan 2003 04:28:29 +0100
From: "Harald H.-J. Bongartz" <bongie@gmx.net>
Subject: Re: help writing regular expression
Message-Id: <3149128.p4iTIR49kq@nyoga.dubu.de>

les wrote:
> i have a file with lines such as this
> 
> word1 = " some text here . G{\"o}del wrote ..."
> word2 = { some other text here ... }
> word3 = 1234

This looks quite familiar... ;-)
http://search.cpan.org/search?mode=module&query=bibtex
Maybe Text::BibTeX can help you (never tried it myself).

Ciao,
        Harald
-- 
Harald H.-J. Bongartz <bongie@gmx.net>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
"Law of Volunteer Labor"
People are always available for work in the past tense.



------------------------------

Date: Sat, 4 Jan 2003 19:08:31 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: How can split ignore quoted characters?
Message-Id: <slrnb1f1cf.v6d.tadmc@magna.augustmail.com>

ctcgag@hotmail.com <ctcgag@hotmail.com> wrote:
> Matija Papec <mpapec@yahoo.com> wrote:
>> X-Ftn-To: Robert Nicholson
>> robert@elastica.com (Robert Nicholson) wrote:
>> >How do you specific the pattern for split to ignore the quoted
>> >characters of the character you want to split on?
>> >
>> >ie. you want to split on ',' but you want to ignore \, in the text
> 
> That's escaped, not quoted.


Then do we need a bug report to the p5p to get quotemeta()
changed to escapemeta() ?

heh.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Sun, 5 Jan 2003 04:55:28 +0100
From: "Dieter D'Hoker" <webmaster@neverseenbefore.com>
Subject: Re: new "use Threads" vs old  "use Thread"
Message-Id: <av8ac0$ct05h$1@ID-155251.news.dfncis.de>

Benjamin Goldberg wrote:
> Dieter D'Hoker wrote:
>>
>> In the old 5.0 iplemntation of threads ("use Thread") you could use
>> $thread->done  to check if the thread was finished ,
>>
>> zo you could use this in your serverloop without blokking the loop ..
>>
>> while (1)
>> {
>> if ($thread->done) {$thread->join;}
>> }
>>
>> but know with ithreads is this still possible ?
>
> Not directly, but you can have your thread set something in a global
> shared variable just before exiting.
>
> use threads;
> use threads::shared;
> my $done : shared;
> my $thread = threads->create(sub {
>    # do stuff which takes a while.
>    lock $done;
>    $done = 1;
>    cond_signal $done;
> });
>
> {
>    lock $done;
>    cond_wait $done until $done;
>    $thread->join;
> }
>
> Of course, with the example bit of code you gave, you could simply
> call $thread->join, and not try and wait for it to be "finished" -- I
> assume that you've got something else in mind?

Well I want to do a long running calculation that can take up to 5 minutes ,
( sub example{sleep 300;return 'I have been sleeping';} )
without it blokking my server , and i do want to have the result even if it
takes long ...

and if that works well I migth use it for not-SO-long calculations ,
but then I would have to know how much time is needed to create a thread
compared to just running the code at once ...


>> (using the old "Thread interface" of the new "Threads" ? )
>>
>> I also found a old Async module that uses fork, but I don't think I
>> could use this because my shell account only permits me to run one
>> background process, and forking starts an new process doen't it ?
>
> Out of curiosity, what operating system is your shell account on?  I
> seem to recall that on at least one variant of linux, threads are
> actually implemented using processes.
>
> Thus, the limit on the number of processes you can create might also
> limit the number of threads you can create.


My shell is running Slackware Linux ...


--
Dieter D'Hoker
http://dieter.dhoker.com/
news:free.nl.dieter.dhoker & news:alt.nl.fan.dieter.dhoker

>
>> =(1<<21)}""=~$.;qw(Just another Perl hacker,\n);




------------------------------

Date: Sat, 04 Jan 2003 23:27:17 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: new "use Threads" vs old  "use Thread"
Message-Id: <3E17B425.1EBD9DB@earthlink.net>

Dieter D'Hoker wrote:
> 
> Benjamin Goldberg wrote:
> > Dieter D'Hoker wrote:
[snip]
> > assume that you've got something else in mind?
> 
> Well I want to do a long running calculation that can take up to 5
> minutes , ( sub example{sleep 300;return 'I have been sleeping';} )
> without it blokking my server , and i do want to have the result even
> if it takes long ...

What do you mean, without it blocking your server?

If you want to use threads to implement a timeout,
then you could write something like:

   my $status : shared;
   my $thr_work = threads->create(sub {
      # do some work.
      lock $status;
      return if $status;
      $status = "done";
      cond_signal $status;
      return @whatever;
   });
   threads->create(sub {
      sleep 300;
      lock $status;
      return if $status;
      $status = "timed_out";
      cond_signal $status;
   })->detach;
   {
      lock $status;
      cond_wait $status until $status;
      if( $status eq "done" ) {
         my @results = $thr_work->join;
         # process @results.
      } else {
         print "Timed out\n";
         $thr_work->detatch;
      }
   }

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


------------------------------

Date: Sun, 05 Jan 2003 03:30:50 GMT
From: Ron Stephens <rdsteph@earthlink.net>
Subject: Perl City, online Perl articles
Message-Id: <3E17A799.8000805@earthlink.net>

Perl City, a new web site at http://www.awaretek.com/perlcity.html 
features a web spider that scrapes the web daily for web articles on 
Perl, new Perl Sourceforge projects, etc.



------------------------------

Date: Sat, 04 Jan 2003 19:46:29 -0700
From: Scott Bryce <sbryce@singlepoint.net>
Subject: Re: Preventing Perl from trying to execute printed ASCII text
Message-Id: <3E179C85.7060709@singlepoint.net>

Jürgen Exner wrote:

> Nonsense.

This is comforting. I would expect this to be nonsense, but I didn't 
know where else to look. I was baffled.

> Your problem must be with some other part of your system.

As pointed out by the other posters, it was.



------------------------------

Date: 4 Jan 2003 19:02:21 -0800
From: 00056312@brookes.ac.uk (Stephen Adam)
Subject: Thanks for the help!
Message-Id: <945bf980.0301041902.1fa2fda6@posting.google.com>

Thanks for the help!

I know I fuc*** up the post a bit, I just wrote a short (badly done)
example of my problem. I HAVE read the faq on removing HTML but I want
to write my own for a uni project + its a good way of learning perl
(as you can obviously tell I am not an expert and need the practise!.)
Likewise I have checked out the error messages; but the code I put up
was I quick example of the semantics I was having trouble with not the
syntax, though using strict realy gives me a headache at the mo. I am
reading programming perl at the moment but its not something you can
get through in a week or two!

Thanks for the help guys. 


Speak to you soon and thanks again for your time.


Steve


------------------------------

Date: Sat, 4 Jan 2003 22:15:25 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Thanks for the help!
Message-Id: <slrnb1fcat.ge.tadmc@magna.augustmail.com>

Stephen Adam <00056312@brookes.ac.uk> wrote:

> though using strict realy gives me a headache at the mo.


Stick with it.

It will pay you back many times over.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: 4 Jan 2003 18:10:39 -0800
From: joemercury@gmx.net (Joe)
Subject: Threads, dynamic loading programs, and using globals?
Message-Id: <d6c57a14.0301041810.70354068@posting.google.com>

Hi,
 
I have a working model where a main program starts threads
that dynamically load another named program.
It is like a plug-in style system, each running in thread.

Now, I want to share common resources among multiple instances of the
same loaded program. In my example I want one global static $q to be
accessed by the second invocation of "xy1" and incremented from 1 to
2.

1) How shall I do it if I place this resource in the main file?
2) How do I place this resource just in the loaded file (preferred)? 
3) If this model can be improved, please advise.

You can test it; In the stripped-down version below,
cut the code into 2 files, "xy_load.pl" and "xy1.pm",
and place in same directory.
I run it on Windows 2000, Activestate 5.8.

TIA
J. Merc

#================== xy_load.pl  =============
#! /usr/bin/perl -w

use 5.008;             # 5.8 required for stable threading
   package xy_load;

use strict;
no strict 'subs';
no strict 'refs';
use warnings;
use threads;
use File::Basename;

  my $HOME = dirname($0);  # directory the program loaded from
  push(@INC, $HOME);       # Set in perl's include path list
  $| = 1;

  my $p = 0;  # counter
  my $sub = "xy1"; # the name of program to load
  my $thr1 = threads->create(\&start_thread, $sub, $p );
  $p++;
  my $thr2 = threads->create(\&start_thread, $sub, $p );
  $thr1->join;
  $thr2->join;

sub start_thread {
   my ($sub, $p )= @_;

   eval "require $sub"; # load the passed program
   &{"xy_load::" . $sub . "::Process"}($p); # and run it
}

#================  xy1.pm  ============
  package xy_load::xy1;

### I want $q as shared global to all invocations of "xy1",
### It is placed here just as example, I expect printout q=1 and q=2

my $q : shared = 0;
sub Process {
   my $p = $_[0];
   my $tid = threads->self->tid;
   $| = 1;
   {
     lock ($q);
     $q++;
     print STDERR "TID: $tid, p = $p, q = $q\n";
   }
}
1; # success status for require


------------------------------

Date: Sat, 04 Jan 2003 21:53:30 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Threads, dynamic loading programs, and using globals?
Message-Id: <3E179E2A.CE876F79@earthlink.net>

Joe wrote:
> 
> Hi,
> 
> I have a working model where a main program starts threads
> that dynamically load another named program.
> It is like a plug-in style system, each running in thread.
> 
> Now, I want to share common resources among multiple instances of the
> same loaded program. In my example I want one global static $q to be
> accessed by the second invocation of "xy1" and incremented from 1 to
> 2.
>
> 1) How shall I do it if I place this resource in the main file?

If it is to be placed in the main file, then it must be a package
variable, not a lexical variable.  Declare it with our() instead of
my().

> 2) How do I place this resource just in the loaded file (preferred)?

A variable which is to be shared between multiple threads *must* be
declared as such *before* those threads get created.

If the shared variable is to be placed in just the loaded file, then you
must load that file (with require) *before* you create a thread for
calling Process().

In other words:

   my $p = 0;
   my $sub = "xy1";

   require "xyload::$sub.pm";
   my $thr1 = threads->create( \&{"xy_load::$sub\::Process"}, $p++ );
   my $thr2 = threads->create( \&{"xy_load::$sub\::Process"}, $p++ );

> 3) If this model can be improved, please advise.

Whether it can be improved or not depends on how many different plugins
there are to be loaded, and how many *will* be loaded in the lifetime of
the process.  If there are many plugins, and many will be loaded, then
you want the loading to happen within the child thread (so the master
thread will never have any plugin loaded within it, and each child
thread will only ever have one plugin loaded).  If there are few
plugins, or only a few will ever get loaded in any run of the main
program, then it's reasonable to have them loaded into the main thread
before the creation of the children.

If you want the plugins loaded only in the child threads, but at the
same time need to have some shared data between them, and you don't want
to have to go and declare all those shared variables explicitly in the
main program, then I would suggest you do something like the following:

   # main program:
   our %plugin_data : shared;
   # stuff which starts threads.
   sub start_thread {
      my $pack = shift;
      eval q[require $pack];
      goto &{$pack . "::Process"};
   }
   __END__

   # in the plugin
   package myplugins::xy1;
   BEGIN {
      *q = \$main::plugin_data{+__PACKAGE__};
   };
   use vars qw($q);
   sub Process {
      my $p = shift;
      my $tid = threads->self->tid;
      lock ($q);
      $q++;
      print STDERR "TID: $tid, p = $p, q = $q\n";
   }
   __END__

If you have more than one variable to share, it becomes a bit more
complicated in the BEGIN block, but not immensly.  Post back here if you
can't figure it out yourself.

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 4343
***************************************


home help back first fref pref prev next nref lref last post