[10050] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3643 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 5 13:06:24 1998

Date: Sat, 5 Sep 98 10:00:20 -0700
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, 5 Sep 1998     Volume: 8 Number: 3643

Today's topics:
    Re: "reading line by line from a file until condition i (M.J.T. Guy)
    Re: "reading line by line from a file until condition i (M.J.T. Guy)
    Re: [Q] Copying directories (Jonathan Stowe)
    Re: A short question (Jonathan Stowe)
        chmod 755 from a cgi output jeff2591@my-dejanews.com
    Re: cmd parsing when using Net::Telnet (Jonathan Stowe)
    Re: Configure Perl32 for IIS4 (Jonathan Stowe)
        Custom software programming, web-design (Andey)
    Re: Custom software programming, web-design (Bob Trieger)
    Re: DeCrypt ? (Stefan Scholl)
    Re: Does any one have a news gatherer script? (Jonathan Stowe)
        help with mail sending. (Ewgeniy Kartavtchenko)
    Re: INSERT .PL in .HTML <samwang@freewwweb.com>
        JAVA Sessions at COMDEX Enterprise Frankfurt <zicari@ltt.de>
        Looking for Perl rtf/word to html conversion app. . . <mshiltonj@yahoo.com>
    Re: Looking for Perl rtf/word to html conversion app. . (Larry Rosler)
    Re: Looking for Perl rtf/word to html conversion app. . <rmlynch@best.com>
    Re: Net::FTP output/debug question? (Jeffrey Drumm)
    Re: Newbie OO question <merlyn@stonehenge.com>
    Re: no form feed in format? (Jonathan Stowe)
    Re: Perl & Java - differences and uses <os@camelot.de>
    Re: Perl gurus opinion needed. <thor@eznet.net>
    Re: Perl (Jonathan Stowe)
    Re: Problems with large numbers (M.J.T. Guy)
    Re: Problems with large numbers (M.J.T. Guy)
    Re: reading a file backward (Jonathan Stowe)
    Re: reading a file backward (Mark-Jason Dominus)
    Re: reading a file backward (Larry Rosler)
    Re: reading a file backward (Malcolm Hoar)
    Re: Tom Phoenix: ANSWERS WANTED! (Rich)
    Re: URGENT: How do I post to a newsgroup from a perl ro (Rich)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 5 Sep 1998 16:22:15 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: "reading line by line from a file until condition is met"
Message-Id: <6srofn$8q5$1@pegasus.csx.cam.ac.uk>

