[9426] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3021 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 30 14:07:40 1998

Date: Tue, 30 Jun 98 10:55: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           Tue, 30 Jun 1998     Volume: 8 Number: 3021

Today's topics:
        Read from file 0.5 -0.5 0 etc (Huang)
    Re: Read from file 0.5 -0.5 0 etc <rra@stanford.edu>
    Re: Read from file 0.5 -0.5 0 etc <quednauf@nortel.co.uk>
    Re: Read from file 0.5 -0.5 0 etc <tchrist@mox.perl.com>
        readdir sort by date in Perl? (C. Wopat)
    Re: readdir sort by date in Perl? <rootbeer@teleport.com>
    Re: readdir sort by date in Perl? <ckilburn@nbnet.nb.ca>
    Re: readdir sort by date in Perl? (Smith and O'Halloran)
    Re: readdir sort by date in Perl? <tchrist@mox.perl.com>
    Re: readdir sort by date in Perl? (Smith and O'Halloran)
    Re: readdir sort by date in Perl? (Larry Rosler)
    Re: readdir sort by date in Perl? <rootbeer@teleport.com>
        Reading and detecting white space (Brian Day)
    Re: Reading and detecting white space <rootbeer@teleport.com>
    Re: Reading and detecting white space (Tad McClellan)
        Reading binary data form a PICT file <pr1@club-internet.fr>
        replacing search variable in foreach <kimplera@med.unc.edu>
    Re: replacing search variable in foreach <rootbeer@teleport.com>
        RTF to Text conversion <rick@iei.net>
    Re: RTF to Text conversion (Charlie Stross)
        running a cgi/perl program every 7 am? userjeff@my-dejanews.com
    Re: running a cgi/perl program every 7 am? <perlguy@inlink.com>
    Re: running a cgi/perl program every 7 am? (Larry Rosler)
    Re: running a cgi/perl program every 7 am? <perlguy@inlink.com>
    Re: screenwidth <perlguy@inlink.com>
        Scripts run by Apache can't find Mods (ChopThisBit)
    Re: Scripts run by Apache can't find Mods <jdf@pobox.com>
    Re: Scripts run by Apache can't find Mods (ChopThisBit)
    Re: Scripts run by Apache can't find Mods (ChopThisBit)
        send email from client browser using perl [HELP!!!] <ty.wong@utoronto.ca>
    Re: send email from client browser using perl [HELP!!!] <rootbeer@teleport.com>
    Re: send email from client browser using perl [HELP!!!] <jwb79@mail.idt.net>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Mon, 29 Jun 1998 14:54:14 GMT
From: wong2020@tm.net.my (Huang)
Subject: Read from file 0.5 -0.5 0 etc
Message-Id: <3597a983.807304@news.tm.net.my>

Hi all:

    What I wish to accomplish here is I wish to read from the input
file. The data in the input file is something like this:
0.5 0 4 -1 -2 0

    I have write segments of codes. Please read the below. It seems
that it cannot capture the 0.5 (whatever in decimal format) and -1
(whatever in negative sign). But it is capable of reading the
following input file:
1 0 1 0 1 0

   Can you help me on this. 

   open (INPUTFILE, "C:\perl\perl5\input.txt");
    $line=<INPUTFILE>;
  
 
      while ($line = <>)  

    { 
      $input = $line;
      $a=0; 
      $x[$count,$j]= substr ($input,$a,1);  
      $a= ($a+2);


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

Date: 29 Jun 1998 08:33:04 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Read from file 0.5 -0.5 0 etc
Message-Id: <m3zpewmde7.fsf@windlord.Stanford.EDU>

comp.lang.perl doesn't actually exist and hasn't for quite some time.  You
may want to ask your news administrator to check the list of newsgroups he
carries against the checkgroups posted to news.announce.newgroups to
update his server.

In comp.lang.perl.misc, Huang <wong2020@tm.net.my> writes:

> What I wish to accomplish here is I wish to read from the input
> file. The data in the input file is something like this: 0.5 0 4 -1 -2 0

The easiest way to parse whitespace-separated data is to use split.

> I have write segments of codes. Please read the below. It seems that it
> cannot capture the 0.5 (whatever in decimal format) and -1 (whatever in
> negative sign). But it is capable of reading the following input file: 1
> 0 1 0 1 0

Sure.  That's because:

>       $x[$count,$j]= substr ($input,$a,1);

you're using substr and only grabbing one character.  Obviously this can
only read numbers that are only one character.

        my $line = <INPUT>;
        @data = split (' ', $line);

would put in @data the array of numbers contained on a line of input
provided that they were whitespace-separated.  I think that's more what
you want.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Mon, 29 Jun 1998 16:43:52 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Read from file 0.5 -0.5 0 etc
Message-Id: <3597B638.FA885D6B@nortel.co.uk>

-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________
Huang wrote:
> 
> Hi all:
> 
>     What I wish to accomplish here is I wish to read from the input
> file. The data in the input file is something like this:
> 0.5 0 4 -1 -2 0
 
>    Can you help me on this.
> 
>    open (INPUTFILE, "C:\perl\perl5\input.txt");
>     $line=<INPUTFILE>;
> 
> 
>       while ($line = <>)
> 
>     {
>       $input = $line;
>       $a=0;
>       $x[$count,$j]= substr ($input,$a,1);
>       $a= ($a+2);

All very cumbersome, and in fact doesn't work because you are reading one byte
with the substring. It doesn't work on things like -2 or 0.5...

Consider this:

open FILE, "< /u/quednauf/temp/testfile.txt" or die "didn't happen: $!";
while (<FILE>) {
  @numbers = split(/ /);
}
close FILE;
for (@numbers) {print "$_\n";}

This splits up the input stream at the spaces and smacks it into the numbers
array.

But, in fact, it is the old 'don't adapt the problems to the tools, use the
right tools for the problem' , or DATP(3xT)UTRTFTP :) (Sounds crap, doesn't it?)

Do a bit more reading on what Perl can do for you.


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

Date: 29 Jun 1998 16:26:36 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Read from file 0.5 -0.5 0 etc
Message-Id: <6n8f7s$24p$3@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, "F.Quednau" <quednauf@nortel.co.uk> writes:
:  @numbers = split(/ /);

This always scares me because it says split on each single literal space.
Usually you mean:

    @numbers = split(' ');

which is different than what you wrote, but the same as

    @numbers = split;

I'd rather that the amount of whitespace not be significant, nor
whether it should contain tabs.  And I don't want any leading whitespace
to count.

--tom
-- 
    I already have too much problem with people thinking the efficiency of
    a perl construct is related to its length.  On the other hand, I'm
    perfectly capable of changing my mind next week...  :-) --lwall


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

Date: Sun, 28 Jun 1998 18:59:38 GMT
From: falz@crud.com (C. Wopat)
Subject: readdir sort by date in Perl?
Message-Id: <359694c7.0@204.120.4.15>

Hi-

        Anyone out there have a routine to use readdir to grab a directory 
listing, and sort it by date? Thanks in advance..

--Chris



       =========================
 ***   C. Wopat  [falz@crud.com]   ***
****   http://www.crud.com/sega    ****
 ***   http://www.crud.com/alien   ***
       =========================


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

Date: Sun, 28 Jun 1998 20:04:49 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: readdir sort by date in Perl?
Message-Id: <Pine.GSO.3.96.980628130356.7277E-100000@user2.teleport.com>

On Sun, 28 Jun 1998, C. Wopat wrote:

>         Anyone out there have a routine to use readdir to grab a
> directory listing, and sort it by date? 

Which part of that are you stuck on, reading the directory, finding the
dates, or sorting? 

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sun, 28 Jun 1998 17:59:21 -0300
From: Colin Kilburn <ckilburn@nbnet.nb.ca>
Subject: Re: readdir sort by date in Perl?
Message-Id: <3596AEA9.E3BF7C@nbnet.nb.ca>

Check out the book "Effective Perl Programming".
Item 14 would be a good read. I could give you an example,
but this is worth a trip to to bookstore. It chalk full of stuff.
It's written by Joseph N. Hall and Randal L. Schwartz.

I assume you already have the convenient Camel book.
I use my electronic version all the time.
This should sharpen your future questions.

 C.

Tom Phoenix wrote:

> On Sun, 28 Jun 1998, C. Wopat wrote:
>
> >         Anyone out there have a routine to use readdir to grab a
> > directory listing, and sort it by date?
>
> Which part of that are you stuck on, reading the directory, finding
> the
> dates, or sorting?
>
> --
> Tom Phoenix       Perl Training and Hacking       Esperanto
> Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/





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

Date: 29 Jun 1998 14:46:09 -0700
From: inwap@best.com (Smith and O'Halloran)
Subject: Re: readdir sort by date in Perl?
Message-Id: <6n91v1$h17$1@shell3.ba.best.com>

In article <359694c7.0@204.120.4.15>, C. Wopat <falz@crud.com> wrote:
>        Anyone out there have a routine to use readdir to grab a directory 
>listing, and sort it by date? Thanks in advance..

sub read_dir {          # Read directory, set %size, %date and $namewidth
  opendir(DIR,$_[0]) || die "Cannot read directory $dir: $!\n";
  foreach $_ (grep(!/^\./,readdir(DIR))) {	# Skip dot files
    ($size{$_},$date{$_}) = (stat $_)[7,9];
  }; closedir(DIR);
}
sub bysize {return $size{$b} <=> $size{$a};}    # Largest first
sub bydate {return $date{$b} <=> $date{$a};}    # Newest first

if ($order eq "bysize") {
  @files = sort bysize keys %size;      # Largest file first
} elsif ($order eq "bydate") {
  @files = sort bydate keys %date;      # Newest file first
} else {
  @files = sort keys %size;             # Default is "byname";
}
-- 
INWAP.COM is Joe and Sally Smith, John and Chris O'Halloran and our cats
See http://www.inwap.com/ for "ReBoot", PDP-10, and Clan MacLeod.
-- 
INWAP.COM is Joe and Sally Smith, John and Chris O'Halloran and our cats
See http://www.inwap.com/ for "ReBoot", PDP-10, and Clan MacLeod.


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

Date: 29 Jun 1998 22:56:34 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: readdir sort by date in Perl?
Message-Id: <6n9632$l9$2@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    inwap@best.com (Smith and O'Halloran) writes:
:  foreach $_ (grep(!/^\./,readdir(DIR))) {	# Skip dot files
:    ($size{$_},$date{$_}) = (stat $_)[7,9];

That code is incorrect.  You forgot what readdir returns, or
what stat wants, or both.

--tom
-- 
The English have no respect for their language, and will not teach
their children to speak it.
                -- G. B. Shaw


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

Date: 29 Jun 1998 23:07:12 -0700
From: inwap@best.com (Smith and O'Halloran)
Subject: Re: readdir sort by date in Perl?
Message-Id: <6n9vag$edd$1@shell3.ba.best.com>

In article <6n9632$l9$2@csnews.cs.colorado.edu>,
Tom Christiansen  <tchrist@mox.perl.com> wrote:
> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc, 
>    inwap@best.com (Smith and O'Halloran) writes:
>:  foreach $_ (grep(!/^\./,readdir(DIR))) {	# Skip dot files
>:    ($size{$_},$date{$_}) = (stat $_)[7,9];
>
>That code is incorrect.  You forgot what readdir returns, or
>what stat wants, or both.
>--tom

I'm going to have to disagree with the expert.

readdir() returns a list of strings.  'foreach' goes through the strings
one at a time.  stat() receives a string.  All cool.

That code works; at http://www.inwap.com/mybin/ it appears as both
index.cgi and list-files.pl .

	-Joe
-- 
INWAP.COM is Joe and Sally Smith, John and Chris O'Halloran and our cats
See http://www.inwap.com/ for "ReBoot", PDP-10, and Clan MacLeod.


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

Date: Mon, 29 Jun 1998 23:36:08 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: readdir sort by date in Perl?
Message-Id: <MPG.1002272fcb33d797989702@nntp.hpl.hp.com>

In article <6n9vag$edd$1@shell3.ba.best.com> on 29 Jun 1998 23:07:12 -
0700, Smith and O'Halloran <inwap@best.com> says...
> In article <6n9632$l9$2@csnews.cs.colorado.edu>,
> Tom Christiansen  <tchrist@mox.perl.com> wrote:
> >In comp.lang.perl.misc, 
> >    inwap@best.com (Smith and O'Halloran) writes:
> >:  foreach $_ (grep(!/^\./,readdir(DIR))) {	# Skip dot files
> >:    ($size{$_},$date{$_}) = (stat $_)[7,9];
> >
> >That code is incorrect.  You forgot what readdir returns, or
> >what stat wants, or both.
> >--tom
> 
> I'm going to have to disagree with the expert.
> 
> readdir() returns a list of strings.  'foreach' goes through the strings
> one at a time.  stat() receives a string.  All cool.
> 
> That code works; at http://www.inwap.com/mybin/ it appears as both
> index.cgi and list-files.pl .

As you make clear in your script, it works for files in the current 
directory only, not in general.  Perhaps that is the issue Tom C is 
raising.

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


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

Date: Tue, 30 Jun 1998 06:21:00 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: readdir sort by date in Perl?
Message-Id: <Pine.GSO.3.96.980629231801.17225T-100000@user2.teleport.com>

On 29 Jun 1998, Smith and O'Halloran wrote:

> In article <6n9632$l9$2@csnews.cs.colorado.edu>,
> Tom Christiansen  <tchrist@mox.perl.com> wrote:

> >:  foreach $_ (grep(!/^\./,readdir(DIR))) {	# Skip dot files
> >:    ($size{$_},$date{$_}) = (stat $_)[7,9];
> >
> >That code is incorrect.  You forgot what readdir returns, or
> >what stat wants, or both.

> I'm going to have to disagree with the expert.

Probably not a good plan. :-)

> readdir() returns a list of strings.  'foreach' goes through the strings
> one at a time.  stat() receives a string.  All cool. 

Maybe not. readdir returns a list of filenames in one directory. The
filenames don't have any directory part. Now stat looks for those
filenames in the current directory. What happens if the current directory
is not the same one as readdir was using?

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 29 Jun 1998 22:18:31 GMT
From: bday@mtv03install2.eng.sun.com (Brian Day)
Subject: Reading and detecting white space
Message-Id: <6n93rn$snn$1@engnews2.Eng.Sun.COM>
Keywords: perl white space


I am very new to Perl, but somewhat experienced with C++.  My question is in regards to whether or not there is a way to read in white space, and then detect that white space with Perl.  In C++ there is a system funcion get( ) that will not skip white space, and another system function isspace( ) that detects it.  Is there such a thing that already exists in Perl, or is there a way to implement this.

Any info would be greatly appreciated.

Thank You,
Brian



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

Date: Tue, 30 Jun 1998 03:22:48 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Reading and detecting white space
Message-Id: <Pine.GSO.3.96.980629201948.17225D-100000@user2.teleport.com>

On 29 Jun 1998, Brian Day wrote:

> My question is in regards to whether or not there is a way to read in
> white space, and then detect that white space with Perl. 

Yes. In fact, there's more than one way to do it. Probably you want
something like the FAQ's methods of stripping whitespace from the
beginning and ending of a string. It's in section four. Hope this helps! 

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 29 Jun 1998 23:54:27 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Reading and detecting white space
Message-Id: <32r9n6.m56.ln@localhost>

Brian Day (bday@mtv03install2.eng.sun.com) wrote:

: I am very new to Perl, 

   Welcome!


: but somewhat experienced with C++.  

   You have to put your head on differently to do idiomatic perl (sometimes).

   [
      You also appear to be new to Usenet, as you put all 404 characters of
      the body of your message on a single line!

      Please word wrap at 70-72 characters like you're supposed to.
   ]


: My question is in regards to whether or not there is a way to read 
: in white space, 

   Yes.

   $_ = <>; # reads in a "line". 

   White space chars are chars like any other, no special treatment.


: and then detect that white space with Perl.  

   print "contains whitespace\n" if /\s/; # see 'perlre' and 'perop' man pages


: In C++ there is a system funcion get( ) that will not skip white space, 
: and another system function isspace( ) that detects it.  

: Is there such a thing that already exists in Perl, or is 
: there a way to implement this.

   You often do things differently in perl. You very seldom
   really need to do character-by-character input, which it seems
   you are wanting (is it "want" or "need") to do.

   Can you tell us what it is that you really want to do?

   Do you want to tokenize based on white space separators?
   (  @tokens = split /\s+/, $line;  )

   Delete all the white space?  (  s/\s//g;  )

   Walk your way through, stripping off each token as you go?
   (  while (s/([^\s]+)\s?//) {print "token: $1\n"}  )

   ???


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


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

Date: Mon, 29 Jun 1998 18:56:37 +0200
From: Philippe de Rochambeau <pr1@club-internet.fr>
Subject: Reading binary data form a PICT file
Message-Id: <3597C745.7AEDE28D@club-internet.fr>

Hello,

I am trying to read a PICT file's binary data using (Mac)Perl.  Here is my code:


========== Code begins =========
#!Perl -w
# OuvrirImage.pl
# Date : 29/6/98

my ($file, $bytes, $bytesToASCII, @type, $i);
$i = 0;

open(FILEHANDLE, "Macintosh HD:REALBasic:Dossier mes projets:TexteBinaire") ||
 die "";

# Skip 512 charactersd (header)
seek(FILEHANDLE, 512, 1);

&printBytes("File size : ", 2);
&printBytes("Frame's upper-left X : ", 2);
&printBytes("Frame's upper-left Y : ", 2);
&printBytes("Frame's lower-right X : ", 2);
&printBytes("Frame's lower-right Y : ", 2);
&printBytes("Opcode version : ", 2); # 2 si PICT version 2
&printBytes("Version number : ", 2); # 2 si PICT version 2


close(FILEHANDLE);

sub printBytes {
	my($texte, $taille) = @_;
	my($bytes, $bytesToASCII, $format);

	read(FILEHANDLE, $bytes, $taille);
	$format = ("s" . $taille);
	$bytesToASCII = unpack($format, $bytes);
	print("$texte\'$bytesToASCII\'\n");
}
========= Code ends =======

This code prints out numbers but I am not sure if they are right.

Am I using the correct unpack format (i.e. 's2' for two signed short values)?

Many thanks.

Philippe de Rochambeau


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

Date: Mon, 29 Jun 1998 13:27:33 -0400
From: Randy Kimple <kimplera@med.unc.edu>
Subject: replacing search variable in foreach
Message-Id: <3597CE85.8152DF24@med.unc.edu>

I have a foreach loop in which I need to replace a section of code with
a different line each time through.  I've looked in my camel book and in
the faq and can't find a way to do it.  Here is a snipet of my code in
which $insert needs to change each time through the loop.  I'm sure this
could be written using less code, but I am just a newbie and am not yet
concerned about optimizing the program(that'll be later).

foreach $position(@position) {
  open(FILE, "$section");
  while($file = <FILE>) {
    if ($insert[$position]) {
      print "The number of hits is: $key\n";
  }
}
$insert is of the form:
    ($junk, $hits) = $file =~ m/(\s*matched\s<B>)(\d*)/
Earlier in the program I initialize @insert with the different strings
that need to put in the program.  As $position increments each time
through, a different $insert is accessed.
It will change the matching pattern for each section.  I think I could
do this with a switch, but would like a better way(if there is one).
Thanks for your help.

randy



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

Date: Mon, 29 Jun 1998 21:48:20 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: replacing search variable in foreach
Message-Id: <Pine.GSO.3.96.980629143332.28620L-100000@user2.teleport.com>

On Mon, 29 Jun 1998, Randy Kimple wrote:

> I have a foreach loop in which I need to replace a section of code with
> a different line each time through.  

I'm not sure what you're meaning. Maybe you shouldn't be using a foreach
loop? If you want to do something different each time through the loop,
maybe you shouldn't use a loop at all, but a sequence of statements
instead. 

> Here is a snipet of my code in which $insert needs to change each time
> through the loop. 

It's easy enough to change it. In what way would you like it to be
changed, though?

> foreach $position(@position) {
>   open(FILE, "$section");

It's unlikely (but possible) that you want to open a new file each time
through the loop. It's more likely that you want to open it once, outside
the loop. (You may or may not want to seek to the beginning in each
iteration.) 

Of course, those double quotes are merely misleading. And even when your
script is "just an example" (and perhaps especially in that case!) you
should _always_ check the return value after opening a file. 

>   while($file = <FILE>) {
>     if ($insert[$position]) {

Of course, this is different than $insert which you mentioned earlier. 

>       print "The number of hits is: $key\n";

What's all this trying to do? What are $key, @insert, and $section?

>   }
> }

> $insert is of the form:
>     ($junk, $hits) = $file =~ m/(\s*matched\s<B>)(\d*)/

I don't know what you mean by that. The two parts of that statement have
some meaning independently, but they don't have meaning when they're
together. That's like saying that your cat is the color of today
establishment.  :-) 

> Earlier in the program I initialize @insert with the different strings
> that need to put in the program.  As $position increments each time
> through, a different $insert is accessed.

Maybe you mean that you intend to increment $position each time through
the loop. That could be meaningful. 

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 29 Jun 1998 05:12:46 -0500
From: Rick Morris <rick@iei.net>
Subject: RTF to Text conversion
Message-Id: <3597689E.8A@iei.net>

Does know of a script that will convert RTF or MS-Word documents to flat
text?

Thanks


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

Date: Mon, 29 Jun 1998 12:01:09 GMT
From: charlie@antipope.org (Charlie Stross)
Subject: Re: RTF to Text conversion
Message-Id: <slrn6pf0g0.rfn.charlie@cs.ed.datacash.com>

In the name of Kibo the Compassionate, the Merciful,
on Mon, 29 Jun 1998 05:12:46 -0500,Rick Morris
the supplicant <rick@iei.net> implored:

>Does know of a script that will convert RTF or MS-Word documents to flat
>text?

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



-- Charlie

"One World. One Web. One Program."
      -Microsoft promotional advertisement
"Ein Volk, ein Reich, ein Fuhrer!"
      -Adolf Hitler


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

Date: Tue, 30 Jun 1998 07:19:44 GMT
From: userjeff@my-dejanews.com
Subject: running a cgi/perl program every 7 am?
Message-Id: <6na3ig$spm$1@nnrp1.dejanews.com>

I have got a cgi program written in perl.
I need run it 7 am every day. In UNIX one
can simply use the command `at' to do so.
Are they any equivalent command in perl/cgi
that can do such background job?

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


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

Date: Tue, 30 Jun 1998 11:09:49 GMT
From: Brent Michalski <perlguy@inlink.com>
Subject: Re: running a cgi/perl program every 7 am?
Message-Id: <3598C77D.1FC9BB62@inlink.com>

Well,

You could write a Perl program that loops forever and checks the time
each time throught the loop.  Then, at the specified time, does what it
needs to do and then keeps on running.

However, this would probably be VERY inefficient and waste a lot of CPU
time.

You mentioned the UNIX 'at' command.  Why not use it?  That is what it
was designed for.  If you are on NT, it too has an equivalent command. 
I'd bet the there is a freeware product out there for Win95 too.

Good luck,

Brent


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

Date: Tue, 30 Jun 1998 07:43:23 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: running a cgi/perl program every 7 am?
Message-Id: <MPG.10029968f7840dd8989704@nntp.hpl.hp.com>

In article <3598C77D.1FC9BB62@inlink.com> on Tue, 30 Jun 1998 11:09:49 
GMT, Brent Michalski <perlguy@inlink.com> says...
> Well,
> 
> You could write a Perl program that loops forever and checks the time
> each time throught the loop.  Then, at the specified time, does what it
> needs to do and then keeps on running.
> 
> However, this would probably be VERY inefficient and waste a lot of CPU
> time.

Instead of looping forever, one would use the sleep() function to wake up 
at appropriate intervals, check the time, and go back to sleep if 
necessary.  The only significant cost is one process in the process 
table.

> You mentioned the UNIX 'at' command.  Why not use it?  That is what it
> was designed for.  If you are on NT, it too has an equivalent command. 
> I'd bet the there is a freeware product out there for Win95 too.

This was the original submission:

>In article <6na3ig$spm$1@nnrp1.dejanews.com> on Tue, 30 Jun 1998 
07:19:44 GMT, userjeff@my-dejanews.com <userjeff@my-dejanews.com> says...
>> I have got a cgi program written in perl.
>> I need run it 7 am every day. In UNIX one
>> can simply use the command `at' to do so.
>> Are they any equivalent command in perl/cgi
>> that can do such background job?

The simplest Unix command is 'cron'.  'at' asks for one delayed execution 
(which can perhaps reschedule itself for the next day, but why bother?).  
The NT command is 'at /every:...'.  I too would be interested in a Win95 
command.  Is there one?

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


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

Date: Tue, 30 Jun 1998 15:43:14 GMT
From: Brent Michalski <perlguy@inlink.com>
Subject: Re: running a cgi/perl program every 7 am?
Message-Id: <35990791.DE5FDECD@inlink.com>

Thanks Larry!

Much better idea.  That't what I love about the Usenet.  There are so
many different solutions that you are almost always presented with many
different options to solving your problem.

Brent

> Instead of looping forever, one would use the sleep() function to wake > up at appropriate intervals, check the time, and go back to sleep if
> necessary.  The only significant cost is one process in the process
> table.


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

Date: Mon, 29 Jun 1998 14:16:26 GMT
From: Brent Michalski <perlguy@inlink.com>
Subject: Re: screenwidth
Message-Id: <3597A1BA.8E945EF1@inlink.com>

Since Perl runs on the server, I doubt that you would want the screen
width of the server even IF Perl could determine it.

I think sticking to the client-side languages for determining
client-side attributes is a good bet...

Brent


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

Date: Mon, 29 Jun 1998 08:58:49 +0000
From: John Robinson <"J.S.Robinson"@(ChopThisBit)soton.ac.uk>
Subject: Scripts run by Apache can't find Mods
Message-Id: <6n7l2e$84i$1@aspen.sucs.soton.ac.uk>

I'm having problems with Apache 1.3 running scripts on RedHat 5.0. The
scripts in question (from smb2www) will run just fine from the command
line, but when Apache tries to run them, it stops with the following...

Can't locate MIME/Base64.pm in @INC (@INC contains:
/usr/lib/perl5/i386-linux/5.00401 /usr/lib/perl5
/usr/lib/perl5/site_perl/i386-linux /usr/lib/perl5/site_perl .) at
/usr/lib/perl5/smb2www.pm line 29.

The Base64.pm Mod is in one (all!) of the directories listed (including
 .)

I know there are issues surrounding running scripts that have the SUID
bit set not finding modules. These scripts aren't SUID, but Apache is
running the SUEXEC wrapper, running as 'Nobody' - could this be the
problem? Where do i need to put the Mod? I'm losing my
miiiiiiiiiiiiiiiiiind.

I've RTFM but I've not been able to find anything relevant.

Any help gratefully received.

TIA

John


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

Date: 29 Jun 1998 07:54:51 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: John Robinson <"J.S.Robinson"@soton.ac.uk>
Subject: Re: Scripts run by Apache can't find Mods
Message-Id: <vhpktlk4.fsf@mailhost.panix.com>

John Robinson <"J.S.Robinson"@(ChopThisBit)soton.ac.uk> writes:

> Can't locate MIME/Base64.pm in @INC (@INC contains:
> /usr/lib/perl5/i386-linux/5.00401 /usr/lib/perl5
> /usr/lib/perl5/site_perl/i386-linux /usr/lib/perl5/site_perl .) at
> /usr/lib/perl5/smb2www.pm line 29.
> 
> The Base64.pm Mod is in one (all!) of the directories listed (including
> .)

The file Base64.pm should be in a directory called MIME; that
directory should be in one (and only one) of the directories in @INC.
Hope this helps.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf/


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

Date: Mon, 29 Jun 1998 15:03:05 +0000
From: John Robinson <"J.S.Robinson"@(ChopThisBit)soton.ac.uk>
Subject: Re: Scripts run by Apache can't find Mods
Message-Id: <6n8add$8i8$1@aspen.sucs.soton.ac.uk>

Jonathan Feinberg wrote:
> 
> John Robinson <"J.S.Robinson"@(ChopThisBit)soton.ac.uk> writes:
> 
> > Can't locate MIME/Base64.pm in @INC (@INC contains:
> > /usr/lib/perl5/i386-linux/5.00401 /usr/lib/perl5
> > /usr/lib/perl5/site_perl/i386-linux /usr/lib/perl5/site_perl .) at
> > /usr/lib/perl5/smb2www.pm line 29.
> >
> > The Base64.pm Mod is in one (all!) of the directories listed (including
> > .)
> 
> The file Base64.pm should be in a directory called MIME; that
> directory should be in one (and only one) of the directories in @INC.
> Hope this helps.

Okedokey, Thanks, I put Base64.pm in /usr/ib/perl5/MIME/ and got rid of
all the duplicates, but I'm getting the same error message :-(
Any more ideas? (Bear in mind that all is fine if run from command
line).

TIA 

John


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

Date: Mon, 29 Jun 1998 15:36:11 +0000
From: John Robinson <"J.S.Robinson"@(ChopThisBit)soton.ac.uk>
Subject: Re: Scripts run by Apache can't find Mods
Message-Id: <6n8cbf$8kt$1@aspen.sucs.soton.ac.uk>

> Okedokey, Thanks, I put Base64.pm in /usr/ib/perl5/MIME/ and got rid of
> all the duplicates, but I'm getting the same error message :-(
> Any more ideas? (Bear in mind that all is fine if run from command
> line).


I just upgraded Base64.pm to the latest version and it's done the job -
I don't even pretend to understand anymore. :-O

Thanks for the help

John


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

Date: Sun, 28 Jun 1998 23:03:54 -0700
From: Tungyat Wong <ty.wong@utoronto.ca>
Subject: send email from client browser using perl [HELP!!!]
Message-Id: <35972E4A.98DA8C45@utoronto.ca>

Hi,

I am wondering how can I using Perl to send email to someone. Because
currently I am writing a buy&sell program using Perl. And would like to
implement the reply function, there is a email field in the form, and I
want to use Perl send email with the supplied email address.

Any help would very appreciate.

PS: perfer reply via email  ;)

Thanks


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

Date: Mon, 29 Jun 1998 07:09:28 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: send email from client browser using perl [HELP!!!]
Message-Id: <Pine.GSO.3.96.980629000708.21917L-100000@user2.teleport.com>

On Sun, 28 Jun 1998, Tungyat Wong wrote:

> I am wondering how can I using Perl to send email to someone. 

Haven't been reading this newsgroup much, have you? This has been
discussed quite a bit recently. Some people prefer calling your host's
mail program, others recommend using a module to connect to a mail server. 
If you can't decide which is right for you, use your favorite Usenet
archive to dig up the arguments. Good luck! 

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 29 Jun 1998 07:46:49 GMT
From: "jim babbington" <jwb79@mail.idt.net>
Subject: Re: send email from client browser using perl [HELP!!!]
Message-Id: <01bda331$34b16d50$6488fdc7@dixon>



Tungyat Wong <ty.wong@utoronto.ca> wrote in article
<35972E4A.98DA8C45@utoronto.ca>...
> Hi,
> 
> I am wondering how can I using Perl to send email to someone. Because
> currently I am writing a buy&sell program using Perl. And would like to
> implement the reply function, there is a email field in the form, and I
> want to use Perl send email with the supplied email address.
> 
> Any help would very appreciate.

Download the net/smtp.pm from CPAN (if not already in your @INC)
This little module lets you connect to a SMTP mail server (your's), and
construct messages. It's not very well pod'ed, but you should'nt need much.

Jim

The truth is out there...
The truth hurts....

I'll just stay at home....


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

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

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