[10752] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4350 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 3 11:07:33 1998

Date: Thu, 3 Dec 98 08:00:26 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 3 Dec 1998     Volume: 8 Number: 4350

Today's topics:
    Re: awk system call <prauz@sprynet.com>
        Can standard Perl functions be overloaded ? vander_graph@hotmail.com
    Re: Database questions ... (Steve Linberg)
    Re: dbmopen (Jeffrey R. Drumm)
    Re: die() message available at END time? chess@watson.ibm.com
        dummy perl shell <prauz@sprynet.com>
    Re: dummy perl shell <ebohlman@netcom.com>
        File Uploading Progress Meter. kfosburg@power.net
        File with Sendmail <daniel@boksjo.com>
        Just a question about Perl seeking a Web page. <j@j.com>
    Re: Memory in Perl (Bart Lateur)
    Re: Memory in Perl (Larry Rosler)
    Re: Newbie from Ottawa, Ontario Canada (I.J. Garlick)
    Re: Newbie from Ottawa, Ontario Canada <r28629@email.sps.mot.com>
    Re: PC to Unix Problem <newspost@morlock.net>
    Re: PC to Unix Problem <Allan@due.net>
    Re: PC to Unix Problem dzuy@my-dejanews.com
    Re: Perl Socket problems.. <kak@cisco.com>
    Re: Perl to awk? (Clinton Pierce)
        PerlScript on MS Personal Web Server <mat3q@erwin.phys.virginia.edu>
        questions about Net::SMTP (Nnickee)
    Re: questions about Net::SMTP (Nathan V. Patwardhan)
    Re: Reading a text file & putting into variables (Tad McClellan)
        Recipe Database for Unix <ips@damd.net>
        Solaris passwd/shadow & getpwuid() (Dave Haywood)
    Re: Sorting VERY large files effeciently (Charles Wilt)
    Re: Sorting VERY large files effeciently (Clinton Pierce)
    Re: system commands in WinNT <darmawan@scic.org>
    Re: System() (Bart Lateur)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Thu, 03 Dec 1998 11:36:41 +0000
From: Balazs Rauznitz <prauz@sprynet.com>
To: Lance Miller <lemiller@us.ibm.com>
Subject: Re: awk system call
Message-Id: <366677C9.5EF45A82@sprynet.com>

