[6950] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 575 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 5 13:07:32 1997

Date: Thu, 5 Jun 97 10:01:52 -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           Thu, 5 Jun 1997     Volume: 8 Number: 575

Today's topics:
     -----> replacing & symbol! <------- (Farshad Abasi)
     Re: -----> replacing & symbol! <------- (Kjetil Skotheim)
     A problematic twist with =~ and regex <bmurdock@wat.hookup.net>
     Any Perl Statistics Routines Out There ?? dsnowden@ncdc.noaa.gov
     Re: Atomic file create or fail if already existing (Chipmunk)
     attaching a file to an email using sendmail <alastair@redboxad.demon.co.uk>
     Re: attaching a file to an email using sendmail (Nathan V. Patwardhan)
     call "c" from "perl"? (Jun Zhuang)
     Re: call "c" from "perl"? (Nathan V. Patwardhan)
     Re: Code examples: right justify text? (A. Deckers)
     Re: Converting number to ascii (Bob Wilkinson)
     Core dump (!?) from PERL (Kent E. Holsinger)
     Re: CSV Module in Perl? (Alan Citterman)
     DB_File not recognizing external updates? georgeh@maagnum.com
     Re: delete lines directly from file (Honza Pazdziora)
     File for read and write problem. <dickenrp@boat.bt.com>
     Re: File glob works as root, but fails as regular user  <rootbeer@teleport.com>
     Re: Finding string length (Chipmunk)
     Re: Help with weird cron interaction <rootbeer@teleport.com>
     Re: How to do 'chmod' (Honza Pazdziora)
     Re: How to do 'chmod' (Billy Chambless)
     Re: How to send email with Mime attachment? (Chris Russo)
     Re: How to send email with Mime attachment? (Nathan V. Patwardhan)
     Re: NcFTP, Perl, CGI - Permission Denied lvirden@cas.org
     Re: Need a special characters->"normal characters" conv <rootbeer@teleport.com>
     Re: newbie question (Chipmunk)
     NNTP <snaider@galcom.co.il>
     Re: open won't open files in subdirectories? <rootbeer@teleport.com>
     Re: Out of memory with big hashes (Kjetil Skotheim)
     patch: pack template that packs like 'a' but unpacks li <uwe@ptc.spbu.ru>
     Perl5 garbage collection too lazy? (Kjetil Skotheim)
     POSIX.pm with perl shell causes SEGV, AIX 5.003 (Keith Dreibelbis)
     Replacing A single Text Character (Brett Borger)
     Rounding off numbers <felix@cats.edu.ph>
     Rounding off numbers <felix@cats.edu.ph>
     Re: Rounding off numbers <dean@tbone.biol.sc.edu>
     Re: Suggestion to all frequent posters/answerers <rootbeer@teleport.com>
     tftp client <michael.cameron@mci.com>
     Re: Using debugger with formats in the file <rootbeer@teleport.com>
     WWW Programmer/Web Server administrator <chris@webworks.co.uk>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 2 Jun 1997 18:11:16 GMT
From: fabasi@unixg.ubc.ca (Farshad Abasi)
Subject: -----> replacing & symbol! <-------
Message-Id: <5mv2c4$ibd$1@nntp.ucs.ubc.ca>

Hello all,

