[12151] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5751 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat May 22 08:07:37 1999

Date: Sat, 22 May 99 05:00:23 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 22 May 1999     Volume: 8 Number: 5751

Today's topics:
    Re: Accessing Files Thru Network <gellyfish@gellyfish.com>
    Re: can someone help me with locking??? (Bart Lateur)
    Re: clearing output??? <gellyfish@gellyfish.com>
    Re: Concatenate RTF files <gellyfish@gellyfish.com>
    Re: Confusion about subroutines (Bob Trieger)
    Re: Confusion about subroutines <gellyfish@gellyfish.com>
        DBI - why doesn't this select statement work? <Jeremy@Malcolm.wattle.id.au>
    Re: DBI - why doesn't this select statement work? <gellyfish@gellyfish.com>
    Re: Dynamic Loading <gellyfish@gellyfish.com>
    Re: Easy Question <gellyfish@gellyfish.com>
    Re: FAQ 8.1: How do I find out which operating system I <gellyfish@gellyfish.com>
    Re: Finding Diff of two files <gellyfish@gellyfish.com>
    Re: foreach and print, Please help (Bob Trieger)
    Re: Grab string from STDIN <gellyfish@gellyfish.com>
        How to print mailing labels in columns <Jeremy@Malcolm.wattle.id.au>
    Re: How to print mailing labels in columns (Bob Trieger)
    Re: Measuring space on a share <gellyfish@gellyfish.com>
    Re: No answer found in Perlfaq <gellyfish@gellyfish.com>
    Re: Perl "constructors" <gellyfish@gellyfish.com>
    Re: perl email <Jeremy@Malcolm.wattle.id.au>
    Re: Refresh a document in frame <gellyfish@gellyfish.com>
    Re: Sys::Syslog doesn't work in Perl5.005_03 :-( (Ingo Ciechowski)
    Re: Sys::Syslog doesn't work in Perl5.005_03 :-( <gellyfish@gellyfish.com>
    Re: timelocal <gellyfish@gellyfish.com>
    Re: Web page redirect - Not working ?perl problem?  Pls <gellyfish@gellyfish.com>
    Re: Where can we advertise our perl consultancy service <gellyfish@gellyfish.com>
    Re: where from download Oraperl for Windows? <gellyfish@gellyfish.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 22 May 1999 11:38:33 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Accessing Files Thru Network
Message-Id: <7i64vp$1gb$1@gellyfish.btinternet.com>

On 21 May 1999 14:04:12 -0500 Venu Gopal wrote:
> 
> Hi,
> 
> How do i access files in another computer
> connected thru LAN and update it. Do i have
> to use File::Copy module? If so tell me where
> it is available.I'm using Perl under Windows
> 

You should not have to use File::Copy - this is only necesary
for performing copying operations as the name suggests.

If you simply want to open and read a file on another computer then
you will simply use open() assuming that your networking arrangements
allow that.


If you have anything resembling a recent Perl then you already have 
File::Copy installed.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 22 May 1999 10:20:04 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: can someone help me with locking???
Message-Id: <37467ecd.1577940@news.skynet.be>

Dan Sugalski wrote:

>flock doesn't work on VMS, but it's normally not needed. VMS does
>mandatory file locking for you.

What does this mean? Does open() fail if a file is locked (as on some
other systems, like DOS and Mac; at least: if you open the file with
write access), or does it block until it can lock the file?

	Bart.


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

Date: 22 May 1999 10:51:53 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: clearing output???
Message-Id: <7i6289$1f7$1@gellyfish.btinternet.com>

On Sat, 22 May 1999 04:27:09 GMT yfmayes@my-dejanews.com wrote:
> Hi,
> This is a really dumb question.  However, for
> some reason, I can't seem to find an answer in
> any indexes.  All I want to do is when is clear
> the screen in the script.  It would be just like a
> 'clear' in unix or 'cls' in dos.

OK OK you dont need to post it twice - I answered your previous post
already.  But of course the canonical answer is that you should look
at perlfaq8.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 22 May 1999 10:18:09 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Concatenate RTF files
Message-Id: <7i6091$1c2$1@gellyfish.btinternet.com>