Lance Miller wrote:
> 
> I've been trying to use awk in a system statement in my perl program
> 
> examlple
> 
> (  !system," /usr/bin/awk '{print$1}'  filename );
> 
> I believe it has to do something with $1 variable, and awk and perl
> are mis-translating it.
> 
> Anybody have any ideas I could use to solve this problem of mine?

 how about system q{/usr/bin/awk '{print$1}'  filename } ?

Balazs


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

Date: Thu, 03 Dec 1998 14:43:07 GMT
From: vander_graph@hotmail.com
Subject: Can standard Perl functions be overloaded ?
Message-Id: <74681r$v1m$1@nnrp1.dejanews.com>

That is,

(Perl) prog A calls (evals) prog B. Prog A can load module M first
if necessary.

1. Can either A or M redefine the (say) the open() function,
so that when B calls open(), it is another open() in A or M
that is called ?

2. If yes, can A call the _real_ open(), after possibly doing
some checks ?

3. If yes, can B _somehow_ _still_ call the real open()?

4. And if yes, can A or M do something so that B can never call
the real open() ?

yes/no/Flames/RTFM's will be greatly appreciated...

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 03 Dec 1998 10:29:51 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Database questions ...
Message-Id: <linberg-0312981029510001@ltl1.literacy.upenn.edu>

In article <744rm1$7kv@sjx-ixn4.ix.netcom.com>, "Darren"
<darrensweeney@eswap.co.uk> wrote:

> Is there an easy way to change the coding to enable the script to read/write
> a mSQL or MySQL database instead?

See DBI/DBD at CPAN for all the info you need.
_____________________________________________________________________
Steve Linberg                       National Center on Adult Literacy
Systems Programmer &c.                     University of Pennsylvania
linberg@literacy.upenn.edu              http://www.literacyonline.org


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

Date: Thu, 03 Dec 1998 13:22:59 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: dbmopen
Message-Id: <36668f38.59548356@news.mmc.org>

[ posted to comp.lang.perl.misc and a courtesy copy was mailed to the cited
author ]

On Wed, 2 Dec 1998 11:35:44 -0700 , Chris Hewell <CHewell@ile.com> wrote:

>#!/usr/local/bin/perl -w
>#
># 
>
>dbmopen (%last_good, "lastdb", 0666) || die "can't open lastdb: $!";
>$last_good{$name} = time;
>dbmclose (%last_good) || die "can't dbmclose lastdb: $!";
>

The code above generates the following error:

Name "main::name" used only once: possible typo at C:\users\default\mytest.pl
line 6.
Use of uninitialized value at C:\users\default\mytest.pl line 6.

You've assigned nothing to $name; '-w' should be reporting that. The script
should still create the .dir and .pag files, though; perhaps you're using a
broken Perl implementation? I tested with AS 5.005_02 build 507, and the files
were created as expected . . . on both NT and Win98.

-- 
                               Jeffrey R. Drumm, Systems Integration Specialist
                       Maine Medical Center - Medical Information Systems Group
                                                            drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me


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

Date: Thu, 03 Dec 1998 13:31:05 GMT
From: chess@watson.ibm.com
Subject: Re: die() message available at END time?
Message-Id: <7463qq$rg3$1@nnrp1.dejanews.com>

In article <MPG.10cf6814b470375e98974b@news.scescape.net>,
  dragons@scescape.net (Matthew Bafford) wrote:

> $SIG{__DIE__} = sub { $msg = "@_"; exit; }; # along those lines

Thanks!  In this case, I don't mind (I might even like) the extra
message going to the console.  I gather that putting that "exit"
into the __DIE__ handler causes an early exit, thereby stopping
the usual message-printing behavior of die() (but not, of course,
the execution of the END{} block).  How baroque and Perl-like!  *8)

DC

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 03 Dec 1998 11:34:35 +0000
From: Balazs Rauznitz <prauz@sprynet.com>
Subject: dummy perl shell
Message-Id: <3666774B.18EE1470@sprynet.com>

Hi.

I wrote a _very_ dummy perl shell:

while( print "\nperl> " and defined ( $l=<> )){
  if( ! eval $l and  $@ and ! system( $l ) and  $! ){
    print "Die:$@\nError: $!\n";
  }
}

Questions:

How can I achieve that every line is passed to the shall iff it is not a
proper perl statement.
I'd also welcome any suggestion about making it more shellish.

Thankx: Balazs


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

Date: Thu, 3 Dec 1998 13:31:18 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: dummy perl shell
Message-Id: <ebohlmanF3E5K6.41D@netcom.com>

Balazs Rauznitz <prauz@sprynet.com> wrote:
: I wrote a _very_ dummy perl shell:

: while( print "\nperl> " and defined ( $l=<> )){
:   if( ! eval $l and  $@ and ! system( $l ) and  $! ){
:     print "Die:$@\nError: $!\n";
:   }
: }

: Questions:

: How can I achieve that every line is passed to the shall iff it is not a
: proper perl statement.

use Shell;



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

Date: Thu, 03 Dec 1998 14:08:24 GMT
From: kfosburg@power.net
Subject: File Uploading Progress Meter.
Message-Id: <74660n$t3b$1@nnrp1.dejanews.com>

Hello,

Can someone point me in the right direction for a file upload progress meter.
What I would like is either a javascript or perl solution that gives a user
the progress of a file upload. I use a perl script for the upload, but some
of our users (Intranet) send very large files (30+ MB) and are never sure if
they are hung up, or it's just slow. Some sort of pop up or an automatically
refreshing page that displays the percent complete would keep them occupied.