I am trying to search s string for the & symbol and replace it with \&
I did the following which did not work :-(

$title1 =~ s/'&'/'\&'/g;

I also tried 

$title1 =~ s/&/\&/g;

and that also did not work.... any ideas??


--
       -Farshad
"and remember in your brain boggle, wrong starts with a wubble-u"
main email: fabasi@unixg.ubc.ca
alt. e-mail: x7l1@ugrad.cs.ubc.ca


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

Date: 5 Jun 1997 16:36:33 GMT
From: kjetil.skotheim@usit.uio.no (Kjetil Skotheim)
Subject: Re: -----> replacing & symbol! <-------
Message-Id: <5n6puh$mqi$1@ratatosk.uio.no>

In article <5mv2c4$ibd$1@nntp.ucs.ubc.ca>, fabasi@unixg.ubc.ca says...
>
>I am trying to search s string for the & symbol and replace it with \&
>I did the following which did not work :-(
>
>$title1 =~ s/'&'/'\&'/g;
>
>I also tried 
>
>$title1 =~ s/&/\&/g;
>
>and that also did not work.... any ideas??

Try $title =~ s/&/\\&/g;




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

Date: Thu, 05 Jun 1997 09:31:32 -0400
From: Matt Murdock <bmurdock@wat.hookup.net>
Subject: A problematic twist with =~ and regex
Message-Id: <3396BF82.4FB7B808@wat.hookup.net>

I'm having a similar problem as Dan's s/// substitution of spaces within
quotes.  I managed to solve *MOST* of the problem by gleaning code from
one of the FAQs, but my s/// has a bit of a twist:

To recite Dan's problem, I would like to split a text string -- by
spaces -- into terms or "keywords".  However, each term _may_ or _may
not_ be preceeded by a keyword modifier.  Also, a single multi-word term
may be contained within quotes.  The following is a code snipet that I
am currently using.

@INPT = <STDIN>;
$text = join( ' ', @INPT );
print STDERR "Raw Input:  $text\n\n";  # Debugging only

@TERMS = ();
push( @TERMS, $+ ) while $text =~ m{
        ((?:.?)"[^\"\\]*(?:\\.[^\"\\]*)*)"\s?  # groups the phrase i$
        | ([^\s]+)\s?                    # Ignore extended whitespac$
        | \s
}gx;
push( @TERMS, undef) if substr($text,-1,1) eq ' ';

print "Terms:\n";                      # More	
foreach $term ( @TERMS ) {             # Debugging
        print "$term\n";               # Lines	
}                                      # ---

The regex is not yet complete.  It performs the term splitting (allowing
quoted text to remain as a single term).  It allows the singe character
keyword modifier to remain and removes the last quote.  HOWEVER, the
first quote is NEVER removed!  How can I modify this such that the
keyword modifier remains as the first character, and both quotes are
removed from the term?


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

Date: Thu, 05 Jun 1997 08:01:09 -0600
From: dsnowden@ncdc.noaa.gov
Subject: Any Perl Statistics Routines Out There ??
Message-Id: <865515058.11828@dejanews.com>

I am looking for something written in Perl that will report
things like:

Number of Users That logged onto a machine in a 24 hr period
Files that were accessed
Disk statistics
etc

Before trying to come up with something myself, is there anything
around that does this type of thing already? I prefer that
it run on an IBM (picky).


Doug Snowden
dsnowden@ncdc.noaa.gov

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: 5 Jun 1997 15:01:20 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: Atomic file create or fail if already existing
Message-Id: <5n6kc0$jd9$3@dartvax.dartmouth.edu>

In article <5n4n7c$rl3@news.service.uci.edu>
lmegliol@inertia.acs.uci.edu (Leonard Megliola) writes:

> In article <5n4kki$flt$1@dartvax.dartmouth.edu>,
> Chipmunk <Ronald.J.Kimball@dartmouth.edu> wrote:
> >In article <5n452d$gl8@news.service.uci.edu>
> >lmegliol@inertia.acs.uci.edu (Leonard Megliola) writes:
> >
> >> I need an atomic operation which will create a new file if it
> >> doesn't exists, but fail if the file already does exist.  The goal
> >> is to create unique (random) filenames, and (even though it is
> >> unlikely given my method of generating the filenames) I would like
> >> to avoid any race conditions.  I've thought about different
> >> variations on sysopen and open, but I don't think it is possible.
> >
> >do {
> >  open(FILE, ">$filename") || die "Unable to create $filename: $!";
> >} unless -e $filename;
> >
> >-e returns true if the file exists, false otherwise.
> >
> >Chipmunk
> 
> Thanks, I already know how to do that though.  I'm wondering if
> there is an atomic version of those same actions (Unless that is
> some special incantation for making the operation atomic).

Sorry, ignore my above answer, I didn't fully understand the problem
originally.  :-)

Chipmunk


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

Date: Thu, 05 Jun 1997 15:55:53 +0100
From: alastair brown <alastair@redboxad.demon.co.uk>
Subject: attaching a file to an email using sendmail
Message-Id: <3396D379.668F@redboxad.demon.co.uk>

Hi there, 

Does anyone know if it is possible to attach a file to an email message
using the sendmail program?. If so could someone please supply an
example of the coded needed to do this 

Regards

Alastair Brown


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

Date: 5 Jun 1997 15:08:24 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: attaching a file to an email using sendmail
Message-Id: <5n6kp8$q87@fridge-nf0.shore.net>

alastair brown (alastair@redboxad.demon.co.uk) wrote:

: Does anyone know if it is possible to attach a file to an email message
: using the sendmail program?. If so could someone please supply an
: example of the coded needed to do this 

Use the MIME::Lite module which will do exactly what you want.  I
don't have MIME::Lite on this machine, and I don't have time to offer
and example right now, so I'll leave that up to the POD that's written
into MIME::Lite in Lite.pm which will have you up and running in no
time.


--
Nathan V. Patwardhan
nvp@shore.net



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

Date: 5 Jun 1997 15:53:48 GMT
From: jzhuang@ringer.cs.utsa.edu (Jun Zhuang)
Subject: call "c" from "perl"?
Message-Id: <5n6nec$sgn@ringer.cs.utsa.edu>

Can I call a "c" executable program from perl script?
i.e.  in perl , I try to do:   $result = sum($key); # sum(int key)
is a "c" executalbe program. Can I do that? Or I have to rewrite
the c code into perl code? 
Thanks in advance.
 . 
--
Jun Zhuang                         | jzhuang@ringer.utsa.edu
Department of Computer Science     | http://ringer.utsa.edu/~jzhuang
University of Texas                |  
San Antonio, Texas                 |




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

Date: 5 Jun 1997 16:33:56 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: call "c" from "perl"?
Message-Id: <5n6ppk$s4k@fridge-nf0.shore.net>

Jun Zhuang (jzhuang@ringer.cs.utsa.edu) wrote:
: Can I call a "c" executable program from perl script?

Yes.

: i.e.  in perl , I try to do:   $result = sum($key); # sum(int key)
: is a "c" executalbe program. Can I do that? Or I have to rewrite

Uhh.  Do you mean sum(int key) is a C function?  In which case you're
looking for the perlxstut manpage, which should have been included
with your Perl distribution.

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: 5 Jun 1997 16:16:12 GMT
From: I-hate-cyber-promo@man.ac.uk (A. Deckers)
Subject: Re: Code examples: right justify text?
Message-Id: <slrn5pdphq.3ra.I-hate-cyber-promo@nessie.mcc.ac.uk>

In <33946969.11658356@news-2.csn.net>,
	Fred Elbel <frelbel@N0SPAMcsn.net> wrote:
>I'm about to design a routine to right justify text paragraphs, but
>perhaps it's already been done :)    I checked various archives and
>haven't found anything yet.

Does Text::Wrap not meet your requirements?

 <URL:http://www.perl.com/CPAN/modules/by-module/Text/>

>I need to reformat plain text paragraphs.  Each line is terminated
>with \n.  However, each line is too long - I need to shorten them to
>55 characters or so.

Yup. Text::Wrap::wrap() does that, IIRC.

>Sorry about the return address hack, but I'm getting a heck of a lot
>of spam...

Maybe, but I'm not going to spend time de-munging your address so I can
cc you a copy of this post. Is there some reason why you can't filter
incoming mail to get rid of spam, like most other cluefull people do?

HTH,

Alain

-- 
Perl information: <URL:http://www.perl.com/perl/>
        Perl FAQ: <URL:http://www.perl.com/perl/faq/>
    Perl archive: <URL:http://www.perl.com/CPAN/>
>>>>>>>> comp.lang.perl.misc is NOT a CGI group <<<<<<<<<<


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

Date: Thu, 05 Jun 1997 15:09:58 +0100
From: b.wilkinson@pindar.co.uk (Bob Wilkinson)
Subject: Re: Converting number to ascii
Message-Id: <b.wilkinson-0506971509580001@ip57-york.pindar.co.uk>

In article <5mus0q$9o4@usenet85.supernews.com>, grimm@shell.pgonline.com
(Ernie Dunbar) wrote:

> Well, the title pretty much sums it up. I need to know how to change a
> numeric value into ascii.
> 
> ----------------------------- IXTJ at large ------------------------------
>          De Iesus domine           | grimm@netbistro.com - BOFH in 
>        Dom a Hades requiem         | training and voted by my co-workers 
>                                    | "Most Likely to Go Postal"
> -If you send me spam, I will decimate your account. Resistence is futile.-

Hello,

my $mynum = 65;
my $mychar = pack "c", $mynum;

Now $mychar is "A"

Bob

-- 
I have become death, destroyer of the worlds.


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

Date: 05 Jun 1997 11:46:16 -0400
From: kent@darwin.eeb.uconn.edu (Kent E. Holsinger)
Subject: Core dump (!?) from PERL
Message-Id: <wkiuztt5mf.fsf@darwin.eeb.uconn.edu>

Folks,

I haven't done a lot of PERL programming, but one thing I've *never*
run into is a core dump. Well, today it happened. I'm using checklinks
to check URLs on my web pages. Checklinks was written by Jim Weirich
and is described in the April, 1997 issue of Linux Journal.

For most of the pages I asked it to check, there was no problem
(except for a few broken links, which it duly reported). When it
reached 

   http://darwin.eeb.uconn.edu/archives.html

however, the result was a segmentation fault and core dump. Any ideas
about what might have caused it and about how to fix it?

perl -v reports:

   This is perl, version 5.003 with EMBED
           built under sunos at Jul 11 1996 08:01:49
           + suidperl security patch

(Yes, I know it's not 5.004, but I haven't had time to upgrade yet.)

-- Kent

P.S. Running weblint v1.017 on it reports only an error in style (an
<h4> following an <h1>).

P.P.S. If it makes any difference, it seems to blow up right after
checking http://www.microsoft.com/msdn/. (One solution is obvious, but
it doesn't explain the coredump.)



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

Date: 5 Jun 1997 10:37:30 -0500
From: apc@MCS.COM (Alan Citterman)
Subject: Re: CSV Module in Perl?
Message-Id: <5n6mfq$rrc$1@Mercury.mcs.net>
Keywords: comma-separated values perl module

In article <33958511.56578515@news.netrox.net>,
Krish Menon <krish@araneum.com> wrote:
>
>Does anyone have a CSV format parsing module for Perl? I'd appreciate
>a response or an email if you know of one.

I just put the finishing touches on such a module, available via:

  ftp://ftp.mcs.net/mcsnet.users/apc/Text-CSV-0.01.tar.gz

If this doesn't serve your purposes, please let me know what it is lacking.

  - Al
--
Alan Citterman     Manufacturer's Ticket and Label Co.
alan@mfgrtl.com    (847)647-1400  Fax: (847)647-6936


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

Date: Thu, 05 Jun 1997 11:51:26 -0600
From: georgeh@maagnum.com
To: georgeh@maagnum.com
Subject: DB_File not recognizing external updates?
Message-Id: <865529270.25515@dejanews.com>

I'm having a strange problem with DB_File under Perl 5.004. I'm using the
Beta version of the module that supports Berkeley DB 2.0, and am using
2.0 as my database.

The application I've written consists of two parts. One part sits and
waits for a key name on standard input, and returns on standard output
the data associated with the key in the database. Simple enough. It keeps
running for the life of the application.

A second process is adding records to the database. The problem is that
the first application never sees the updated records until the program is
restarted (essentially, after an untie and a tie again. This isn't an
acceptable situation, because the first process could be running for
weeks or months while the data needs to be updatable at any time.

Closing the database connection and reopening it after each request isn't
an option either, as the first application could concievably be doing
lookups numbering well into the double digits per second.

Is this a limitation of the Berkeley DB system (I doubt it), a limitation
of the tie mechanism in DB_File or am I just doing something wrong?

Any help is greatly appreciated. If possible please cc: me via e-mail in
any replies.

Thanks,

George Hartz
georgeh@maagnum.com

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Thu, 5 Jun 1997 13:13:29 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: delete lines directly from file
Message-Id: <adelton.865516409@aisa.fi.muni.cz>

s11976@net2.hkbu.edu.hk (Pui Ming WONG) writes:

> I would like to know if the way to delete a line from an
> OPENed file.
> 
> I know a easy way is to read each line from the OPENED file,
> then write each line (except the line to be deleted) to a second file,
> and finally rename it to be the same name as the OPENED file.
> But i don't want to do that.
> It'll be handy if i could simply delete the line straight from
> the OPENED file (just like an editor can).
> Possible ?

No. You have to go through the file and skip the line that you do not
like.

Hope this helps.

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
     Have you done your DES today? --> http://www.des.sollentuna.se/


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

Date: Thu, 05 Jun 1997 16:27:16 +0000
From: Rob Dickens <dickenrp@boat.bt.com>
Subject: File for read and write problem.
Message-Id: <3396DAD4.694A@boat.bt.com>

I have a very strange problem with the script below.  When I run the
script instead of seeing the contents of the file I see the my scripts
code scrolling up the screen. 

open(TEMPFILE,"+<ROB.TXT")||die "error opening file $!";  
print TEMPFILE "HELLO ROB\n";                             
print TEMPFILE "greetings\n";                             
while ($readLine=<TEMPFILE>){                             
print "$readLine\n";                                      
}                

Has anyone got any ideas on what I am doing wrong ?

Many thanks
Rob Dickens


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

Date: Thu, 5 Jun 1997 09:20:07 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: David Glaser <dglaser@intercall.net>
Subject: Re: File glob works as root, but fails as regular user (?)
Message-Id: <Pine.GSO.3.96.970605091420.27920K-100000@kelly.teleport.com>

On Wed, 4 Jun 1997, David Glaser wrote:

> The file glob for "*.secret" works perfect when I'm su to root, and I
> can print the filenames returned, etc...,
> but if I'm my normal non-root user I get a message:
> 
> sh:  /dev/null: permission denied

That globbing is normally implemented by calling the csh (for technical
reasons). Maybe you don't have csh, so your perl is calling /bin/sh
instead? Maybe something is misconfigured on your system, so perl can't
call that program the way it likes?

Try this command, which (I hope) will tell us more about your system. It's
okay if some of these aren't found. If your ls won't accept the L
argument, try leaving it off. 

    ls -lL /bin/sh /bin/csh /bin/tcsh /dev/null

Also, use this one, which should tell us lots about how perl _thinks_ your
system is configured.

    perl -V

Good luck!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/




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

Date: 5 Jun 1997 14:29:34 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: Finding string length
Message-Id: <5n6ige$jd9$1@dartvax.dartmouth.edu>

In article <Pine.OSF.3.96.970604191007.5593B-100000@alf2.tcd.ie>
Kieran Tully <tullyk@tcd.ie> writes:

> How can I find the length of a string (or more particularly a line) in
> Perl ?

$i = -1;
$i++ while (defined substr($string, $i+1, 1));
$length = $i;

Chipmunk


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

Date: Thu, 5 Jun 1997 09:13:22 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Dave Mencin <dmencin@unavco.ucar.edu>
Subject: Re: Help with weird cron interaction
Message-Id: <Pine.GSO.3.96.970605091049.27920J-100000@kelly.teleport.com>

On Wed, 4 Jun 1997, Dave Mencin wrote:

> I have been having a problem running a perl script from a crontab.

It may be that you're using a different perl binary from cron than you
expect. Or, it may be that the module you use isn't found in @INC. You may
want to redirect STDERR to go with STDOUT so that you can get any
diagnostic messages Perl is sending. Good luck!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Thu, 5 Jun 1997 13:15:47 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: How to do 'chmod'
Message-Id: <adelton.865516547@aisa.fi.muni.cz>
Keywords: chmod

O C Kwon <O.C.Kwon@durham.ac.uk> writes:

> Hello ALL,
> 
> I failed to do 'chmod' the permissions of a file.
> Does anyone let me know why the following script does not 
> work?
> Thanks in advance.
> 
> -------
> #!/usr/local/bin/perl 
> 
> open(SESAME, "/home/user1/summary/sum_S0001.txt") || die
> "Cannot open sum_S0001.txt: $!\n";
> chmod(0666, "/home/user1/summary/sum_S0001.txt");  
> close(SESAME);
> -------

Can you do the chmod from the shell? What is the return value of that
chmod. Why do you open the file before chmoding?

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
     Have you done your DES today? --> http://www.des.sollentuna.se/


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

Date: 5 Jun 1997 15:48:50 GMT
From: billy@cast.msstate.edu (Billy Chambless)
Subject: Re: How to do 'chmod'
Message-Id: <5n6n52$3td$1@NNTP.MsState.Edu>
Keywords: chmod

In article <5n63ns$3sp@mercury.dur.ac.uk>, O C Kwon <O.C.Kwon@durham.ac.uk> writes:

|> I failed to do 'chmod' the permissions of a file.
|> Does anyone let me know why the following script does not 
|> work?


|> open(SESAME, "/home/user1/summary/sum_S0001.txt") || die
|> "Cannot open sum_S0001.txt: $!\n";

Uh, why are you opening the file?

Who owns the file?

|> chmod(0666, "/home/user1/summary/sum_S0001.txt");  

You misspelled 

chmod(0666, "/home/user1/summary/sum_S0001.txt") or die "Can't chmod: $!\n";

Always check the return of functons like chmod(), and always include $!
in the error message. Life will be much simpler?
|> close(SESAME);
-- 
*    "We all agree on the necessity of compromise.  We just can't agree on
*     when it's necessary to compromise."
*                --Larry Wall in  <1991Nov13.194420.28091@netlabs.com>



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

Date: Thu, 05 Jun 1997 07:48:25 -0700
From: crusso@alink.net (Chris Russo)
Subject: Re: How to send email with Mime attachment?
Message-Id: <crusso-0506970748250001@buzz.alink.net>

In article <339671C2.167E@iil.intel.com>, Bekman Stanislav
<sbekman@iil.intel.com> wrote:

>Hi,
>I need to send email with hebrew text the letters are need the 8th bit 
>which is stripped on the way. So I thought to send it with Mime
>attachment, but I see that mime.pm is an empty package ???
>
>Ofcourse the email is being sent from the perl script
>
>Any ideas or other solutions?
>Thanks a lot!

When I wanted to learn how to do this, I sent myself a mime message and
then I just replicated the headers and mime part separators that I saw
there.

Not too tough.

Regards,

Chris Russo

----------------------------------------------------------------------
Chris Russo                          A-Link Network Services, Inc.
crusso@alink.net                     Bolo me
http://www.alink.net/~crusso


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

Date: 5 Jun 1997 16:31:48 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: How to send email with Mime attachment?
Message-Id: <5n6plk$s4k@fridge-nf0.shore.net>

Bekman Stanislav (sbekman@iil.intel.com) wrote:

: I need to send email with hebrew text the letters are need the 8th bit 
: which is stripped on the way. So I thought to send it with Mime
: attachment, but I see that mime.pm is an empty package ???

Use MIME::Lite;

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: 5 Jun 1997 15:31:13 GMT
From: lvirden@cas.org
Subject: Re: NcFTP, Perl, CGI - Permission Denied
Message-Id: <5n6m41$l40$1@cas.org>


According to Alan Olsen  <root@nwdtc.com>:
:Any idea why the CPAN module calls ncftp instead of Net::FTP?

If you are using a CPAN from the past 6 months or more it tries Net::FTP
first, then LWP, then lynx, then some external ftp client.  If your version
isn't trying Net::FTP then I suspect either it's too old, or it can't
find your Net::FTP or the Net::FTP is failing.
-- 
Larry W. Virden                 INET: lvirden@cas.org
<URL:http://www.teraform.com/%7Elvirden/> <*> O- "We are all Kosh."
Unless explicitly stated to the contrary, nothing in this posting should
be construed as representing my employer's opinions.


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

Date: Thu, 5 Jun 1997 09:50:20 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Michael Genrich <mikeg@mit.edu>
Subject: Re: Need a special characters->"normal characters" converter
Message-Id: <Pine.GSO.3.96.970605094826.6610A-100000@julie.teleport.com>

On 4 Jun 1997, Michael Genrich wrote:

> Some folks in my group are looking for a perl script that will
> subsitute regular ASCII characters for 'special' characters like
> smart quotes, accented letters, grave letters, etc.

Ah, but which ASCII values represent those special characters on your
system? They may be different on mine. 

That said, this schema will work, given the appropriate translation
tables. Hope this helps!

    perl -pi.bak -e 'tr/usedtobe/nowthese/' files*

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 5 Jun 1997 14:41:15 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: newbie question
Message-Id: <5n6j6b$jd9$2@dartvax.dartmouth.edu>

In article <tcyangEBAGuM.9s7@netcom.com>
tcyang@netcom.com (Tung-chiang Yang) writes:

> I am a newbie ......  but why will every line after the first be indented
> by one space?  Of course, this is a DOS file and maybe something funny
> is going on there......

Because the array is being interpolated in double quotes when it is
printed:
print "@mylist";

>From Camel 1:
$"
This is similar to $, except that it applies to array values
interpolated into a double-quoted string (or similar interpreted
string).  Default is a space.  (Mnemonic: obvious, I think.)

So, "@mylist" is equivalent to join($", @mylist).

Chipmunk 

> ========================================
> Tom Phoenix (rootbeer@teleport.com) wrote:
> 
> : (deleted)
> 
> : > open (FILE1,"c:/files/file1.txt");
> : >     while (<FILE1>) {
> : >       s/something/something else/g;
> : >       push (@mylist,$_);
> : >         }
> : > print "@mylist";
> 
> : No. The main problems with that code are
> :   1. it never checks that the file was successfully opened,
> :   2. it needlessly loads the entire file into memory (in @mylist), and
> :   3. it will indent every line after the first by one space.
> 
> : (deleted)


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

Date: Wed, 04 Jun 1997 18:11:54 +0300
From: Daniel Schnaider <snaider@galcom.co.il>
Subject: NNTP
Message-Id: <339585B9.CECFEEED@galcom.co.il>

I am looking for a source of informaiton!
I am trying to make an NNTP client... Where can I find information about
it!
Thank you,

Daniel



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

Date: Thu, 5 Jun 1997 09:08:54 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Jason Pociask <pociask@maricopa.edu>
Subject: Re: open won't open files in subdirectories?
Message-Id: <Pine.GSO.3.96.970605090734.27920I-100000@kelly.teleport.com>

On Wed, 4 Jun 1997, Jason Pociask wrote:

> the "open" routine needs the full path name, not a relative path name. 

Not true. (Or, if it is true for you, your Perl or system is buggy, and
you should file a bug report.)

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 5 Jun 1997 15:29:28 GMT
From: kjetil.skotheim@usit.uio.no (Kjetil Skotheim)
Subject: Re: Out of memory with big hashes
Message-Id: <5n6m0o$lg0$2@ratatosk.uio.no>

In article <33936d78.40456073@news.ricochet.net>, phil@glatz.com says...
>
>I have an analysis perl (5.003) program that puts stuff into a big
>hash array - I eventually get an out of memory fatal exception.  I'm
>running an HP 9000 with 192 megs, HPUX 10.20.
>
>Looking for hints on memory efficiency, I tries using the
>Tie::SubstrHash module to create a tighter table.  But wow, things
>seem to slow to a crawl!  Am I on the right track re memory reduction?
>Does this module normally slow things down?

Yes it does. Accessing something is maybe 4-10 times slower
than with normal untied hashes. Depends on hash key length.

BTW, how large keys do you have? I found a bug/flaw in SubstrHash
when using keys longer than about 8-9 chars which made it VERY MUCH
slower. It can be fixed by inserting:

	$hash = substr($hash,-8) if length($hash)>13;

in sub hashkey in SubstrHash.pm rigth below

	$hash = $hash * 33 + $_;



>
>------------------------------------------
>Phil Glatz                (phil@glatz.com)
>Software Engineer       Lake Tahoe, Nevada
>WWW: http://www.glatz.com

--
Kjetil Skotheim



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

Date: Thu, 5 Jun 1997 17:33:59 +0400
From: "Valeriy E. Ushakov" <uwe@ptc.spbu.ru>
Subject: patch: pack template that packs like 'a' but unpacks like 'A'
Message-Id: <%9+rlz4DPT@snark.ptc.spbu.ru>

On Thu, 5 Jun 1997, I wrote:

> a - any - This one is for binary data.  You can grab some bytes as is
>   when you unpack.  You can put some bytes when you pack and null
>   padding is just what you expect for binary data (least surprise).
>   This one is symmetric for bynary.
> 
> A - ASCII - This one is controversial.  It strips away nulls and
>   spaces when you unpack and when you need to grab some printable text
>   this is what you expect.  But padding with spaces when you pack is a
>   bit useless.  I wonder if people actully use 'A' for packing.  If
>   one is to work with text, split/sprintf/format will do better most
>   of the time.  I suspect 'A' is commonly used for unpacking only.
>   This one is symmetric for text.
> 
> Z - ASCIZ - The one we miss.  (I use upper case this time, unlike my
>   first exaple, for it is more similar to 'A' than to 'a' (any)).
>   Packs with trailing nulls.  Unpacks stripping nulls.  I came to
>   think that it should strip *ONLY* nulls, not spaces, if we intend it
>   to work with C null delimited strings.  This one is symmetric for
>   C strings.

Well, it's longer than 3 lines for new 'Z' format strips only nulls
unlike 'A' that strips both nulls and spaces.

--- pp.c.dist	Fri Apr 25 05:56:28 1997
+++ pp.c	Thu Jun  5 10:13:00 1997
@@ -2724,6 +2724,7 @@
 	    s += len;
 	    break;
 	case 'A':
+	case 'Z':
 	case 'a':
 	    if (len > strend - s)
 		len = strend - s;
@@ -2732,11 +2733,15 @@
 	    sv = NEWSV(35, len);
 	    sv_setpvn(sv, s, len);
 	    s += len;
-	    if (datumtype == 'A') {
+	    if (datumtype == 'A' || datumtype == 'Z') {
 		aptr = s;	/* borrow register */
 		s = SvPVX(sv) + len - 1;
-		while (s >= SvPVX(sv) && (!*s || isSPACE(*s)))
-		    s--;
+		if (datumtype == 'Z') /* 'Z' strips only nulls */
+		    while (s >= SvPVX(sv) && (!*s))
+			s--;
+		else		/* 'A' strips both nulls and spaces */
+		    while (s >= SvPVX(sv) && (!*s || isSPACE(*s)))
+			s--;
 		*++s = '\0';
 		SvCUR_set(sv, s - SvPVX(sv));
 		s = aptr;	/* unborrow register */
@@ -3500,6 +3505,7 @@
 	    sv_catpvn(cat, null10, len);
 	    break;
 	case 'A':
+	case 'Z':
 	case 'a':
 	    fromstr = NEXTFROM;
 	    aptr = SvPV(fromstr, fromlen);


SY, Uwe
-- 
uwe@ptc.spbu.ru                         |       Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/            |       Ist zu Grunde gehen



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

Date: 5 Jun 1997 14:59:07 GMT
From: kjetil.skotheim@usit.uio.no (Kjetil Skotheim)
Subject: Perl5 garbage collection too lazy?
Message-Id: <5n6k7r$lg0$1@ratatosk.uio.no>


I am implementing a perl5-program using hashes with HUGE strings as
values. The problem is to keep memory usage down. I do not need all
hashes at all times and want to remove those I dont need anymore.

I have tried  undef %hash, but when watching the memory usage while
running, nothing happens. Even after more than 3 minutes. This %hash
is a 14MB beast.

I have also tried for(keys %hash){delete $hash{$_}}, still no
response.

Is the garbage collection to lazy? Any tips?


I use perl5.003 on HP-UX 10. And using  top  to watch memory usage.



--
Kjetil Skotheim, kjetilsk@usit.uio.no



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

Date: 5 Jun 1997 16:08:22 GMT
From: dribbs@netspace.org (Keith Dreibelbis)
Subject: POSIX.pm with perl shell causes SEGV, AIX 5.003
Message-Id: <5n6o9m$crq@cocoa.brown.edu>


The following sequence will produce a SEGV (AIX perl 5.003):

% perl -e 'while (<>) { eval; print $@ }'
use POSIX;
^D

Or you can also say
% echo "use POSIX" | perl -e 'while (<>) { eval; print $@ }'

It only happens when the program tries to exit.  It does not happen in
other programs where I used the POSIX module; those tend to not use STDIN
or eval as often.  Any ideas why this is happenning, or is it fixed in
5.004?  It does not seem to occur with other modules.
--
Keith Dreibelbis
dribbs@netspace.org


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

Date: 5 Jun 1997 15:04:30 GMT
From: bxb121@psu.edu (Brett Borger)
Subject: Replacing A single Text Character
Message-Id: <5n6khv$ti8@r02n01.cac.psu.edu>

Help!
I'm using a severely bastardized version of Perl for Novell Netware on our 
Web Page.  Among the problems it causes are:
1) No command line swithces
2) No documentation
3) A lot of Standard Perl functions just don't work.

As far as I've been able to tell, it's a modification of some v4 perl.  
but this is all background to the problem:

In processing a form which (among other things) creates a file which is 
picked up by our mail program, it has come up that any line that is too 
long (approx 600 chars or so) gets truncated.  I was trying to modify the 
script to fix this.  My idea was (based on not wanting any line >230 or 
so)
$start=0;
$end=0;
$lng=length($MYSTR);
while($lng >230)
{
	$ind=rindex($MYSTR,' ',230+$start);
	$start=$start+$ind;
	splice($MYSTR,$ind,1,'\n');    #PROBLEM!!!!
	$lng=$end-$start;
};

The idea being that I can write a shorter string to the file, which 
(because of the newline) becomes a seperate line to the email.  
I know splice() is looking for an Array, but how can I "do what I mean"?  

I only want to replace the spaces I need to, not all of them.  

Also, if you could reply (or CC: me) over private email, I'd appreciate 
it...I don't get much chance to read this group.  

swiftone@psu.edu

THanks.	



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

Date: Thu, 05 Jun 1997 10:48:49 +0800
From: "Felix R. Penetrante" <felix@cats.edu.ph>
Subject: Rounding off numbers
Message-Id: <33962911.19BA@cats.edu.ph>

Is there a built-in function for rounding off floating point numbers.


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

Date: Thu, 05 Jun 1997 10:50:19 +0800
From: "Felix R. Penetrante" <felix@cats.edu.ph>
Subject: Rounding off numbers
Message-Id: <3396296B.36BC@cats.edu.ph>

Is there a built-in perl function for rounding off floating point
numbers.


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

Date: 05 Jun 1997 10:25:37 -0400
From: Dean Pentcheff <dean@tbone.biol.sc.edu>
Subject: Re: Rounding off numbers
Message-Id: <m1d8q1p1ni.fsf@nauplius.psc.sc.edu>

"Felix R. Penetrante" <felix@cats.edu.ph> writes:
> Is there a built-in perl function for rounding off floating point
> numbers.

Check the Perl documentation for sprintf.

-Dean
-- 
N. Dean Pentcheff   <pentcheff@acm.org>   WWW: http://tbone.biol.sc.edu/~dean/
Biological Sciences, Univ. of South Carolina, Columbia SC 29208 (803-777-3936)
PGP ID=768/22A1A015 Keyprint=2D 53 87 53 72 4A F2 83  A0 BF CB C0 D1 0E 76 C0 
Get PGP keys and information with the command: "finger dean@tbone.biol.sc.edu"


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

Date: Thu, 5 Jun 1997 09:53:14 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Jahwan Kim <jahwan@supernova.math.lsa.umich.edu>
Subject: Re: Suggestion to all frequent posters/answerers
Message-Id: <Pine.GSO.3.96.970605095148.6610B-100000@julie.teleport.com>

On 5 Jun 1997, Jahwan Kim wrote:

>     So I suggest/ask you with all my respect to include RTFM/RTF/CCPAN in
> the subject line, when your posting does not have anything else at all.

Wouldn't it be better for these people to see frequent references to the
FAQ and docs, so that they don't waste time asking those questions in the
first place? :-)

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Thu, 05 Jun 1997 16:05:20 +0000
From: Michael James Cameron <michael.cameron@mci.com>
Subject: tftp client
Message-Id: <3396E3C0.77E8@mci.com>

I am fairly new to Perl and completely new to sockets and want to write
a tftp client - can anyone offer any help and/or advice?

Any sample scripts or other help would be greatly appreciated.

Thanks,

mailto:Michael.Cameron@MCI.com


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

Date: Thu, 5 Jun 1997 08:56:14 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Robert U Myers <robertmy@pogo.wv.tek.com>
Subject: Re: Using debugger with formats in the file
Message-Id: <Pine.GSO.3.96.970605085548.27920F-100000@kelly.teleport.com>

On Wed, 4 Jun 1997, Robert U Myers wrote:

> When I have formats in my file the debugger never stops at break
> points.  

I don't think that's the way it's supposed to work. Are you using 5.004?

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Thu, 05 Jun 1997 15:53:04 +0100
From: Chris Cocker <chris@webworks.co.uk>
Subject: WWW Programmer/Web Server administrator
Message-Id: <3396D2D0.5E7@webworks.co.uk>

Leading London web-site design company is looking for a degree level
Programmer/Web Server administrator

C, C++, Perl, ASP, Javascript, IIS3, NT4 Server, ODBC, Java, VB
essential.
Working with experienced designers youll play a vital role in helping
us expand our blue-chip client 

list.

Webworks
19-21 Charlotte Street
London
W1P 1HB

Tel: Chris Taylor or Peter 0171 436 0101


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.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 575
*************************************

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