On Fri, 21 May 1999 19:55:51 GMT David Beckley wrote:
> The program below works fine as it stands, but when opening the merged
> document, Word recognizes only the first of the merged documents.
> Apparently it encounters an end of document code. So I guess I need to
> grab the guts of each document and keep the document header at the top
> of the file and put a document footer at the end of the merged file.
> Any ideas, please? I'm running on NT 4.0
> 

There is a an RTF parser available from CPAN:

<http://www.perl.com/CPAN/authors/id/PVERD/RTF-Parser-1.06.tar.gz>

This should enable you to disassemble the documents - however I figure
that you are on your own in putting them back together again.

As David has already pointed out I think you are probably better off
using Win32::OLE to automated the process within Word.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 22 May 1999 10:54:48 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Confusion about subroutines
Message-Id: <7i60vl$1p2$1@birch.prod.itd.earthlink.net>

[ courtesy cc sent by mail if address not munged ]
     
"Jody Fedor" <JFedor@datacom-css.com> wrote:
>Before I get hammered....
>    I've done the perldoc -q subroutines and looked this up in "Perl
>Programming".
>
>I just dont get this TYPEGLOB thing.
>
>I'm trying to pass a filename to a subroutine.  It says you're supposed to
>do something like this:
>
>&Template($in{template});
>
>sub Template {
>        local(*FILE);  <-- I would assume here that the variable located in
>$in{template} is passed to the subroutine and is now located in $FILE?? or
>am I way out there?

You are almost way out there.

Check out the documentation on perlsub. Paying special attention to the 
"@_" array. 

perldoc perlsub



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

Date: 22 May 1999 10:49:19 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Confusion about subroutines
Message-Id: <7i623f$1ee$1@gellyfish.btinternet.com>

On Sat, 22 May 1999 00:09:41 -0400 Jody Fedor wrote:
> Before I get hammered....
>     I've done the perldoc -q subroutines and looked this up in "Perl
> Programming".
> 
> I just dont get this TYPEGLOB thing.
> 

You dont need to use a typeglob when passing a simple scalar value to a
subroutine.

> I'm trying to pass a filename to a subroutine.  It says you're supposed to
> do something like this:
> 
> &Template($in{template});
> 
> sub Template {
>         local(*FILE);  <-- I would assume here that the variable located in
> $in{template} is passed to the subroutine and is now located in $FILE?? or
> am I way out there?
> 

Yes this simpy localizes the filehandle FILE (actually more than that but
I wont confuse with the details).  It has nothing to do with the argument
to the subroutine.

What you want to do is insert something like :

  my $filename = shift;

As the first line of your subroutine.

Read the perlsub manpage.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 22 May 1999 18:38:21 +0800
From: "Jeremy Malcolm" <Jeremy@Malcolm.wattle.id.au>
Subject: DBI - why doesn't this select statement work?
Message-Id: <7i61cr$t7a$1@news.iinet.net.au>



Why do I get the error:

  DBD::Pg::st execute failed: ERROR:  parser: parse error at or near
">"

when I try to execute a SQL statement:

  select * from members where expire > '22/05/1999'

which works fine from the PostgreSQL console interface.  Other SQL
statements such as just "select * from members" works fine.  ("expire"
is a date field, and the non-US date format is not the problem.)

I would be very grateful for any responses.  Please cc by email.

- --
JEREMY MALCOLM Jeremy@Malcolm.wattle.id.au http://malcolm.wattle.id.au
SIG of the day: [ ] Contact  [ ] Web  [ ] PGP  [x] Taglines #1  [ ] #2
Reality is for those who can't face science fiction. | Power corrupts;
absolute power is kind of neat. | "It's in Tibetan!" - The Doctor (5G)
"A lawyer is like a river." - Kosh | Life is like a simile | Dynsdale!


Version: PGPfreeware 6.0.2i

iQB1AwUBN0YYnr/mBljD2JABAQEepQL9EcaFmnjvE7rdCtksFhjjeh9juuYQ24Fx
Z/GKHS9e5rb42f2mzVPhY6EFerbzA/aftepBQuYN62MMatgcsQFMo1VYCMRnkdzn
3CeMXNB08jiIyM5QpcCvONzGCW7/56XJ
=CCoM
-----END PGP SIGNATURE-----





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

Date: 22 May 1999 11:50:17 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: DBI - why doesn't this select statement work?
Message-Id: <7i65lp$1lp$1@gellyfish.btinternet.com>

On Sat, 22 May 1999 18:38:21 +0800 Jeremy Malcolm wrote:
> 
> Why do I get the error:
> 
>   DBD::Pg::st execute failed: ERROR:  parser: parse error at or near
> ">"
> 
> when I try to execute a SQL statement:
> 
>   select * from members where expire > '22/05/1999'
> 

If you say that this statement works (and I can see no reason why it
shouldnt) outside Perl then I think that you must be doing something
strange to the text of that query - can you post the code that generates
the statement or the do or prepare or whatever - usually the largest
problem people have with this kind of thing is to do with quoting.

/j\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 22 May 1999 09:23:02 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Dynamic Loading
Message-Id: <7i5t1m$198$1@gellyfish.btinternet.com>

On Wed, 19 May 1999 14:42:04 GMT chenlock99@yahoo.com wrote:
>  I have problem loading DBI module when I tried to run my script. It
> complaint about dynamic loading not available in this perl. I have to
> either to rebuild the new perl or statically link the module to it. I
> have tried rebuilt the perl with dynamic loading but it failed, seems
> like my complier doesn't support.  Any idea how to resolve this ?
> 

What platform are you on ?  The hints files for some systems by default
cause a statically linked Perl to be built although some of thes have been
changed in more recent versions.

If you are on SCO for for instance the 5.00503 release now builds a
dynamically linked Perl (as long as you have a version of SCO unix that
supports that :).

On other systems that have the capability to build a dynamically linked
perl it may be possible to get it to build dynamic by supplying the
correct answers to Configure, however as we dont know what system you
have we cant advise you on that.  If all else fails you can edit the
Config.SH file after having run Configure and then run Configure -S.

/J\

-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 22 May 1999 10:44:50 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Easy Question
Message-Id: <7i61r2$1ds$1@gellyfish.btinternet.com>

On Sat, 22 May 1999 00:33:14 -0400 Jonathan J Mayes wrote:
> Everyone,
>     Hi, new to the perl scene, but look forward to questions from this
> end.  This time, I'm looking for a function that in perl that will work
> like a clear in unix or a cls in dos.  Is there any simple way to do
> this, or am I going to have to print out a blank page?  I'm basically
> just trying to refresh some on screen data, if that helps.
> thanks,

Here is a post I prepared earlier :

Of course my favourite is

#!/usr/bin/perl -w

use strict;

my $SCREEN_ROWS = 25;

print "\n" for ( 0 .. $SCREEN_ROWS );

;-}

Alternatively you might use system to run whatever it is that clears the
screen on your system - if you want to do it more than once you might
run it with the backticks saving the output for printing:


#!/usr/bin/perl -w

use strict;

my $clear = `/usr/bin/tput clear`;

print $clear;

(Is tput available on all Unix-like systems ?)

Alternatively you can use one of the modules that do terminal stuff :

#!/usr/bin/perl

require Term::Screen;

my $terminal = new Term::Screen;

$terminal->clrscr();

Alternatively:

#!/usr/bin/perl

require Term::Cap;
my $terminal = Tgetent Term::Cap { TERM => undef, OSPEED => 9600};
print $terminal->Tputs('cl',1);

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 22 May 1999 09:01:36 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: FAQ 8.1: How do I find out which operating system I'm running under?
Message-Id: <7i5rpg$195$1@gellyfish.btinternet.com>

On Thu, 20 May 1999 20:08:01 -0500 Michael D. Schleif wrote:
> But, please, the OS version or release number?
> 
> I've struggled with this, off and on, due to running in a very
> heterogeneous environment.  Often, I need to decide which system binary
> to call, based on *both* OS and version.
> 

There is no way I know of in Perl but once you know the OS then you
can start to do some OS specific stuff like:


#!/usr/bin/perl -w

use strict;

my $release;

if ( $^O =~ /Linux/i )
  {
   chomp($release = `/usr/bin/uname -r`);
  }

print $release,"\n";  

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 22 May 1999 11:04:41 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Finding Diff of two files
Message-Id: <7i6309$1g0$1@gellyfish.btinternet.com>

On Fri, 21 May 1999 21:27:35 GMT anilpn@my-dejanews.com wrote:
> Hi,
> 
> I have two files in my vars:
> @file & @file2
> 
> How can I find the diff of the two
> files, using perl in a simple way ?
> 

If you actually have your two files in arrays as you show then you 
should read perlfaq4:

       How do I compute the difference of two arrays?  How do I
       compute the intersection of two arrays?

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 22 May 1999 11:14:30 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: foreach and print, Please help
Message-Id: <7i624l$2lh$1@birch.prod.itd.earthlink.net>

[ courtesy cc sent by mail if address not munged ]
     
tvn007@my-dejanews.com wrote:
>Hi,
>
>Would someone please help me to make the print statement shorter ?
>
>I have too many conditions that I have to put | $_ eq ..... | $_ eq
>in the print statement as you can see below.
>
>
>
>
>foreach (@PIN_NAME) {
>
>
>   print "PIN $_ stuck @ $values{$_}\n" unless $values{$_} eq 'unstuck'
>| $_ eq 'I1' | $_ eq 'I2' | $_ eq 'XY' | $_ eq 'AB' | $_ eq 'PX' |
>$_ eq 'PT' | $_ eq 'UU' | $_ eq 'OO' ;
>
>}

unless the list is going to get much longer, the easiest way is to use a 
regex:

foreach (@PIN_NAME)  {
        next if (/^(l1|l2|XY|AB|PX|PT|UU|OO)$/);
        print "PIN $_ stuck @ $values{$_}\n";
}

You may also want to read up on the grep function.
perldoc -f grep


HTH




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

Date: 22 May 1999 09:42:32 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Grab string from STDIN
Message-Id: <7i5u68$19c$1@gellyfish.btinternet.com>

On Fri, 21 May 1999 15:33:12 -0700 Hall, Johnny wrote:
> 
> open(SCAN, "rsh $HOST /soft/support/sunscan/sunscan|") or die "Johnny:
> $!";

Be warned that the open may succeed but the command that is being run
night fail which the test wont indicate.  You should also test the
return of your close:

close(SCAN) || die "rsh failed - $?\n";

> 
> Thanks Again, and if anyone has pointers on how to get .tar.Z appended I
> would be happy to listen. 

$PATCH .= '.tar.Z';

Similarly to put wget in front as well you could do:

$PATCH = "wget http://blah.sun.com/" . $PATCH;

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 22 May 1999 18:34:00 +0800
From: "Jeremy Malcolm" <Jeremy@Malcolm.wattle.id.au>
Subject: How to print mailing labels in columns
Message-Id: <7i614m$so2$1@news.iinet.net.au>



I've been looking for an easy way to print mailing labels in columns.
Formats won't do it, and Array::PrintCols won't do it.  Does anyone
have any suggestions?

Many thanks (please cc replies by email).

- --
JEREMY MALCOLM Jeremy@Malcolm.wattle.id.au http://malcolm.wattle.id.au
SIG of the day: [ ] Contact  [ ] Web  [ ] PGP  [x] Taglines #1  [ ] #2
Reality is for those who can't face science fiction. | Power corrupts;
absolute power is kind of neat. | "It's in Tibetan!" - The Doctor (5G)
"A lawyer is like a river." - Kosh | Life is like a simile | Dynsdale!


Version: PGPfreeware 6.0.2i

iQB1AwUBN0YXmL/mBljD2JABAQHVcwMAr/m3eFXtzAnfmxKmUSBP7QDQrXdA7RDZ
n91+bzwxXcKAl2lYAvRIArPSTr0IJUsGr24n6MbhGSc+8Sj6EDHsmOwKSeZd8j+7
firfpXaSz5pW1twsna4YviUt94/Y7KAS
=PChI
-----END PGP SIGNATURE-----





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

Date: Sat, 22 May 1999 11:31:55 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: How to print mailing labels in columns
Message-Id: <7i6357$2lh$2@birch.prod.itd.earthlink.net>

[ courtesy cc sent by mail if address not munged ]
     
"Jeremy Malcolm" <Jeremy@Malcolm.wattle.id.au> wrote:
>I've been looking for an easy way to print mailing labels in columns.
>Formats won't do it, and Array::PrintCols won't do it.  Does anyone
>have any suggestions?

Why won't format work?

This is the kind of thing "format" is made for.

perldoc -f format 

Or  take a look at the docs for the printf function.

perldoc -f printf

HTH



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

Date: 22 May 1999 10:33:46 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Measuring space on a share
Message-Id: <7i616a$1d2$1@gellyfish.btinternet.com>

In comp.lang.perl.misc Damon Torgerson <a-damont@microsoft.com> wrote:
> Hello all,
> 
> I'd like to measure the free space on a series of shares.  I'm new to Perl
> and I was wondering if anyone has any recommendations for doing this.
> 

You can just use df -k and watch statd eat its way way through your
menagerie - ah, wait - that e-mail address ... you didnt mean NFS shares
did you ?

There may well be some Win32::* module that will enable you to do this
- If you have ActiveState's Perl distribution installed then the
documentation might shed some light but I cant be more specific.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 22 May 1999 11:00:44 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: No answer found in Perlfaq
Message-Id: <7i62os$1fd$1@gellyfish.btinternet.com>

On Sat, 22 May 1999 01:23:55 -0400 Jody Fedor wrote:
> I'm trying to read a whole file into a variable.
> 
> Such as:
> 
> open (FILE,"template.htmt")  || die "Cannot open template file
> template.htmt\n";
>      while (<FILE>){
>               $HTML .=$_;
>      }
> close(FILE);
> 
>  $HTML =~s/\$(\w+)/${$1}/g;
>  return $HTML;
> 
> I get the whole file into $HTML but I don't know how.  When I used $HTML =$_
> I only got
> the last line.  What is the significance of the . before the =?
> 

You are reading in each line of the file and appending them to the variable
$HTML.  The .= operator works much like += or whatever by using the LHS
of the assignment as a (hidden) default operand.

  $HTML .= $_ ;

Is exactly equivalent to:

  $HTML = $HTML . $_;


You can read about it in the perlop manpage.

> Programming Perl says as an operator . is concatenation but why does it
> work?  Can
> anyone explain this?
> 

Er, because that is what it is designed to do ;-?

However you might consider instead of using the concatenation just reading
the whole file straight into the $variable :

  { local $/;  $HTML = <FILE> }

No loop no concatenation just one fell slurp and its there ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 22 May 1999 12:01:47 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl "constructors"
Message-Id: <7i66bb$1mp$1@gellyfish.btinternet.com>

On Sat, 22 May 1999 01:05:54 +0000 Nick Moraitakis wrote:
>> You have gained special status in the kill-files and filters of the
>> majority of the frequent posters to this group meaning that your
>> trolling will not be seen by those people.
>>
>> I do hope that everyone will follow suit.
> 
> What is the point of participating in a public discussion
> when you're not ready to hear out other people speaking
> publically? Whether you like what they say or not is *your*
> problem, not everybody else's. I'm tired of seeing people
> threatening others that they will killfile them, and boast
> about putting someone in their killfile. Shut your ears and
> close your eyes... cry to mommy.. Man, if you can't take
> people speaking themselves in public, then maybe public
> newsgroups are not for you.
> 
> Furthermore if you want to apply filters to what you read,
> nobody stops you from doing so, but why do you feel the need
> to announce it? Why do you think the rest of us care? As if
> it's relevant to the topic of discussion in the newsgroup... 
> 

Prat.

*plonk*

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 22 May 1999 18:50:12 +0800
From: "Jeremy Malcolm" <Jeremy@Malcolm.wattle.id.au>
Subject: Re: perl email
Message-Id: <7i6234$vif$1@news.iinet.net.au>



>how do you send an email from a perl script?
>the script is called from another script and i want send an email to
an
>address which is passed to the script when called.
>i have a readparse subroutine to get the info in the call

Two ways of doing it.  First, just open a pipe to sendmail:

$mailprog = "/usr/bin/sendmail";
$recipient = "email@address.goes.here";
open (MAIL, "|$mailprog $recipient") || die "Can't open $mailprog!\n";
print MAIL "To: $recipient\n";
print MAIL "Subject: Subject goes here\n\n"; # Note two \n's before
body
print MAIL "Body goes here\n";
close (MAIL);

Second, use Mail::Send module:

require Mail::Send;
$recipient = "email@address.goes.here";
$msg = new Mail::Send;
$msg->subject('Subject goes here');
$msg->to($recipient);
$fh = $msg->open;
print $fh "Message body goes here.\n";
$fh->close;

Hope this helps.

- --
JEREMY MALCOLM Jeremy@Malcolm.wattle.id.au http://malcolm.wattle.id.au
SIG of the day: [ ] Contact  [ ] Web  [ ] PGP  [x] Taglines #1  [ ] #2
Reality is for those who can't face science fiction. | Power corrupts;
absolute power is kind of neat. | "It's in Tibetan!" - The Doctor (5G)
"A lawyer is like a river." - Kosh | Life is like a simile | Dynsdale!


Version: PGPfreeware 6.0.2i

iQB1AwUBN0YbZb/mBljD2JABAQFMpQMAr/7f42SaWBGIpxeQPlFH5vB+yEjLu0CB
DhP7VS99KBJ0oC4pFHhcKjkulI6MS6KYFaWs4L/i9H7vWXjBh/G3EAUWFyiQ0GDb
mLkZiNN1oIiCY489NEbC7xSL4Q5uPkAs
=782Z
-----END PGP SIGNATURE-----





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

Date: 22 May 1999 11:30:43 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Refresh a document in frame
Message-Id: <7i64h3$1g7$1@gellyfish.btinternet.com>

On Fri, 21 May 1999 13:59:35 -0700 David Cassell wrote:
> 
> To use an O'Reilly-esque metaphor, it's a mouse in camel's
> clothing.
> 

Hmm, something about the relative sizes makes me giggle but is also
a very good metaphor now that I come to think about ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 22 May 1999 12:28:03 +0200
From: ciechowski@cis-computer.com (Ingo Ciechowski)
Subject: Re: Sys::Syslog doesn't work in Perl5.005_03 :-(
Message-Id: <ciechowski-ya023280002205991228030001@news.nacamar.de>

In article <slrn7kbpp6.cu.juergen@monocerus.demon.co.uk>,
juergen@monocerus.demon.co.uk (Juergen Heinzl) wrote:

> >I've got a problem using the Sys::Syslog package on my linux 2.0.36 system
> >with Perl Perl5.005_03...
> 
> You must run syslogd with -r on Linux, give it a try.


Thanks a lot Juergen, that really solved the problem ;-))

