[16388] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3800 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 25 18:05:52 2000

Date: Tue, 25 Jul 2000 15:05:23 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <964562722-v9-i3800@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 25 Jul 2000     Volume: 9 Number: 3800

Today's topics:
        <newbie> Html Tag generation <jeremiah@klondyke.net>
    Re: Advanced Perl Programming -- Dated? <lusol@Pandora.CC.Lehigh.EDU>
    Re: Advanced Perl Programming -- Dated? <nospam@nospam.com>
        Are you looking for hardware or software? <forum21@euskaltel.net>
    Re: Clsid Number Changes danvanhout@my-deja.com
    Re: config httpd.conf to run perl script (Abigail)
        cookie and redirect trouble... <hansson.anders@goteborg.utfors.se>
    Re: cookie and redirect trouble... <red_orc@my-deja.com>
    Re: DB_FILE  --> recovery?  HELP <gellyfish@gellyfish.com>
        Display file size shoaibq@my-deja.com
    Re: Display file size (Greg Bacon)
    Re: Display file size <bcaligari@shipreg.com>
    Re: Double trouble with CGI.pm or else <chris.morris@supanet.net.uk>
    Re: empty line (Craig Berry)
    Re: file location and access strategies <nospam@nospam.com>
    Re: how do you ? question (Craig Berry)
    Re: how do you ? question <aqumsieh@hyperchip.com>
    Re: how do you ? question <bart.lateur@skynet.be>
    Re: how do you ? question <stevenjm@telisphere.com>
    Re: how do you ? question <exit72@excite.com>
    Re: how to print every 91st line (Craig Berry)
    Re: LWP UserAgent <gellyfish@gellyfish.com>
        Net::LDAP: how to handle connection in case ldap server bing-du@tamu.edu
    Re: NetBIOS/nbname ??? <nospam@nospam.com>
        Newbie: Error message with write/format <gorbeast@SPAMSUCKS.subduction.org>
    Re: Newbie: Error message with write/format <gorbeast@SPAMSUCKS.subduction.org>
    Re: Open File and Change Case (Craig Berry)
    Re: Open File and Change Case <tim@ipac.caltech.edu>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 25 Jul 2000 17:39:20 -0400
From: Jeremiah Megie <jeremiah@klondyke.net>
Subject: <newbie> Html Tag generation
Message-Id: <397E0908.3ED825B7@emich.edu>

I have written a script that will allow a user to post announcements to
a webpage.  They fill out the form, hit submit, and it puts the contents
into the page.  It works perfect, except one thing.  When you type your
announcement in the textarea box, it doesn't let you use html tags, so
when you type and submit the form, everything is on one line and nothing
can be seperated out.  I want to be able to have the users type in their
announcement and have it automatically put in <p> tags, and <a href>
tags, upon them putting in a link or a new paragraph.  Is there a way
that I can do this?  I can't seem to figure it out.


Jeremiah



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

Date: 25 Jul 2000 19:05:58 GMT
From: "Stephen O. Lidie" <lusol@Pandora.CC.Lehigh.EDU>
Subject: Re: Advanced Perl Programming -- Dated?
Message-Id: <8lkoem$840@fidoii.CC.Lehigh.EDU>

Hugh Lawson <hlawson@triad.rr.com> wrote:
> What about Ch. 14, "User Interfaces with Tk", and Appendix A, "Tk Widget
> Reference"?

> I wrote a beginner program that quizzes me on new French words I have to
> look up while reading.  I've never written any kind of graphic interface,
> but I'd like to try setting up one for this program, mainly as a learning
> exercise.  Is this chapter satisfactory for a beginner's use, or should I
> look elsewhere for an introduction?

I'd start with Learning Perl/Tk from ORA, and read comp.lang.perl.tk.

-- 
@_=map{eval"100${_}"}split/!/,'/5!*2!+$]!/10+$]';use Tk;$m=tkinit;$t='just an'.
'other perl hacker';$z='createText';$c=$m->Canvas(-wi,$_[1],-he,25)->grid;$c->$
z(@_[2,3],-te,$t,-fi,'gray50');$c->$z($_[2]-$],$_[3]-$],-te,$t);$m->bind('<En'.
'ter>',sub{$y=int(rand($m->screenheight));$m->geometry("+$y+$y")});MainLoop;


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

Date: 25 Jul 2000 19:24:07 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: Advanced Perl Programming -- Dated?
Message-Id: <8lkpgn$n7s$1@216.155.32.41>