Looking for suggestions that I can write myself with my limited javascript
knowledge and moderate perl skills.

Thanks in advance,

Karl Fosburg <kfosburg@power.net>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 3 Dec 1998 16:22:58 +0100
From: "Daniel Boksjv" <daniel@boksjo.com>
Subject: File with Sendmail
Message-Id: <3666ad83.0@d2o62.telia.com>

Hi,

I'm writing a script that is supposed to send me a certain file on my
e-mail. I'm using sendmail to do this, since I have used sendmail before in
another script. The thing is that now I want to redirect a file to sendmail,
not only a certain text. What syntax do I use in a Perl program for this?
Maybe:

exec 'sendmail', 'my@email.com <directory/file';

I have scanned the man pages of sendmail, but haven't found anything on
proper syntax for this.

Thanks in advance for any hints on this,

Daniel




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

Date: Mon, 23 Nov 1998 00:50:52 +0100
From: "J.C." <j@j.com>
Subject: Just a question about Perl seeking a Web page.
Message-Id: <73a7m7$69a$1@talia.mad.ibernet.es>

How can I do that a program test an hiperlink, or better all the links on a
page?





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

Date: Thu, 03 Dec 1998 11:52:16 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Memory in Perl
Message-Id: <36707ad2.12065924@news.skynet.be>

Zenin wrote:

>	sub foo {
>	    my $foo = "stuff";
>	    my @bar = qw(foo bar baz);
>	}
>
>	Here the memory for $foo and @bar is never reclaimed.  Perl expects
>	you're likely to call foo() again and so need that memory again.
>	For efficiency it just reuses the memory it used the first time.

Eek!

You're not saying that it even doesn't do an "undef" on the my-ed
variables, at the end of the block? 

That's silly. There's no way you can retrieve the the previous values of
those variables, when reentering the block, so there's no point in
keeping that value.

Hmm... anybody interested in a "static" alternative for "my"?

	Bart.


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

Date: Thu, 3 Dec 1998 07:04:48 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Memory in Perl
Message-Id: <MPG.10d048663a17f6a998993b@nntp.hpl.hp.com>

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

In article <x3y67bucems.fsf@tigre.matrox.com> on Wed, 2 Dec 1998 
18:28:20 -0500 , Ala Qumsieh <aqumsieh@matrox.com> says...
 ... 
> undef $var, @var, %var;

Oops.  'undef' does not accept a LIST.  No doubt it should, but it 
doesn't.

  undef $var; undef @var; undef %var;

>From `perldoc -f undef`:

NAME

undef - remove a variable or function definition 

SYNOPSIS

undef EXPR 

undef

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


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

Date: Thu, 3 Dec 1998 10:07:37 GMT
From: ijg@csc.liv.ac.uk (I.J. Garlick)
To: susiecox@sprint.ca (Susie)
Subject: Re: Newbie from Ottawa, Ontario Canada
Message-Id: <F3Dw4p.8Ir@csc.liv.ac.uk>

[Posted and mailed]

In article <366ab3c7.14311382@news.sprint.ca>,
susiecox@sprint.ca (Susie) writes:

Hi Susie,

When I first started learning Perl I did roughly the same thing as you and
went looking for tutorials on the web. I found this one:-

	http://agora.leeds.ac.uk/nik/

which helped me get to grips with Perl as it did look confusing (I had just
come from a C background).

>From your post it sounds like you don't have access to a computer running
Perl? Do yourself a favour find one, grovel if you have to :-) but I found
Perl much easier to learn by trial and error. The 'I wonder if you can do
that like this...Wow yes you can' method massively instructive. The failures
where probably as constructive if not more so.