Ingo


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

Date: 22 May 1999 10:22:43 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Sys::Syslog doesn't work in Perl5.005_03 :-(
Message-Id: <7i60hj$1cu$1@gellyfish.btinternet.com>

In comp.lang.perl.misc Ingo Ciechowski <ciechowski@cis-computer.com> wrote:
> Hi folks,
> 
> I've got a problem using the Sys::Syslog package on my linux 2.0.36 system
> with Perl Perl5.005_03...
> 
> 
> Using the following code snippet I unfortunately don't get any output in my
> syslogs and no errors from perl :-(
> 
> 

There was a thread recently on this subject and the code that was found
to work goes something like this :


#!/usr/bin/perl -w
use strict;
use Sys::Syslog qw(openlog syslog setlogsock closelog);
setlogsock('unix');
openlog($0,'','');
syslog('info', 'this is another test');
syslog('mail|warning', 'this is a better test: %d', time);
closelog();

The explicit import of all the functions is because there is some
weirdness with the exporting in Sys::Syslog which I havent had time
to look at.

If you are using a 'loghost' then you will  need to alter the code
appropriately.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 22 May 1999 09:44:09 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: timelocal
Message-Id: <7i5u99$19f$1@gellyfish.btinternet.com>

On Fri, 21 May 1999 14:28:13 -0700 David Cassell wrote:
> 
> There are some really bright people in this ng, but no
> one from the Psychic Friends Hotline.  :-)
>  