In article <x7lmyq91ec.fsf@home.sysarch.com>, Uri Guttman 
<uri@sysarch.com> wrote:

 | APP has its minor good points but it is not a must have book. i liked it
 | some when it came out but my opinion of it has gone down over time as it
 | has become dated and my book reviewing skills have gone up. it is poorly
 | organized and it covers dangerous topics without enough warnings and in
 | a poorly organized way. it has some minor part like making modules and
 | some guts and it had the earliest coverage perl/tk thing out there. but
 | all of that is done better elsewhere.

Uri, you've seen some of the stuff I've been getting involved in 
perl-wise that I've posted on here, so you may (or may not, I dunno) 
have some vague idea of where I'm at with perl knowledge.. 

Do you have any books you currently recommend aside from Programming 
Perl which I already have? 

I'm already thinking about possibly getting one on SQL just to wrap my 
brain around database stuff, but I'm wondering if there are any decent 
intermediate-advanced topic books out there that are worth owning (and 
spending money on since that's a scarce resource at the moment :)

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Tue, 25 Jul 2000 22:01:06 +0200
From: "Anton" <forum21@euskaltel.net>
Subject: Are you looking for hardware or software?
Message-Id: <8lks42$fdi$10@talia.mad.ttd.net>




If you wish to buy a new hardware or software, would you like to be offered,
for a whole month, different prices from professional sellers, in order to
get the best deal possible?. (It's Free).
Forum21. Free tool for buyers.
http://www.forum21.net/english

































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

Date: Tue, 25 Jul 2000 18:29:42 GMT
From: danvanhout@my-deja.com
Subject: Re: Clsid Number Changes
Message-Id: <8lkmaf$uf$1@nnrp1.deja.com>

I haven't even gotten this far yet.  Any idea where I can get a copy of
guidgen.exe?


In article <dHud5.3640$Yy3.132846@newsread2.prod.itd.earthlink.net>,
  "Kenny Lim" <kennylim@techie.com> wrote:
> Thanks for the great pointers. The solution provided resolved my
problem.
>
> You have a great evening !
>
> Kenny-
>
> "Kenny Lim" <kennylim@techie.com> wrote in message
> news:Hl2d5.1780$in.51331@newsread1.prod.itd.earthlink.net...
> >
> > Hi All,
> >
> > My objective here is to be able to perform the following task :
> >
> > To only generate the clsid once, and then manually alter the last 4
digits
> > of the first batch of the clsid given. (The 4 digits will be
incremented
> > sequentially)
> > [Please see Example below]
> >
> > The reason to do this is to help better manage/identify all the
clsid id
> > given specific to the product versioning.
> >
> > Example :
> >
> > (a) Given this clsid number generated from GuidGen.exe
> > {ADBE2CC0-5CD5-11D4-85DE-00105AE3A355}
> >
> > (b) Get the first batch of the clsid which is "ADBE2CC0"
> >
> > Problem :
> >
> > (c) Manually increment "2CCO" ensuring that there would be no
duplication
> > occurs during the generation. (ie. loop 10000 time)
> >
> > ie. 0001
> > ie. 5101 and etc
> >
> > I was given this theory to resolve the duplicate problem, but this
is not
> my
> > field of expertise
> > and I am not sure that I would like to share with you guys.
> >
> > if N > 8  then my_increment = -1
> > else my_increment = 1
> >
> > Please let me know if you need more explicit information. Thanks
All.
> >
> > Any advise would be greatly appreciated.
> >
> > Thanks All in advance.
> >
> > Kenny-
> >
> >
> >
> >
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 25 Jul 2000 14:32:34 EDT
From: abigail@foad.org (Abigail)
Subject: Re: config httpd.conf to run perl script
Message-Id: <slrn8nrn9s.vcg.abigail@alexandra.foad.org>

Chu (chus@netvigator.com) wrote on MMDXX September MCMXCIII in
<URL:news:8lkeeb$66l4@imsp212.netvigator.com>:
|| Dear Perl Specialist,
|| 
||     I have just install Red Hat, which has a apache server.
|| 
||     How to configure the httpd.conf to run the Perl script?


That's not a Perl question. Please consult the Apache manual, or
contact Apache technical support.

Oh, and there's more than one Perl "script" out there.



Abigail
-- 
perl -wle\$_=\<\<EOT\;y/\\n/\ /\;print\; -eJust -eanother -ePerl -eHacker -eEOT


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

Date: Tue, 25 Jul 2000 21:53:21 -0700
From: "Anders Hansson" <hansson.anders@goteborg.utfors.se>
Subject: cookie and redirect trouble...
Message-Id: <8lkqid$1eo$1@yggdrasil.utfors.se>

allright!

My first post in this news group.

I have been trying hard for a couple of days (sad but true!) to set a cookie
and redirect a user from my cgi.
I have tried to do this both by perl and c++. I use an IIS server on win2k
for testing. This is my code in c++ and in perl: (It might look strange,
that I want to set "1" to a cookie named CountVal, but this is only a
simplified example)

file://-------------------- c++ ----------------
    printf ("Location: http://212.105.36.74/test.html\n");
    printf ("Set-Cookie: CountVal=1; path=/; expires=Thu, 27-Jul-2000
00:00:00 GMT\n");
    printf ("\n");


# ------------------------------------------ Perl
print "Location: $fullurl\n";
print "Set-Cookie: CountVal=1; path=/; expires=$expdate;\n";
print "\n";

--------------------------
and to some explaining... I have read tons of tutorials, snips and articles
about cookies, so please dont reply with perldoc references only. The MAIN
problem is that it jumps to the url without setting the cookie.

Here are some additional info:

1. I talked to a guy on mirc, who said that I was to use \r\n for line feed
instead of \n, since I was using IIS. I have tried that, but it didn't work.
I have also tried \n\r, even just \r

2. Fetching the cookie works fine, so that is not the problem.

3. I have tried to switch places between Location: and Set-Cookie, so that I
set the cookie first (didn't work). This has also been done along with
changing the line feed from \n to \r\n, \n\r and \r (see 1.)

4. IF I remove Location: .... the cookie is set, but then again, I cant
redirect the user

 ...Am I forgetting something? Could this issue be serverconfiguration
related?

If you want more info on what Im trying to do: I want to use cgi to set a
counter +1 for each visit the user does to the site thou a cookie, and
increase a counter on a server-file (total counts -> works fine, btw). Then
I want to redirect the user if a certain value is found in a cookie named
Language... So that the correct language.html is displayed... IŽknow how to
do this - but why is it not setting the cookie?

Please help.

Thanks in advance
/Anders Hansson






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

Date: Tue, 25 Jul 2000 20:18:19 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: cookie and redirect trouble...
Message-Id: <8lksm6$64i$1@nnrp1.deja.com>

In article <8lkqid$1eo$1@yggdrasil.utfors.se>,
  "Anders Hansson" <hansson.anders@goteborg.utfors.se> wrote:

> # ------------------------------------------ Perl
> print "Location: $fullurl\n";
> print "Set-Cookie: CountVal=1; path=/; expires=$expdate;\n";
> print "\n";
>

> If you want more info on what Im trying to do: I want to use cgi to
> set a counter +1 for each visit the user does to the site thou a
> cookie, and increase a counter on a server-file (total counts -> works
> fine, btw). Then
> I want to redirect the user if a certain value is found in a cookie
> named Language... So that the correct language.html is displayed...
> IŽknow how to do this - but why is it not setting the cookie?
>

If what you want to do is:

1. Set Cookie, and then

2.  redirect.

why have you written the code to:

1.  redirect, and then

2. Set Cookie.

??


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 24 Jul 2000 11:53:22 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: DB_FILE  --> recovery?  HELP
Message-Id: <8lh772$k27$1@orpheus.gellyfish.com>

In comp.lang.perl.misc Jason J Corso <jcorso@charm.net> wrote:
> Jonathan Stowe wrote in message <8lfak0$b2r$1@orpheus.gellyfish.com>...
>>In comp.lang.perl.misc Jason J Corso <jcorso@charm.net> wrote:
>>> I have a DB_File interfaced database that has become corrupted!!!!
>>>
>>> How do I recover it?
>>>
>>
>>Probably from the backup tapes that you have regularly made right ...
>>
>>;-}
>>
> 
> Yes from the backup tapes...which is what I resorted to...
> 
> But I have read about logging and checkpoint functionality that is bulit
> into the Berkeley DB System.  However, I cannot find any documentation
> pertaining to using this logging and checkpoint functionality via the Perl
> DB_File interface...so as to prevent the need to revert back to  back-up
> tapes and instead use built-in recovery functionality via the checkpoint
> system...
> 
> Know how to use the logging and checkpoint?
> 

Unortuntely the DB_File module only provides the functionality that was
available with version 1 of Berkely DB - thus you dont have access to these
things.  However the manpage recommends that you use the BerkelyDB module
if you need to use the more advanced features.  I havent used it myself
so cant say if it will let you do what you want.

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Tue, 25 Jul 2000 18:00:30 GMT
From: shoaibq@my-deja.com
Subject: Display file size
Message-Id: <8lkkjq$vgs$1@nnrp1.deja.com>

Hi,

I use the stat() function to display the size of file(s) in the
browser. The only problem is that it displays the size in bytes. Is
there a function in Perl that can convert the filesize in bytes to KB,
MB or both?

Thx. in advance.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 25 Jul 2000 18:25:34 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Display file size
Message-Id: <snrmsuqm3j191@corp.supernews.com>

In article <8lkkjq$vgs$1@nnrp1.deja.com>,
     <shoaibq@my-deja.com> wrote:

: I use the stat() function to display the size of file(s) in the
: browser. The only problem is that it displays the size in bytes. Is
: there a function in Perl that can convert the filesize in bytes to KB,
: MB or both?

There are 1024 bytes in a Kb.  There are 1024 * 1024 == 2**20 == 1048576
bytes in a Mb.  Perl provides builtins for unit conversions: +, -, /, *.

Greg
-- 
I received an apology from my sewer pipe root removal service, which
installed a new computer system last April, presumably for Y2K compliance.
They *just* discovered they had missed my annual service last September.
More than 6 months late.  I hope they get to the root of the problem.  --PGN


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

Date: Tue, 25 Jul 2000 20:45:31 +0200
From: "Brendon Caligari" <bcaligari@shipreg.com>
Subject: Re: Display file size
Message-Id: <8lkmm4$3ov$1@news.news-service.com>


<shoaibq@my-deja.com> wrote in message news:8lkkjq$vgs$1@nnrp1.deja.com...
> Hi,
>
> I use the stat() function to display the size of file(s) in the
> browser. The only problem is that it displays the size in bytes. Is
> there a function in Perl that can convert the filesize in bytes to KB,
> MB or both?

yes....if $s is the variable holding the size in bytes, use the following
expression
to conver it to KB

$s /=int(2**(10*cos(log(1))));

B




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

Date: Mon, 24 Jul 2000 12:43:11 +0100
From: Chris Morris <chris.morris@supanet.net.uk>
Subject: Re: Double trouble with CGI.pm or else
Message-Id: <397C2BCF.3200882F@supanet.net.uk>

It is quite possible for the user to click the button twice before the
reload() completes. I suspect you are testing on a fast connection. It is
much safer to
    onClick="if (!locked) form.submit; locked=true;
window.location.reload();"
and in the body tag
    onLoad="locked=false;"
and in the header
    <script>var locked; // have sent to host</script>





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

Date: Tue, 25 Jul 2000 18:19:22 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: empty line
Message-Id: <snrmhagp3j1120@corp.supernews.com>

Bernard El-Hagin (bernard.el-hagin@lido-tech.net) wrote:
: >how to detect an emtpy line?
: 
: If by empty you *really* mean empty you can use:
: 
: if ($string =~ m/^$/){
: 	# Do something
: }

That's both overkill and wrong; it will happily match the non-empty string
"\n".  To detect a zero-length string, do

  $str eq ''

or perhaps

  length $str == 0

: On the other hand if by empty you mean nothing or only whitespace
: (spaces and/or tabs)

Or newlines.

-- 
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "Turning and turning in the widening gyre
   |   The falcon cannot hear the falconer." - Yeats, "The Second Coming"


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

Date: 25 Jul 2000 19:54:35 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: file location and access strategies
Message-Id: <8lkr9r$n7s$3@216.155.32.41>

In article <8ljv27$e8i$1@nnrp1.deja.com>, hacktic@my-deja.com wrote:

 | I know it's a genereal CGI question but consider us unfortunate people
 | that don't get ALL forums forwarded and just have to do with
 | comp.lang.perl.misc as (nearly) only forum source on this topic.

I wasn't aware that deja.com didn't have
   news://comp.infosystems.www.authoring.cgi .. 
perhaps you should have looked more closely? :)

 | What I wanted is to get some feedback on how others would place their
 | files that need to be accessed by both Perl scripts and used in the
 | homepages with regular HTML files. How binary tools should access these
 | files and if there is some alternative solutions to what I am doing.

typically I either put the files in a subfolder near the script, or on 
occasion, somewhere OUTside the cgi-bin/ directory. 

 | I don't get the required info from $ENV{DOCUMENT_ROOT}. It returns the
 | primary webdirectory for my Xitami server and not of the directory
 | where I need to modify the files with the binary tools. But thanks
 | anyway for the tip.
 | 
 | I am still using the abslolute path (c:\inetpub\wwwroot\myfile.gif) 
 | to get to the web-dir where the images are located that need to be 
 | modified with the Perl script and the convert tool. But it looks 
 | like an unprofesional way of doing this. Is this really how its 
 | done? Or are there other solutions to this?

mostly it depends on where your script THINKS it is. it's ok to use 
relative paths provided that you make certain your script knows where it 
is to start with. 

you might also consider looking into the File::Spec module if you will 
be working on port-able code.

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Tue, 25 Jul 2000 18:14:33 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: how do you ? question
Message-Id: <snrm89ja3j142@corp.supernews.com>

Chris (exit72@excite.com) wrote:
: Please don't bother replying if your help is limited to suggestions of
: what perldoc I should read.

Just out of curiosity, why is that?

-- 
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "Turning and turning in the widening gyre
   |   The falcon cannot hear the falconer." - Yeats, "The Second Coming"


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

Date: Tue, 25 Jul 2000 18:26:48 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: how do you ? question
Message-Id: <7ar98igj6d.fsf@merlin.hyperchip.com>


Chris <exit72@excite.com> writes:

> Please don't bother replying if your help is limited to suggestions of
> what perldoc I should read.

Then you don't deserve any help.

--Ala


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

Date: Tue, 25 Jul 2000 19:25:54 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: how do you ? question
Message-Id: <tcqrns4s8567r6cnjgj9q0p3scneep7o47@4ax.com>

Chris wrote:

>How can I make my code rest for a few seconds.

sleep() is the normal procedure.

>I tried sleep and got an error. 

What error?

-- 
	Bart.


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

Date: Tue, 25 Jul 2000 20:34:31 GMT
From: Steven May <stevenjm@telisphere.com>
Subject: Re: how do you ? question
Message-Id: <397DF99C.7DB99F21@telisphere.com>

Chris wrote:
> 
> How can I make my code rest for a few seconds. I want to email the
> results of a generated page in the same script but it sends a blank
> email because the page being generated takes a few seconds to
> complete. I tried sleep and got an error. What I want to do is ..
> Sub Gen {}
> .. wait 3 secs..
> Sub Email {}.
> 
> Please don't bother replying if your help is limited to suggestions of
> what perldoc I should read.
> 
> TIA

Everyone else seemed fixated on the (interesting) closing line, but...

I wonder what you've done that makes you think Perl won't wait for 
a subroutine to finish before tackling tbe next one. 

You don't mention fork, strange as it would be in this
situation as I understand it.

As far as I know, "under normal circumstances", 
if I do something like this

&sub_routine_one;

&subroutine_two;


sub_routine_one will usually either:

 1. return
 2. call another subroutine then return
 3. exit
 4. die 
 
  
subroutine_two ONLY runs if sub_routine_one returns, 
which it could do after a fork, but again I think 
that would be a bit strange for generating a single e-mail.

Unless I'm totally confused (possible) the bit about:

> but it sends a blank
> email because the page being generated takes a few seconds to
> complete.

is a misconception.  

It shouldn't make any difference how long the message
takes to complete in the first sub....

The blank page probably results from a variable scoping issue, 
a simple typo or a total mismatch on variable names or references.

The -w switch may help you sort this out.

my .02

Steve


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

Date: Tue, 25 Jul 2000 21:55:48 GMT
From: Chris <exit72@excite.com>
Subject: Re: how do you ? question
Message-Id: <8g2snscjl8veppgaguo6iumdiksnpgla9m@4ax.com>

Thanks to all those who responded with something useful. 

The answer to your question , I've been watching this group for a long
long time and I'm disgusted with the garbage replies from people that
have no intention of helping. Instead of someone posting a plain
answer to a question or an example they would rather go off and
explain in detail why they know the answer but aren't willing to share
it , but oh here is a link to the manual that will explain. Morons
like that miss the point , we've already been through the doc pages
with no luck if you see a post here.

Chris 





On Tue, 25 Jul 2000 18:14:33 GMT, cberry@cinenet.net (Craig Berry)
wrote:

>Chris (exit72@excite.com) wrote:
>: Please don't bother replying if your help is limited to suggestions of
>: what perldoc I should read.
>
>Just out of curiosity, why is that?



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

Date: Tue, 25 Jul 2000 18:06:23 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: how to print every 91st line
Message-Id: <snrlovbf3j141@corp.supernews.com>

Chris Coffey (ccoffey@nims.wr.usgs.gov) wrote:
: I hope this isn't a stupid question, but how would I print every 91st
: line in one file?  To clarify, I want to first print the 8th line and then
: every 91st line after that.  I don't think it's possible to increment the
: $. operator is it?  Thanks in advance for your he

perl -ne 'print unless ($. - 8) % 91'

-- 
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "Turning and turning in the widening gyre
   |   The falcon cannot hear the falconer." - Yeats, "The Second Coming"


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

Date: 24 Jul 2000 12:02:08 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: LWP UserAgent
Message-Id: <8lh7ng$k39$1@orpheus.gellyfish.com>

On Sun, 23 Jul 2000 14:41:42 GMT yaacovs@my-deja.com wrote:
> Hi,
> 
> I am using the LWP::USERAGENT with HTTP::Request and I seem to be
> having problems with frames.
> 
> Is there any way I can support the use of frames?
> 
> All I get is the main frame, without the wanted page.

Something like :

#!/usr/bin/perl -w

use strict;

use LWP::UserAgent;
use HTML::Parser;
use URI;

my $starturl = shift || die "No url supplied\n";

my $baseuri = URI->new($starturl);

my @urls ;

push @urls,$starturl;

my $agent = new LWP::UserAgent;
my $parser = HTML::Parser->new(api_version => 3,
                               start_h => [\&start ,"tagname, attr"]);

$agent->agent("Gelzilla/666"); 

while( my $url = shift @urls)
{
  my $request = new HTTP::Request 'GET' => $url;

  my $result = $agent->request($request);

  if ($result->is_success) 
    {
      print $result->as_string;
      $parser->parse($result->content);
    } 
  else 
   {
     print "Error: " . $result->status_line . "\n";
   }
}

sub start
{
   my($tag,$attr) = @_;
   if ($tag eq 'frame' ) 
     {
      my $thisuri = URI->new($attr->{src});
      push @urls, $thisuri->abs($baseuri);
    }
}

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Tue, 25 Jul 2000 20:19:58 GMT
From: bing-du@tamu.edu
Subject: Net::LDAP: how to handle connection in case ldap server runs away?
Message-Id: <8lksp9$65h$1@nnrp1.deja.com>

Greetings all...

I have a client script to do routine mass search and update on ldap
server. It's set up to run at 1:30am in a crontab file and usually it
takes about 5 hours to finish its work.  All the script's activities are
recorded in a log file.

One day lately, I noticed in the log file that the script started at the
designated time (1:30am).  But an error message 'I/O Error Connection
reset by peer' on a search showed up at about 10:30am (about 10 hours
later).

I know timeout can be set in:

     $ld = new Net::LDAP($ldap_server,port => $ldap_port) || die "Can't
connect!!!";

According to 'perldoc Net::LDAP', if not set explicitly, the default is
120 (I assume the unit is second).

Also timelimit can be set in search(). If not set, the default is no
limit.

Is it possible with Net::LDAP to specify reconnect attempts if the ldap
server goes away (with appropriate limits on time between attempts and
on the total number of attmepts to connect)?

Any help would be greatly appreciated.

Bing


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 25 Jul 2000 18:57:49 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: NetBIOS/nbname ???
Message-Id: <8lknvd$n7s$0@216.155.32.41>

In article <397CB857.4E884DC1@stomp.stomp.tokyo>, "Godzilla!" 
<godzilla@stomp.stomp.tokyo> wrote:

 | Doesn't work for MAC / Apple and some
 | Linux systems. Those are not computers
 | but rather fancy Etch-A-Sketch toys.

I beg to differ.. Mine's every bit as much a computer as anyone else's 
is. 

As long as mine does exactly what I need it to with the elegance and 
simplicity I desire of it, without getting in my way, why should it 
matter to you anyway? I more than satisfied with it, and that is 
sufficient explanation. 

Besides, Have you tried it with MacOS X ? :P

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Tue, 25 Jul 2000 13:58:22 -0700
From: Gorbeast <gorbeast@SPAMSUCKS.subduction.org>
Subject: Newbie: Error message with write/format
Message-Id: <397DFF6E.3CA1F00D@SPAMSUCKS.subduction.org>

Hi people,

I cant figure out what is wrong with this script - I get the following
error: 'syntax error at [script] line 21, next char ; Execution of
[script] aborted due to compilation errors. '  It's really frustrating
because I cant fathom what is wrong, except maybe you have to have more
than one item when creating a report?  I hope its just a typo I am
missing.  All I want is $name to be filled in, the rest of the fields to
be filled in by hand later.  Please advise & TIA 
Regards,
Gjiwansk


----
#use strict;

foreach my $name_list ( @ARGV ) {

    open(NAME_LIST, $name_list) || die "Can't open file: $!\n";

    while (defined( $name = <NAME_LIST> ) ) {
chomp;
write(STDOUT);

}

}

format STDOUT =

     |  @<<<<<<<<<<<<<<<<<<<<<<<<<<  |               
|                  
==========================================================================
$name
 .


format STDOUT_TOP =

Page @<<

$%
                                
==========================================================================
Date |          Name           |  Favorite Food  |      Musical Group  
==========================================================================
 .


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

Date: Tue, 25 Jul 2000 14:01:10 -0700
From: Gorbeast <gorbeast@SPAMSUCKS.subduction.org>
Subject: Re: Newbie: Error message with write/format
Message-Id: <397E0016.64E8121F@SPAMSUCKS.subduction.org>

I see that the format = STDOUT got screwed up when I posted this
article, but I hope you get idea :) 