I have only been programming in Perl for 8 months and can get things done
fairly easily now in a recognisable perlish way (ditching some of the ways
you do things in C was the hardest lesson). I would still consider myself a
newbie though as I am still learning so much every day. (I wonder how long
it takes before you feel you have advanced to the next level with Perl?
probably when the xs stuff starts stops looking like jibberish, though
thats another story, and you don't need to worry about it for a long while.)

Anyway try Nick Silvers tutorial above, it appears slightly more structured
than the one you quoted (it's on separate HTML pages anyway) and do try and
find a machine to practice on.

-- 
--
Ian J. Garlick
<ijg@csc.liv.ac.uk>

Idiot Box, n.:
        The part of the envelope that tells a person where to place the
stamp when they can't quite figure it out for themselves.
                -- Rich Hall, "Sniglets"



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

Date: Thu, 03 Dec 1998 08:52:45 -0600
From: Tk Soh <r28629@email.sps.mot.com>
To: "I.J. Garlick" <ijg@csc.liv.ac.uk>
Subject: Re: Newbie from Ottawa, Ontario Canada
Message-Id: <3666A5BD.B5B5F4D8@email.sps.mot.com>

[posted to c.l.p.m and copy emailed]

I.J. Garlick wrote:

> I have only been programming in Perl for 8 months and can get things done
> fairly easily now in a recognisable perlish way (ditching some of the ways
> you do things in C was the hardest lesson). I would still consider myself a
> newbie though as I am still learning so much every day. (I wonder how long
> it takes before you feel you have advanced to the next level with Perl?

you might be able to get some idea here:

       http://www.activestate.com/reference/perl_mastery.htm

-TK


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

Date: Thu, 3 Dec 1998 08:03:15 -0500
From: "Steven Morlock" <newspost@morlock.net>
Subject: Re: PC to Unix Problem
Message-Id: <91w92.73$dF2.160539@lwnws01.ne.mediaone.net>


Don't forget to make the scripts executable when they
get to the UNIX box.

Now if FTP could only do that too...

--
Foliage Software Systems
aka The Nerd Farm
http://www.foliage.com

dave@mag-sol.com wrote in message <745rkr$kqc$1@nnrp1.dejanews.com>...
>In article <744ujd$t4u$1@nnrp1.dejanews.com>,
>  oleynikl@geocities.com wrote:
>> I've been learning Perl 5.0 for 2 days now. I'm trying to use Perl to solve a
>> problem. Whenever I create an ascii file in a PC environment and upload it to
>> a UNIX account, what I get is newline characters appearing everywhere. (ie: I
>> get ^M in vi and <cr> in nedit).
>>
>> I wrote this short Perl program hoping to rid the newline characters, but it
>> doesn't seem to work.
>>
>> #!/usr/bin/perl -w
>> $^I = '.old';            # backup file
>> while(<>) {
>> s/^\s/ /g;               # replace newlines,etc. with a single space
>> print;                   # write to file
>> }
>
>Probably best to transfer the files between DOS and Unix using FTP in ASCII
>mode, it will then do the conversion for you. If you'r forced to use some
>other method then you Unix may well have a dos2unix filter that you can use
>like:
>
>dos2unix < ugly_dos_file.text > nice_unix_file.txt
>
>Only if all these easy methods fail should you take on the massive task of
>writing dos2unix yourself. It may well look a little like this
>
>#!/usr/bin/perl -w
>use strict;
>
>while (<STDIN>)
>{
>    s/\r\n/\n;
>    print;
>}
>
>
>hth,
>
>Dave...
>
>
>--
>Magnum Solutions Ltd: <http://www.mag-sol.com/>
>London Perl M[ou]ngers: <http://london.pm.org/>
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own




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

Date: Thu, 3 Dec 1998 08:36:09 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: PC to Unix Problem
Message-Id: <7463qs$k5h$1@camel29.mindspring.com>

Steven Morlock wrote in message
<91w92.73$dF2.160539@lwnws01.ne.mediaone.net>...
>
>Don't forget to make the scripts executable when they
>get to the UNIX box.
>
>Now if FTP could only do that too...
>
>--

Actually, most Windoz FTP clients will let you change the protection of
files being uploaded.  WS_FTP and AbsoluteFTP just to name two.

AmD




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

Date: Thu, 03 Dec 1998 14:41:43 GMT
From: dzuy@my-dejanews.com
Subject: Re: PC to Unix Problem
Message-Id: <7467v7$v19$1@nnrp1.dejanews.com>

In article <744ujd$t4u$1@nnrp1.dejanews.com>,
  oleynikl@geocities.com wrote:
> I've been learning Perl 5.0 for 2 days now. I'm trying to use Perl to solve a
> problem. Whenever I create an ascii file in a PC environment and upload it to
> a UNIX account, what I get is newline characters appearing everywhere. (ie: I
> get ^M in vi and <cr> in nedit).
>
> I wrote this short Perl program hoping to rid the newline characters, but it
> doesn't seem to work.
>
> #!/usr/bin/perl -w
> $^I = '.old';            # backup file
> while(<>) {
> s/^\s/ /g;               # replace newlines,etc. with a single space
> print;                   # write to file
> }
>
	You want to get rid of the ^M characters.  You can use sed on the comand
	line or in a shell script.

	sed s/^M//g <file> <new file>

	or in your perl script:

	s/^M//g;

	To type the actual ^M, hold down the <Ctrl> key and type v then m.

> Thank you for any suggestions.
>
> William
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 03 Dec 1998 10:12:51 -0500
From: Keith Kaple <kak@cisco.com>
To: davidjan@mtu.edu
Subject: Re: Perl Socket problems..
Message-Id: <3666AA73.CE47256C@cisco.com>

David J. Anderson wrote:

> Here is the Client Code:
> #!/usr/local/bin/perl
> 
> use IO::Socket;
> print "Attempting to reach foreign socket now\n";

Looks kinda ok, but not sure about syntax...I'm using perl 5.004_04

> $sock = new IO::Socket::INET (PeerHost => 'colossus.csl',
>                               PeerPort => 2169,
>                               Proto    => 'tcp',
>                               );

David, 

Try this  instead of the above...
 $sock= IO::Socket::INET->new(PeerAddr => 'colossus.csl',
                                 PeerPort => '2169',
                                 Reuse    => 1,
                                 Proto    => 'tcp');
                                  


> die "Socket could not be created. Reason: $!\n" unless $sock;
> print "Preparing to send data\n";
> foreach (1 .. 10) {
>     print $sock "Msg $_: How are you? \n";
> }
> close ($sock);
> 

-- 
Keith Kaple x25759 -----------------------
| New distribution, $40.  Linux compatible
| sound card, $89.  Three button mouse, $18.
| Nuking windows partitions....priceless.


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

Date: Thu, 03 Dec 1998 14:57:53 GMT
From: cpierce1@mail.ford.com (Clinton Pierce)
Subject: Re: Perl to awk?
Message-Id: <3669a59a.170258298@news.ford.com>

[Courtesy CC sent to poster in E-Mail]

On 30 Nov 1998 23:32:28 -0500, Jason Larke <jlarke@ans.net> wrote:
>>>>>> On 30 Nov 1998 19:44:36 GMT, "watsiyem" <watsiyem@vt.edu>
>>>>>> said:
>
>w> I am aware of a program that will convert from awk to Perl,
>w> but is there one available to do the reverse?
>
>No. Why write a program to go from good to bad? Things are
>difficult enough already. :)

Awk's not that bad!   I still haven't found a more elegant way to do
this in perl:

	ps -ef | awk '{print $1}'

Or even:

	ls -l | awk '{t+=$5}END{print t}'

-- 
 Clinton A. Pierce    "If you rush a Miracle Man, you get rotten
 cpierce1@ford.com        miracles" --Miracle Max, The Princess Bride
fubar@ameritech.net   http://www.dcicorp.com/~clintp


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

Date: Thu, 03 Dec 1998 08:42:31 -0500
From: Mike Timmins <mat3q@erwin.phys.virginia.edu>
Subject: PerlScript on MS Personal Web Server
Message-Id: <36669547.7E00448D@erwin.phys.virginia.edu>

Does anyone know if it is possible to use PerlScript in ASP pages on
Personal Web Server?  I've tried and can't get it to work, i keep
getting errors like:

" Bareword found where operator expected at (eval 9) line 2, near ")
Response" (Missing operator before Response?)

The above message is what I get when trying to execute the hello.asp
script example that comes with the ActiveState perl distribution.

Thanks, Mike Timmins

--
***********************************************************
Mike Timmins                   voice: (804) 924-6800
Department of Physics          fax: (804) 924-4576
University of Virginia         email: mat3q@virginia.edu

Mailing Address:

      Jesse Beams Laboratory
      382 McCormick Rd.
      Charlottesville, VA 22903
***********************************************************




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

Date: Thu, 03 Dec 1998 12:55:21 GMT
From: nnickee@nnickee.com (Nnickee)
Subject: questions about Net::SMTP
Message-Id: <366688fe.6770643@news.centuryinter.net>

Hi folks,
I'm still pretty wet behind the ears, so please don't hurt me too
badly if these questions are too stupid, or if I've provided too much
or too little information :)