Doris takes exception to that remark ;-P

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 22 May 1999 10:03:13 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Web page redirect - Not working ?perl problem?  Plse help!
Message-Id: <7i5vd1$1b7$1@gellyfish.btinternet.com>

On Fri, 21 May 1999 11:15:57 -0700 Kira S. Anastasia wrote:
> Hi All & TIA,
> 
>   I've beaten my head bloody and my eyes bleary trying to
> figure out where I am going wrong here.  I'm sure it is
> probably ignorance on my part somehow, but I have been
> unable to resolve it.
> 
>   What I am *trying* to do:  Take input from an HTML form,
> process the data and generate a new page and THEN go to it
> when the script finishes.  Everything works, but the
> re-direct doesn't.
> 
>   I got the code from:
> http://language.perl.com/newdocs/pod/perlfaq9.html#How_do_I_redirect_to_another_pag
> 
> After everything is done I do the following:
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> #!/usr/bin/perl -w
> # vgb.cgi
> # Tue May 18 10:25:33 PDT 1999
> 
> # Do housekeeping.
> 
> use CGI::Request;
> [ ... ]
>     close VGB;
> # ---- New data now in dataset -----------
> [ ... ]
> # --- End generate new guest book --------
> $url = "http://vikki.oz.net/~kira/kgb.html";
> print "Location: $url\n\n";
> 
> exit;
> }
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> 
> What I get is a page (from netscape view source):
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> Location: http://vikki.oz.net/~kira/kgb.html
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> (yes, that is the entirity of what is returned.)
> 
> I would very much appreciate any thoughts, suggestions or
> pointers to help in resolving this.  
> 
> Sigh, *what* have I missed here?
> 