In article <6sp9hu$cgd$1@nnrp1.dejanews.com>,  <lsgs@my-dejanews.com> wrote:
>
>if ($query eq "home"){
>
>  open (DATABASE,"new_data/list.db") || die("Cannot open
>database: $!");
>
>   while (<DATABASE>) {

           chomp;  # get rid of trailing newline on password

>          @record = split(/\:/, $_);
>      if ($record[0] eq $name and $record[1] eq $passwd) {
>      close ("DATABASE");
>      &display;
>    }
>
>
>
>    else {
>       close ("DATABASE");
>
>&noway;
>
>     }
>
>  }
>
>}


Mike Guy


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

Date: 5 Sep 1998 16:26:28 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: "reading line by line from a file until condition is met"
Message-Id: <6sronk$8rs$1@pegasus.csx.cam.ac.uk>

Brad Murray  <murrayb@vansel.alcatel.com> wrote:
>lsgs@my-dejanews.com writes:
>
>>    while (<DATABASE>) {
>>           @record = split(/\:/, $_);
>>       if ($record[0] eq $name and $record[1] eq $passwd) {
>>       close ("DATABASE");
>>       &display;
>>     }
>
>You're closing your file before you're finished with it.

Looks to me like he's finished with it  -  he's found the information
he wanted.   Of course, if the subroutine &display ever returns, it
would be better to follow it with  last;.    And it would be better
style to put the close on the fail route as well.

But his real problem is elsewhere  -  see my other reply.


Mike Guy


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

Date: Sat, 05 Sep 1998 13:59:46 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: [Q] Copying directories
Message-Id: <35f1400a.11504096@news.btinternet.com>

On 4 Sep 1998 09:32:20 -0700, Graffiti wrote :

>Hi all,
>
>	Is there a way to do something like:
>
>use File::Copy;
>
>	move("/tmp/dir1","/tmp/dir2");
>
>across filesystems? I need to move a directory from one
>filesystem to another, and was wondering if there was an
>easy way to do it.  The above didn't work.  It complained
>of a cross-device link. :/
>

If you are on a unix system which I assume you are - I would recommend
using cpio rather than writing something in Perl, like :

find /tmp/dir1 -depth -print | cpio -pvdum /tmp/dir2

Alternatively you could copy the files using File::Copy (and probably
using File::Find to get all of the files ) and then delete them
afterwards.

/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sat, 05 Sep 1998 13:03:15 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: A short question
Message-Id: <35f11fdd.6175272@news.btinternet.com>

On Sat, 05 Sep 1998 11:30:53 +0200, Antonio Cisternino wrote :

>I wrote this program (that must be stored in a file called 't'):
>
>open(I,"<t");print<I>
>
>There is a shortest program that print itself? I'm a novice Perl
>programmer and I don't know all the required tricks?
>Another question: anyone has written the shortest Perl program that
>writes itself?
>

Of course you cheated by not checking the result of the open ;-}

Whilst not shorter this will work whatever the file is called:

seek(DATA,0,0);while (<DATA>){ print };
__END__

And of course I cheated by not checking the result of the seek.

You could of course have used $0 instead of an explicit filename.

Have fun

/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sat, 05 Sep 1998 15:52:34 GMT
From: jeff2591@my-dejanews.com
Subject: chmod 755 from a cgi output
Message-Id: <6srmo3$e74$1@nnrp1.dejanews.com>

Can someone tell me how to make my cgi output
created from:
pring Content-type: text/html
set to where i can use server side includes.

For example,
at:
http://www.lifesprings-resources.com/
index2.html
you'll notice the random stuff going on using ssi.

But at:
http://www.lifesprings-resources.com/cgi-bin/
jsearch.cgi
you'll notice the ssi stuff doesn't work. The page
header is the same.

I know it's possible because there are all these
search engines with ads at the tops of their pages
but you're actually in the cgi script still.

Is there help out there?



-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Sat, 05 Sep 1998 13:59:47 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: cmd parsing when using Net::Telnet
Message-Id: <35f14231.12055048@news.btinternet.com>

On Fri, 04 Sep 1998 14:42:02 +0100, Raj Subramani wrote :

>I'm sending a "ps -ef | grep foo | grep -v grep"
>command via Telnet's cmd function.
>
>Say, I start three foo processes:
>(raj)~/perl # jobs
>[1] +Running          foo
>[2] -Running          foo
>[3]  Running          foo
>
>
>
>When I execute my perl script:
>...
>@psList = &executeCmd("ps -ef | grep foo | grep -v grep");
>$total = @psList;
>print("Number of foo processes is $total\n");
>print("@psList\n");
>

I cant test this right now but what about doing something like:

@pslist = grep /foo/, &executeCmd("ps -ef");

/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sat, 05 Sep 1998 13:59:43 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Configure Perl32 for IIS4
Message-Id: <35f13c44.10791609@news.btinternet.com>

On Fri, 04 Sep 1998 22:16:07 GMT, Bim Paras wrote :

>
>Can anyone please tell me how to get Perl32 working on IIS4. I know
>there's something you have to do in the registry. Do you also have to
>configure something in IIS4? Please reply to bimp@bigfoot.com. Thanks
>

This is not really a question for this group - you should really be
asking in comp.infosystems.www.servers.ms-windows

IIS has all of its documentation online - and certainly with IIS3 this
stuff was documented.  The phrase you are looking for is "Script Map".

/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sat, 05 Sep 1998 13:32:32 GMT
From: spbiz@iname.com.not.for.spam (Andey)
Subject: Custom software programming, web-design
Message-Id: <35f13bf0.2608173@news.infopro.spb.su>

Dear Sirs,

The group of qualified programmers and designers from Russia develops
custom application software with high quality and low prices.

Custom Windows 95, Windows 3.1 and DOS applications:
* information systems
* data bases
* CAD systems
We work with Delphi, C++, Visual Basic, Pascal, Assembler...

WWW-service:
* virtual server hosting
* web site design, graphics, animation
* Internet applications (Perl, Java-script), such as:
  * data bases for the web
  * virtual shops
* English-Russian language translation
* promouting web sites in the Internet

Call us by e-mail: baltis@netexecutive.com
Looking forward to working with you !

PS: we also interested in partnership with US and Europe companies
and freelance persons.



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

Date: Sat, 05 Sep 1998 14:24:38 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Custom software programming, web-design
Message-Id: <6srhpm$i5r$1@strato.ultra.net>

spbiz@iname.com.not.for.spam wrote:
-> Dear Sirs,

>>> Spam snipped <<<

Don't you love it when somebody munges their address to avoid spam while 
spamming?

I just hope the spam crawlers are working today:

spbiz@iname.com
spbiz@iname.com
spbiz@iname.com
spbiz@iname.com
spbiz@iname.com
spbiz@iname.com
spbiz@iname.com
spbiz@iname.com
spbiz@iname.com
spbiz@iname.com
spbiz@iname.com
spbiz@iname.com
spbiz@iname.com
spbiz@iname.com

Bob Trieger              | `The Best Marketing Service' is spamming
sowmaster@juicepigs.com  | with their 800 number. Do them a favor and
                           call to let the know that spamming is evil
                           and do it on their dime.

                           Call (800) 600-0343 Ext. 1373


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

Date: 5 Sep 1998 13:03:29 GMT
From: stesch@parsec.rhein-neckar.de (Stefan Scholl)
Subject: Re: DeCrypt ?
Message-Id: <slrn6v2dl1.anb.stesch@parsec.rhein-neckar.de>

perldoc -tq crypt


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

Date: Sat, 05 Sep 1998 13:59:41 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Does any one have a news gatherer script?
Message-Id: <35f13b55.10552465@news.btinternet.com>

On Sat, 05 Sep 1998 12:26:53 +0800, Anand Aiyer wrote :

>Does any one have a news gatherer script?, if so please mail me.
>

Of course you should have checked out perlfaq9 before you posted:

<quote>

  How do I fetch a news article or the active newsgroups?

    Use the Net::NNTP or News::NNTPClient modules, both available
    from CPAN. This can make tasks like fetching the newsgroup list
    as simple as:

        perl -MNews::NNTPClient
             -e 'print News::NNTPClient->new->list("newsgroups")'

</quote>

Some will find your request highly suspicious - but you will have to
give me scouts honour that you arent going to use this for purposes of
spamming now are you ;-}

/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sat, 05 Sep 1998 14:56:29 GMT
From: ewgeniyk@rs34.ssau.ru (Ewgeniy Kartavtchenko)
Subject: help with mail sending.
Message-Id: <35f14f6e.18988370@news.ssau.ru>

Hi.

I want to send email from perl-script without any questions and
notifications. All of scripts, that i've seen, used
"/usr/lib/sendmail" file. But it isn't work... Certainly, the way to
solve it is exist, but I don't know it. 
Can anybody help me ? Of course, I'll be very thankful if somebody
dlows some pl-code in me...

EWG


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

Date: Sat, 05 Sep 1998 07:34:22 -0500
From: Sam Wang <samwang@freewwweb.com>
Subject: Re: INSERT .PL in .HTML
Message-Id: <35F12FCD.831ED22C@freewwweb.com>

i do believe you can use ssi include. just let the perl script generate
output to STDIN. you might have to insert a Content-type: text/html\n\n
before the output, not sure.

Cristsbal Hormazabal wrote:

> Hi!
>
> I've made a voting script and I want to show the results in
> the middle of a HTML page... I need the HTML page to call
> the CGI script in some way. I've tried the EXEC in SSI but
> my web administrator said that that function is disabled.
> Is there another way to do this than using SSI? A friend of
> mine says that one can use something like:
> <VOTESTART YES>56</VOTESTART>
> Is it possible?
>
> please send me your tips to: cristo@consotech.se
>
> /Best Regards Cristo
>



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

Date: Sat, 05 Sep 1998 18:42:24 +0200
From: Roberto Zicari <zicari@ltt.de>
Subject: JAVA Sessions at COMDEX Enterprise Frankfurt
Message-Id: <35F169EE.420C715@ltt.de>

COMDEX Enterprise Frankfurt `98 -- Where Technologies become Solutions...

Dear Colleague

The COMDEX Enterprise Frankfurt`98 trade show is an exhibits and a set of
conferences focused on IT technologies and solutions for the Enterprise.

COMDEX Enterprise Frankfurt`98 will take place on Sept.28-Oct.1, at the
Frankfurt Fairgrounds.

COMDEX Enterprise Frankfurt`98 includes 7 conferences:

- BankersIT Forum
- COMDEX Internet
- OBJECT WORLD
- META Briefing
- TelecomIT Forum
- Windows NT Forum
- CA Enterprise Solutions

The full conference program is available at http://www.comdex.de

Bona fide educational institutions can claim a 50% discount on the
conference prices.

** If you wish to receive a printed copy of the COMDEX Enterprise conference
brochure, and/or a free ticket for the exhibits,the keynotes and the special
events, please send us your postal address, by E-mail: Logon@ltt.de, or by
fax. +49-6173-94 04 20.

Please post this info as you see proper.

Best Regards

Roberto Zicari
Chairman Advisory Board
COMDEX Enterprise Frankfurt


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

Date: Sat, 05 Sep 1998 15:07:36 GMT
From: M Steven Hilton Jr <mshiltonj@yahoo.com>
Subject: Looking for Perl rtf/word to html conversion app. . .
Message-Id: <6srk3n$b79$1@nnrp1.dejanews.com>

 ... and I can't find it.

Either an rtf to html or word to html convert would suit my needs.

It's not on CPAN, and I can't seem to locate it with Infoseek or Altavista.

I know they exist, because I've seen it referenced, but no additional info --
or link -- was provided.

If anyone knows of a page where I can download the app,  or even the app's
homepage, I will be most appreciative.

If anyone remembers the author or specific name of the app that I can search
for, that will be fine too. I've tried all sorts of combination: rtf2html,
rtftothml, etc., to no avail.

Thanks,


--
M. Steven Hilton, Jr. <mshiltonj@yahoo.com>

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Sat, 5 Sep 1998 08:52:57 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Looking for Perl rtf/word to html conversion app. . .
Message-Id: <MPG.105afe3493a6612898982b@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <6srk3n$b79$1@nnrp1.dejanews.com> on Sat, 05 Sep 1998 15:07:36 
GMT, M Steven Hilton Jr <mshiltonj@yahoo.com> says...
 ...
> Either an rtf to html or word to html convert would suit my needs.
> 
> It's not on CPAN, and I can't seem to locate it with Infoseek or Altavista.

A search of this newsgroup for 'rtf' via DejaNews would have produced the 
following:

http://user.cs.tu-berlin.de/~schwartz/pmh/index.html

in less time than it took you to post this request.

The name of the tool is 'Laola'.  I haven't tried it yet, but intend to.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sat, 05 Sep 1998 08:58:03 -0700
From: Robert Lynch <rmlynch@best.com>
Subject: Re: Looking for Perl rtf/word to html conversion app. . .
Message-Id: <35F15F8B.1728781D@best.com>

M Steven Hilton Jr wrote:
> 
> ... and I can't find it.
> 
> Either an rtf to html or word to html convert would suit my needs.
> 
> It's not on CPAN, and I can't seem to locate it with Infoseek or Altavista.
> 
> I know they exist, because I've seen it referenced, but no additional info --
> or link -- was provided.
> 
> If anyone knows of a page where I can download the app,  or even the app's
> homepage, I will be most appreciative.
> 
> If anyone remembers the author or specific name of the app that I can search
> for, that will be fine too. I've tried all sorts of combination: rtf2html,
> rtftothml, etc., to no avail.
> 
> Thanks,
> 
> --
> M. Steven Hilton, Jr. <mshiltonj@yahoo.com>
> 
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum

There is a hybrid C/Perl thingie, Word8 -> html called mswordview:
----------
[user@ravel user]$ mswordview -v
mswordview 0.1.0
writen by Caolan.McNamara@ul.ie
web page for updates at 
http://www.gnu.org/~caolan/docs/MSWordView.html   or
http://www.csn.ul.ie/~caolan/docs/MSWordView.html
---------
Hope it helps.

Bob L.

-- 
Robert Lynch-Berkeley CA USA-rmlynch@best.com
http://www.best.com/~rmlynch/


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

Date: Sat, 05 Sep 1998 14:03:44 GMT
From: drummj@mail.mmc.org (Jeffrey Drumm)
Subject: Re: Net::FTP output/debug question?
Message-Id: <35f13872.136856480@news.mmc.org>

[posted and mailed]

On Wed, 02 Sep 1998 05:54:59 -0700, Web Thumper <thumper@webthumper.com>
wrote:

>How do see the output from Net::FTP??
>
>What is the array (@messages) where the output ftp messages are stored.
>I know that I have seen something (an example) of how to do this in this
>news group, but I searched and could not find anything.  I also checked
>the FAQ at CPAN and there is no details...besides using the Net::Cmd
>module and that didn't really make sense when I read the docs on that
>module...at least to me.
>
>All I want to do is see the output from the ftp client...so I can tell
>if my perl script is actually doing something.  I have "prints" in
>between the $ftp->command statements so I can see that it is going
>through the script, but I cannot tell what the actual ftp command output
>is.

There are two ways to see what's going on; one is to print the output of
$ftp->message (assuming your ftp object is called $ftp), and the other is
to turn on debug.

The former:

$ftp->get('remote_name','local_name') or die $ftp->message;
print 'Command result: ',$ftp->message;

The latter, which is quite verbose and is normally done through the new()
method:

my $ftp = Net::FTP->new('hostname', Debug => 1) or die "Failed: $@\n";

Good luck!

-- 
                           Jeffrey R. Drumm, Systems Integration Specialist
                                  Maine Medical Center Information Services
                                     420 Cumberland Ave, Portland, ME 04101
                                                        drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented." -me


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

Date: Sat, 05 Sep 1998 15:42:46 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: Newbie OO question
Message-Id: <8ciuj2wopn.fsf@gadget.cscaper.com>

>>>>> "Jonathan" == Jonathan Stowe <Gellyfish@btinternet.com> writes:

Jonathan> sub setSubs() {
Jonathan>         my @list = ( 
Jonathan>                 \&subzero,
Jonathan>                 \&subone,
Jonathan>                 \&main::subtwo
Jonathan>         );
Jonathan>         return \@list;
Jonathan> }

Although this is probably a snippet of a larger piece of code, I
would have written this differently if it was intended to produce
exactly this result:

	sub setSubs() {
		[
			\&subzero,
			\&subone,
			\&main::subtwo,
		];
	}

Much cleaner.  Don't create unnecessary intermediate variables unless
they greatly add to the readability.

print "Just another Perl hacker,"
-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Sat, 05 Sep 1998 13:59:44 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: no form feed in format?
Message-Id: <35f13dd5.11037343@news.btinternet.com>

On Fri, 4 Sep 1998 17:15:50 -0400, Thomas Wong wrote :

>Hi,
>How can one avoid the form feed/page break when using a format statement?  I
>just want the $FORMAT_TOP_NAME ($^) variable appears once on the top of the
>page and the rest of the output should be written out continuously through
>the bottom of the page. Any help would be greatly appreciated.
>
I'm not a big format user but I figure that you could mickey the
variables such as $= ($FORMAT_LINES_PER_PAGE) or $-
($FORMAT_LINES_LEFT) in order to fool the formatting mechanism that it
hasnt got to the end of the page yet.

You probably could do with checking the perlform manpage

>
>begin 666 Thomas Wong.vcf
>M0D5'24XZ5D-!4D0-"E9%4E-)3TXZ,BXQ#0I..E=O;F<[5&AO;6%S#0I&3CI4

Aw c'mon MIME vcards are bad enough but this is ridiculous.  And hey
the spammers cant get hold of your address to send you junk mail if
the spam fails ;-}

/J\
>
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sat, 05 Sep 1998 11:33:43 +0200
From: Oliver Scheel <os@camelot.de>
Subject: Re: Perl & Java - differences and uses
Message-Id: <35F10577.70AC3E57@camelot.de>

Robert McDermid wrote:
> 
> You might also consider looking into the Python language.  It is
> generally useful for all the same things as Perl is, and while not
> quite as wide-spread is well on it's way.  It also, IMHO, produces

I switched for newer projects from Perl to Python because it is more
readable (Perl is write only code ;-)), it comes with a real huge
_standard_ library (especially for Internet) and contains from version
1.5 on the Perl regular expressions, and it is real object oriented and
not "hacked in" like in Perl.

Don't misunderstand me: Perl remains a real cool language and I don't
want to miss it!

Oliver

-- 
http://www.camelot.de/~os/

     best things in life are free


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

Date: 5 Sep 1998 14:02:29 GMT
From: thor <thor@eznet.net>
Subject: Re: Perl gurus opinion needed.
Message-Id: <35F1467E.1780FAA7@eznet.net>

Tom Phoenix wrote:
> 
> A little over a year ago, just after the first Perl Conference, I asked
> Larry and some others if they knew of a good collective noun for Perl
> programmers, developers, or hackers. So far, I haven't seen anything worth
> propagating.
> 
> But I like the idea of calling folks who work on the Perl documentation
> "POD people". :-)
> 

why not just "perl" as in:

j: "are you perl?"
k: "yeah, man; i'm perl"
j: "what about her?"
k: "she's WAY perl!"


thor


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

Date: Sat, 05 Sep 1998 13:03:17 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Perl
Message-Id: <35f121dc.6568920@news.btinternet.com>

On Fri, 04 Sep 1998 20:55:04 -0700, Lisa wrote :

>Hi. I saw your name in the news group. Sorry for the unsolicited e mail, 

Shorely Shome mishtake here ?

>but i didn't think anyone would respond to my question because of so many messeges in
>the news group. :)  

But on a Saturday morning there's just you me and a few other twisted
individuals - I have only received 26 messges since 3:30 this morning.

>                     Anyway, i was just wondering, would you know of a simple
>script that will take the input from a form, and write it to a file, so that i can
>ftp any time i want and retrieve the file and it's contents. The file would need to include
>file locking, so i'm not sure if the file would acutally be a database file. 

Under normal circumstances you'd be shown the door with some advice as
to what alternative resources are available to you but I'm in a benign
mood and its a slow news day.  

Follows is a simplistic example that demonstrates the principles of
what you want to achieve - I wouldnt categorize it as production code
by any stretch of the imagination.

#!/develop/bin/perl -w 

# use CGI.pm and import standard symbols

use CGI qw/:standard/;

# import Symbols for use with flock

use Fcntl qw/:flock/;

# print HTTP header and start HTML page

print header(),
      start_html("Test CGI"),"\n";

if( param ) # if there are any form fields
{
  @params = param; put field names in array

 # open file in append mode
  if(open(OUTFILE,">>outfile.txt"))
    {
      if(flock OUTFILE,LOCK_EX) # exclusive lock
        {
          # iterative through sorted list of field names

          foreach $parameter ( sort @params)
            {
               # push field values onto array

               push @out,param($parameter);
            }
          # in case someone had appended to file before we got lock
          # seek to the end of the file

          seek (OUTFILE,0,2);
          # print comma separated record of values
          print OUTFILE join("," , @out),"\n";
          flock OUTFILE,LOCK_UN;  # unlock file
          print h1("Details stored successfully"),"\n";
        }
      else # lock failed
       {
          print h1("Couldnt lock file"),"\n";
       }
      close OUTFILE;
    }
  else # file open failed
    {
      print h1("Error opening file"),"\n";
    }
}
else
{
  print h1("No form data sent");
}

print end_html(),"\n";
__END__

If you have any difficulty in understanding bits of this you should
read the documentation for CGI and the perlfunc documentation for the
various functions used.

>                                                                              Sorry if the
>question is kind of lame, but i'm new to perl if in case you already had not guessed. :)
>
I would recommend getting some good book on the subject as well as
reading the wealth of documentation that comes with the Perl
distribution.

>Thanks, Lisa.
>

/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: 5 Sep 1998 16:05:57 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Problems with large numbers
Message-Id: <6srnh5$830$1@pegasus.csx.cam.ac.uk>

Eric Ladner  <clad@chevron.com> wrote:
>This works:
>
>$n = rand(2**53);
>print "$n\n";
>
>This doesn't:
>
>$n = rand(2**53);
>printf "%016d\n", $n
>
>I assume it has something to do with the size of the number and that 
>the printf is just a call to the normal stdio version.

Actually, modern Perls have their own s?printf code.   But it still has
the limitation that %d only works on signed integers, giving you a limit
of 2**31 on most platforms.

Instead, do

 printf "%016.0f\n", $n;


I know you were only using it for an example, but note also that  rand(2**53)
isn't a very sensible thing to do.    Most (all?) platforms supply much
less than 53 random bits; many give only 15.   So you'll get a lot of
zero bits.


Mike Guy


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

Date: 5 Sep 1998 16:07:29 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Problems with large numbers
Message-Id: <6srnk1$83a$1@pegasus.csx.cam.ac.uk>

Jonathan Stowe <Gellyfish@btinternet.com> wrote:
>
>Does using %e instead of %d help ?

Presumably you mean %.0f rather than %e, to get output comparable with %d?


Mike Guy


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

Date: Sat, 05 Sep 1998 13:59:39 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: reading a file backward
Message-Id: <35f1383d.9815921@news.btinternet.com>

On Sat, 05 Sep 1998 10:15:49 +0800, sekchye wrote :

>Hi.  I need to read in a huge log file line by line starting from last
>line to the first line.  
>
>How do I do this in PERL?  (Not by using `tac` or reading the whole file
>into array and then reverse the array)
>
If you have a file of fixed known record length then it would be
possible to seek to the end of the file then seek backwards a records
length then read it seek back two records read a record , back two
records and read and so on.

However if that is not the case then any solution is going to involve
reading the whole file in some way whether into an array or whatever.

That could be as simple as:

@file_in_reverse = reverse <FILE>;

of course.

>TIA for any help.

/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: 5 Sep 1998 10:43:53 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: reading a file backward
Message-Id: <6srin9$5hv$1@monet.op.net>

In article <35f1383d.9815921@news.btinternet.com>,
Jonathan Stowe <Gellyfish@btinternet.com> wrote:
>@file_in_reverse = reverse <FILE>;

There really ought to be a module that reads lines from a file starting
at the end.

use IO::Handle::Backwards;
$fh = new IO::Handle::Backwards $filename
  or die ...;
while (<$fh>) {
  # do something with the current record
}


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

Date: Sat, 5 Sep 1998 08:37:21 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: reading a file backward
Message-Id: <MPG.105afa8bd91612eb98982a@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <35f1383d.9815921@news.btinternet.com> on Sat, 05 Sep 1998 
13:59:39 GMT, Jonathan Stowe <Gellyfish@btinternet.com> says...
> On Sat, 05 Sep 1998 10:15:49 +0800, sekchye wrote :
> 
> >Hi.  I need to read in a huge log file line by line starting from last
> >line to the first line.  
 ... 
> However if that is not the case then any solution is going to involve
> reading the whole file in some way whether into an array or whatever.

Obviously one must read the whole file in order to print it, but I don't 
think it need all be in memory at once as you imply.  I just tossed the 
following off:

#!/usr/local/bin/perl -w
use strict;

my (@offsets, $offset);
my $file = $0; # for testing

open IN, $file or die "Couldn't open $file. $!\n";
do { push @offsets, tell IN } while <IN>;
while (defined ($offset = pop @offsets)) {
    seek IN, $offset, 0 or die "Couldn't seek to $offset. $!\n";
    print scalar <IN>;
}
__END__

The file is never in memory more than one line at a time!

I thought I had read about this in perlfaq6 but couldn't find it.  What I 
*had* read was the following from the Perl Cookbook, 8.4 "Reading a File 
Backwards by Line or Paragraph":

   You must read the lines into memory, then process them in reverse
   order.  Needless to say, this requires at least as much available
   memory as the size of the file.

Now I can think of easy ways of improving my code, for example, by adding 
logic to do backward seeks from the current position instead of simply 
seeking from the beginning (which would make an enormous difference if 
the file were on a sequential medium such as a tape).  But the big 
question is this:

Are you and the Cookbook simply wrong about having to store the whole 
file instead of an array of line offsets, or am I hallucinating?  How is 
this approach different from indexing a database file to provide speedy 
random access, except that here the index is created on the fly in 
memory?
 
-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sat, 05 Sep 1998 16:43:51 GMT
From: malch@malch.com (Malcolm Hoar)
Subject: Re: reading a file backward
Message-Id: <6srpo9$ojo$1@nntp1.ba.best.com>

In article <MPG.105afa8bd91612eb98982a@nntp.hpl.hp.com>, lr@hpl.hp.com (Larry Rosler) wrote:

>Now I can think of easy ways of improving my code, for example, by adding 
>logic to do backward seeks from the current position instead of simply 
>seeking from the beginning (which would make an enormous difference if 
>the file were on a sequential medium such as a tape).  But the big 
>question is this:
>
>Are you and the Cookbook simply wrong about having to store the whole 
>file instead of an array of line offsets, or am I hallucinating?  How is 
>this approach different from indexing a database file to provide speedy 
>random access, except that here the index is created on the fly in 
>memory?

Yes, IMO. A couple of things I have done in the past with variable
length record files that were too large to slurp into memory:

1. Use a .db file indexed by line number.

2. Create (or recreate) the file with zero padded line numbers and
   use GNU sort to reverse it before processing.


-- 
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
| Malcolm Hoar           "The more I practice, the luckier I get". |
| malch@malch.com                                     Gary Player. |
| http://www.malch.com/               Shpx gur PQN.                |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: 5 Sep 1998 13:44:15 GMT
From: richm@ucesucks.mulveyr.roc.servtech.com (Rich)
Subject: Re: Tom Phoenix: ANSWERS WANTED!
Message-Id: <slrn6v2fv4.m05.richm@ll.aa2ys.ampr.org>

On Tue, 01 Sep 1998 18:27:07 GMT, Nathan V. Patwardhan <nvp@shore.net> wrote:
>Andre L. (alecler@cam.org) wrote:
>: It is quite unreasonable to demand answers like you do. The man has the
>: right to respond in the manner he deems appropriate, and that is all.
>
>I believe that what you are looking for is a means in which to
>suppress my right to be critical!  It's not an attempt to slam Tom's
>efforts but to focus his attention on problem solving and not going
>overboard with precanned materials.  Hope this helps!
>

   My wife is allowed to focus my attention.  On occasion, I allow my
employer to do so.  Random strangers on USENET fall into neither of those
catagories, and any of them who profess to want to "help" me in that
fashion are considered to be presumptuous at best, and I won't get into
what they may be, at worst.  I suspect that I'm not the only one
who feels this way.

- Rich

--
Rich Mulvey                                         
My return address is my last name, 
   followed by my first initial, @mulveyr.roc.servtech.com        
http://mulveyr.roc.servtech.com
Amateur Radio: aa2ys@wb2wxq.#wny.ny.usa


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

Date: 5 Sep 1998 13:49:25 GMT
From: richm@ucesucks.mulveyr.roc.servtech.com (Rich)
Subject: Re: URGENT: How do I post to a newsgroup from a perl routine?
Message-Id: <slrn6v2g8r.m05.richm@ll.aa2ys.ampr.org>

On Tue, 1 Sep 1998 08:33:08 -0700, Mick Knutson <NoSpam_mknutson@websolution.com> wrote:
>URGENT: How do I post to a newsgroup from a perl routine?
>
>I would like to get a subroutine that will post a message to a news group
>when called.  Is there a subroutine that you can help me with?
>

   Do you mind if the module eliminates any posting whose .sig is
five times longer than its content, and which unilaterally dismisses
any post that attempts to impose a sense of urgency on thousands of people
who couldn't care less?

- Rich


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 3643
**************************************

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