I'm using Net::SMTP to send a simple email; working fine.
I want to unsimplify it just a bit:
* the simple version isn't sending any date/time information in the
headers.. how do I add that?
* any way to attach a file (ascii or binary... doesn't really matter
at this point)

If there's a specific faq I should be looking at for these answers,
please point the way :)

TIA,
Nnickee


 ...... she who plays with the most toys ......
 ... spends way too much money on batteries ...


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

Date: Thu, 03 Dec 1998 13:49:39 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: questions about Net::SMTP
Message-Id: <TFw92.315$8d6.56235@news.shore.net>

Nnickee (nnickee@nnickee.com) wrote:
: * the simple version isn't sending any date/time information in the
: headers.. how do I add that?

Eh?  Why not?

: * any way to attach a file (ascii or binary... doesn't really matter
: at this point)

I just posted some code like this to this newsgroup.  Why not read
back a few days and search for Net::SMTP?

--
Nate Patwardhan|root@localhost
"Fortunately, I prefer to believe that we're all really just trapped in a
P.K. Dick book laced with Lovecraft, and this awful Terror Out of Cambridge
shall by the light of day evaporate, leaving nothing but good intentions in
its stead." Tom Christiansen in <6k02ha$hq6$3@csnews.cs.colorado.edu>


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