You are almost certainly printing some other headers after your
Location: (or your page isnt where you think it is :) -  what
output do you get when you run your program at the command line ?

That said it might be wise to use the module CGI.pm (recommended by
9 out of 10 Perl breeders ) which has a redirect() method that will
insulate you from the technicalities - as you mention that you have
read perlfaq9 you will have noticed that it says that it prints
something other than simply a Location: header.

The following is a quick example of a random redirector - the file
urls.txt simply contains a list of URLs:


#!/usr/bin/perl -w

use CGI qw(:standard);

if(open(URLS,'urls.txt') )
{
    while(<URLS>)
     {
       chomp;
       push @urls,$_;
     }		 

    close(URLS);
    my $index = int (rand @urls);
    print redirect($urls[$index]);

}
else
{
   print header('text/plain'),start_html("Error");
   print <<EOERR;

	The world is about to end ....

EOERR
}


/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 22 May 1999 11:19:23 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Where can we advertise our perl consultancy services?
Message-Id: <7i63rr$1g3$1@gellyfish.btinternet.com>

On Fri, 21 May 1999 14:26:41 -0700 Gary Howland wrote:
> Are there any sites (there certainly don't seem to be any newsgroups)
> for hiring oneself out as a Perl consultant?
> 

The Perl Journal site <http://www.tpj.com> had such a facility but it
has recently changed and I didnt notice whether it is still there.

You might also consider checking out your local Perl Mongers group - I
dont know about others but certainly London.pm has people who are in the
position to be hiring people or know of people who are ( its a bit like
the Freemasons I suppose :).

You could also try posting good answers to questions in this group - I get
a fairly large number of e-mails from companies after my services (I dunno
why perhaps they only look at the headers of the posts :)

What you *dont* do is spam this group with advertising even if it is
posing as a response to someones question because I get upset and complain
to your ISP (you know who you are ... ).

Anyhow good luck

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 22 May 1999 10:10:11 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: where from download Oraperl for Windows?
Message-Id: <7i5vq3$1ba$1@gellyfish.btinternet.com>

On Fri, 21 May 1999 11:09:04 GMT CHETAN wrote:
> 
> 
> hello,
> 
> where from can I download Oraperl for Windows 95/NT ?

You can get DBD::Oracle for the ActiveState Perl using PPM (the
Perl Package Manager) that comes with that distribution.  The use
of this utility is documented in the HTML docs that are installed
in your start menu.  Essentially you can do:

C:\>ppm install DBD-Oracle

(assuming you have an internet connection).

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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