Gorbeast wrote:
> 
> Hi people,
> 
> I cant figure out what is wrong with this script - I get the following
> error: 'syntax error at [script] line 21, next char ; Execution of
> [script] aborted due to compilation errors. '  It's really frustrating
> because I cant fathom what is wrong, except maybe you have to have more
> than one item when creating a report?  I hope its just a typo I am
> missing.  All I want is $name to be filled in, the rest of the fields to
> be filled in by hand later.  Please advise & TIA
> Regards,
> Gjiwansk
> 
> ----
> #use strict;
> 
> foreach my $name_list ( @ARGV ) {
> 
>     open(NAME_LIST, $name_list) || die "Can't open file: $!\n";
> 
>     while (defined( $name = <NAME_LIST> ) ) {
> chomp;
> write(STDOUT);
> 
> }
> 
> }
> 
> format STDOUT =
> 
>      |  @<<<<<<<<<<<<<<<<<<<<<<<<<<  |
> |
> ==========================================================================
> $name
> .
> 
> format STDOUT_TOP =
> 
> Page @<<
> 
> $%
> 
> ==========================================================================
> Date |          Name           |  Favorite Food  |      Musical Group
> ==========================================================================
> .

-- 
"If I had one wish, I would ask for a big enough ass for the whole world
to kiss." 
--Marshall Mathers


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