Date: Thu, 3 Dec 1998 08:54:16 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Reading a text file & putting into variables
Message-Id: <om8647.0q.ln@metronet.com>

John Zeng (john_z@hotmail.com) wrote:
: All i need is how do I set each e-mail address in a text file into a
: variable in a Perl script..


   open(ADDR, 'the_name_of_the_below_text_file') ||
      die "could not open 'filename'  $!";
   while (<ADDR>) {
      while $email_address ( split /;\s*/ ) {
         print "$email_address\n";
      }
   }
   close(ADDR);


: TEXT FILE---->>>>
: email@host.com; email@host.isp; addy@isp.net; webmaster@worldwideweb.www;
: <<<<----end
: those email addresses are in a seperate text file... h0w d0 i refer to each
: of them in the script :::
: for example (part of the script)....

: open (LIST, "<$Listofppl");

   What if the open() call *failed*?

   It might you know.

   Maybe you should check to see if it did what you asked
   it to do?  (Yes, you should *always* check the return value
   from open() calls):

      open(LIST, $Listofppl) || die "could not open '$Listofppl'  $!";


: $umask = umask(0);

   that changes the umask and saves the original umask in $umask.


: open (TMP, ">$TempFile");

   open (TMP, ">$TempFile") || die "could not open '$TempFile'  $!";


: umask($umask); ### i dont know what this does

   it restores the umask that was saved off earlier


: while(<LIST>)
:   {
:   chop;

   chomp() is the preferred way to remove line ending sequences
   in modern Perl.



--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Thu, 3 Dec 1998 07:40:12 -0800
From: "JBreit" <ips@damd.net>
Subject: Recipe Database for Unix
Message-Id: <746bdv$97c$1@news.ncal.verio.com>

Has anyone seen a good recipe database which allows adds, mods, and
searches?  Ive been looking for days.... I want to use a flat file.

Jeanne
ladyj@damd.net




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

Date: Thu, 03 Dec 1998 14:51:39 GMT
From: D.Haywood@btinternet.com (Dave Haywood)
Subject: Solaris passwd/shadow & getpwuid()
Message-Id: <7468aq$rh$1@mendelevium.btinternet.com>
Keywords: Solaris passwd shadow getpwuid()

Hi,

Environment: Solaris 2.6, Perl 5.004_04, sun4-solaris

I tried the "crypt" example from the perlfunc man page but don't see how it 
can work in a shadow password system!  The code given is:

                 $pwd = (getpwuid($<))[1];
                 $salt = substr($pwd, 0, 2);

                 system "stty -echo";
                 print "Password: ";
                 chop($word = <STDIN>);
                 print "\n";
                 system "stty echo";

                 if (crypt($word, $salt) ne $pwd) {
                     die "Sorry...\n";
                 } else {
                     print "ok\n";
                 }

The first line gets the "dummy" password entry from the /etc/passwd file and 
then goes on to compare this with the encrypted password entered by the user.

*Should* this ork as suggested or is this only valid for systems which store 
the real encrypted passwords in /etc/passwd?

What is the solution for Solaris based systems with a shadow password file?

Thanks in advance.

Dave Haywood.
D.Haywood@btinternet.com


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

Date: 3 Dec 1998 15:23:46 GMT
From: charles.0272@worldnet.no.spam.att.net (Charles Wilt)
Subject: Re: Sorting VERY large files effeciently
Message-Id: <MPG.10d07a9975a5904b98968d@netnews.worldnet.att.net>

In article <x767btyc06.fsf@sysarch.com>, uri@sysarch.com says...
> >>>>> "RS" == Ron Savage <Savage.Ron.RS@bhp.com.au> writes:
> 
>   RS> Using Perl I would write what's called a 'tag sort'. See any good
>   RS> sort reference.  Basically you read and sort the keys only,
>   RS> remembering which record they can from.  After the sort you read
>   RS> the data attached to the keys and write it in sorted order.
> 
> what if the number (and size) of keys is still too big to fit into
> virtual memory?
> 
> this will work for ANY size of database provided you have external
> storage to hold the temp files.
> 
> does anyone else remember tape sorts? you read a mess of records into
> ram (only enough to fill memory) and do a quicksort. you write out that
> sorted block of records to a tape (or disk file today). you repeat until
> all the records are in sorted blocks. then you do merges of the sorted
> blocks which is very efficient. believe it or not, the fibonacci series
> comes into play as you determine the optimal number of sort blocks and
> tapes to make and merges to be done with them. i learned this over 20
> years ago from ron rivest (of RSA fame). it still the best algorithm
> for very large sorts when you have more data than fits into ram.
> 
> i bet syncsort uses this algorithm for their largest sorts.
> 
> uri
> 
> 

I belive I have some C code that does a 'merge sort' as you describe.  It 
has been a while since I needed it.  But if the original poster is 
interested I could dig it up and send to him.

-- 
Charles Wilt
Miami Luken, Inc.
e-mail: charles.0272@worldnet.no.spam.att.net
--->remove the no.spam.


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

Date: Thu, 03 Dec 1998 15:31:13 GMT
From: cpierce1@mail.ford.com (Clinton Pierce)
Subject: Re: Sorting VERY large files effeciently
Message-Id: <366baa34.171436064@news.ford.com>

[Courtesy CC sent to poster in E-Mail]

On Wed, 02 Dec 1998 15:48:14 GMT, andy-markham@mindspring.com wrote:
>I have recently started working with a group that does some work on an
>HP3000. Since there is a 4GB limit on that machine, they have to find a new
>way to do some effecient sorting of data files that exceed that limit.	They
>have been looking at a couple of packages on HPUX to do the job, CoSORT
>(~$2K) and something else that is on the order of $20K.  It turns out that
>CoSORT can't handle it, so they are thinking about writing a $20K check to
>solve the problem.
>
>My first thought is, can't Perl be used to sort a really large flat file in
>an effecient manner?  Hell, Perl can do everything else I've ever asked it to
>do...
>
>I don't plan on writing and testing out a bunch of sort routines, so
>basically I'm hoping that someone on this group has already tackled this
>problem and has a really good response.  I'd really like for us to find a
>solution in Perl, but if we end up having to write the check, so be it.
>
>So, is Perl up to the task?  Please say YES!

Probably.  You didn't say exactly what the bottleneck was (4GB of
what?).  Memory?   There's a tradeoff here between time, memory and
disk.  Since time seems to be (somewhat) important, and memory is fixed,
one solution is to throw disk at the problem.