Date: Tue, 25 Jul 2000 18:23:15 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Open File and Change Case
Message-Id: <snrmojql3j197@corp.supernews.com>

David Ness (DNess@Home.Com) wrote:
: Horse Nuts wrote:
: > Ho would I go about opening a file, and changing the case of all the
: > letters to lower case??
: 
: In Windows (NT)
: 
:   perl -w -p -e "tr/a-z/A-Z/;" <in >out
: 
: seems to do it, converting file `in' into file `out'

But this isn't aware of locale-specific case issues.  Also, it sounds like
the OP wants to do it "in place".  I'd prefer

  perl -i.bak -wne 'print lc' file

which preserves the original version in file.bak.

-- 
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "Turning and turning in the widening gyre
   |   The falcon cannot hear the falconer." - Yeats, "The Second Coming"


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

Date: Tue, 25 Jul 2000 12:36:59 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: Open File and Change Case
Message-Id: <397DEC5B.BF409D55@ipac.caltech.edu>

Horse Nuts wrote:
> 
> Yes, but how do I replace the lower case names in the same file???

man perlrun

 ... and read up on the -i option. Something like (untested)

perl -pi -wle 's/(.*)/\L$1/' filelist ... 

--

-- Tim Conrow         tim@ipac.caltech.edu       626-395-8435


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 3800
**************************************


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