Divide the file up into N-chunks, where the size of a chunk will fit
comfortably in core.  While the chunk is in core, do a traditional
q-sort on the chunk.  (Or whichever kind of sort best fits your data).
Write the chunk out, and do the next one.  When all of the individual
chunks are sorted--merge them back together into a large sorted file.

If this were saved as "foo.pl":

	#!/usr/bin/perl
 
	$i=0;
	$maxlines=10;
	$fn="aaaa";
	open(F, ">merge$fn")|| die;
	while(<STDIN>) {
	        push(@A, $_);
	        if ($i++>$maxlines) {
	                print F sort(@A);
	                open(F, ">merge" . ++$fn) || die;
	                @A=();  $i=0;
	        }
	}


Then:
	
	foo.pl < LARGE_INPUT_FILE
	sort -m merge* > LARGE_SORTED

Would probably yeild something like what you were looking for.  Of
course, this example only works with 10 lines of input at a time, and
does a standard "sort" on them.  YMWV.  But it does handle arbitrarily
large amounts of input, at the cost of disk space.





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

Date: Thu, 03 Dec 1998 09:13:32 -0600
From: darmawan <darmawan@scic.org>
Subject: Re: system commands in WinNT
Message-Id: <3666AA9C.58C639D0@scic.org>

The script is a search script (If anyone knows of a Win32 version let me
know).  When I say 'from a browser' I mean from a form that calls the script.

Josh Baudhuin wrote:

> (confused + don't know much about webbie perl)
> Do you mean, you're trying to run the script on the client's machine?
>
> darmawan wrote in message <3665D0EE.9034E477@email.com>...
> >I am trying to get a script to work on NT but when run through a Web
> >page it doeesn't seem to return anything for system calls.
> >
> >Let's say I have the lines
> >
> >$version = `ver`;
> >print "Version: $version";
> >
> >somewhere in my script.  When run from the command line I get
> >
> >Version: Window NT Version 4.0
> >
> >But when run from a browser I get
> >
> >Version:
> >
> >What is the deal?  Is there something, somewhere that needs to be set so
> >that the default Web user can reference system commands through scripts?
> >
> >Thanks
> >
> >Cliff Corder



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

Date: Thu, 03 Dec 1998 12:40:29 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: System()
Message-Id: <3668864f.15007652@news.skynet.be>

lferon wrote:

>The System function does not work with CGI. Why????

Just a few guesses. Because you don't have the permission to run that
particular program (It needs to be world-executable to be used with
plain CGI scripts). Because you can't access the directory (same).
Bacuse the program can't be found in $ENV{PATH}.

	Bart.


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

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 4350
**************************************

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