[17978] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 138 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 25 03:05:40 2001

Date: Thu, 25 Jan 2001 00:05:16 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <980409916-v10-i138@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 25 Jan 2001     Volume: 10 Number: 138

Today's topics:
    Re: #!C:\perl.exe -t <m_ario@my-deja.com>
    Re: #!C:\perl.exe -t <gracenews@optusnet.com.au>
    Re: Adobe Acrobat Support . . . (Ameen Dausha)
        cache question <cam@home.com>
    Re: cache question <zornnh@musc.edu>
    Re: cache question <johnm@acadiacom.net>
    Re: cache question <chrisw@dynamite.com.au>
        Can some one help with a perl problem using lahey ED4W <gioahmad@bellatlantic.net>
    Re: change tmp dir for file upload in cgi (Martin Vorlaender)
        Confussed on IPC <davecolson@pro-usa.net>
    Re: Confussed on IPC <comdog@panix.com>
        Converting text to html pularis@my-deja.com
        database <mellouet.ronan@wanadoo.fr>
    Re: DOS commands with long directory names <gracenews@optusnet.com.au>
    Re: exec cgi with parameters problem. Can any of you be (David Efflandt)
    Re: FAQ 1.14:   Where can I get a list of Larry Wall wi <nospam@nospam.com>
    Re: FAQ 8.44:   How do I open a file without blocking? <brentdax1_@_earthlink.net>
    Re: FileHandle Question? (Martin Vorlaender)
    Re: FileHandle Question? <us004258@mindspring.com>
    Re: getting HTTP_referer (David Efflandt)
    Re: getting HTTP_referer <m_ario@my-deja.com>
        Help with one line of perl (EROTH001)
    Re: Help with one line of perl <johnm@acadiacom.net>
    Re: Help with one line of perl <m_ario@my-deja.com>
    Re: Help with one line of perl <comdog@panix.com>
        looping and string comparison <us004258@mindspring.com>
    Re: MIF and PERL <comdog@panix.com>
        NET::TELNET  <a246456@fmr.com>
        newbie question on exec command metamp@my-deja.com
    Re: newbie question on exec command <hanja@my-deja.com>
    Re: newbie question on exec command (Damian James)
    Re: perl editors <m_ario@my-deja.com>
        PerlCGI writing to STDIN of another prog speedpk@my-deja.com
    Re: Problem Connecting to Database MSherrill@compuserve.com
    Re: problem with NET::TELNET (2) <nospam@nospam.com>
    Re: Reading form input <sdoraira@vt.edu>
        script help <kompukit@naisp.com>
    Re: sprint replaces spaces with tabs in my text (Wyzelli)
    Re: Still Can't Get MIME Lite To Send Attachment... <nospam@nospam.com>
    Re: Totally strange <comdog@panix.com>
        use of defined, undef on references (DBI::DBD) upuautiii@my-deja.com
        Write me a perl program, please <buck@private.mil>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 25 Jan 2001 01:56:21 GMT
From: Mario <m_ario@my-deja.com>
Subject: Re: #!C:\perl.exe -t
Message-Id: <94o142$b01$1@nnrp1.deja.com>


> >How to setup the -t mode on activeperl?
> >
> >I get an error (can't emulate ...) while using #!
C:\Perl/bin/perl.exe -t
> >

--

> See the perlrun manual page -- remembering that Perl is case
sensitive.

Do you mean 'T' instead of 't'?
"Too late for -T option at C:\Apache etc"


Tomorrow I will wake up earlier ...
--
Mario
diab.litoATusa.net


Sent via Deja.com
http://www.deja.com/


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

Date: Thu, 25 Jan 2001 12:57:24 +1000
From: "Jeffrey Grace" <gracenews@optusnet.com.au>
Subject: Re: #!C:\perl.exe -t
Message-Id: <3a6f9617$0$16388$7f31c96c@news01.syd.optusnet.com.au>

"Mario" <m_ario@my-deja.com> wrote in message
news:94o142$b01$1@nnrp1.deja.com...
>
> Do you mean 'T' instead of 't'?
> "Too late for -T option at C:\Apache etc"
>

I have had a "too late for -T option before, but when I was executing the
script from the command line like so:
perl myscript.pl

This was because perl had already started before it read the shebang line
(with the -T option), and it was too late for the option to take effect.

--
Jeffrey Grace
~~~~~~~~~~~~~~~~~~~~
Queensland, Australia





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

Date: Thu, 25 Jan 2001 03:21:44 GMT
From: ameen @ dausha . net (Ameen Dausha)
Subject: Re: Adobe Acrobat Support . . .
Message-Id: <3a6f9b82.10704540@news>

"Zarathustra" <cublai@earthlink.net> spake from on high claiming:

>
><ameendausha@my-deja.com> wrote in message
>news:94kanu$o3$1@nnrp1.deja.com...
>> I'm looking for a way to access the data in an Adobe Acrobat file
>> (.pdf) at work so I can put a Perl app together to automate the
>> gathering of data. Can anyone point me in the right direction (the
>> direction of a Perl mod. or something that can help)?
>
>Depends on what type of data you are trying to extract.  The PDF module
>extracts metadata about the PDF.
>I ended up using the pdftotext.exe that comes with the Xpdf distribution
>http://www.foolabs.com/xpdf/ and then
>parsing the the text file it creates.

(I have two ways of accessing this newsgroup)

I'm hoping to extract the data stored in a 'filled-out' PDF file. I'll
give your suggestion a good look see. Thanks!


Ben Wilson (a.k.a. Ameen, Last of the Dausha)
____________________________
-"Ever heard of Aristotle . . . Plato . . . Socrates?!"
-"Yes."
-"Morons!"


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

Date: Thu, 25 Jan 2001 04:03:15 GMT
From: "cam" <cam@home.com>
Subject: cache question
Message-Id: <7ANb6.65780$ED.2756641@news1.rdc1.bc.home.com>

Hi:

I would like to be able to execute a script at a specific time, then cache
the results.

For instance:
at 12am, execute script "hello.pl" and put the results in a file on the
server.

Any ideas/resources/links to learn how to do this?

Cam
cam@home.com




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

Date: Thu, 25 Jan 2001 04:50:37 GMT
From: "Nathan Zorn" <zornnh@musc.edu>
Subject: Re: cache question
Message-Id: <xgOb6.187217$iy3.45633929@news1.rdc1.tn.home.com>

In your crontab put
02 4 * * *  /path/to/script/hello.pl > /path/to/cache_file


man crontab for more info.
In article <7ANb6.65780$ED.2756641@news1.rdc1.bc.home.com>, "cam"
<cam@home.com> wrote:

> Hi:
> 
> I would like to be able to execute a script at a specific time, the n
> cache the results.
> 
> For instance: at 12am, execute script "hello.pl" and put the results in
> a file on the server.
> 
> Any ideas/resources/links to learn how to do this?
> 
> Cam cam@home.com
> 
>


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

Date: Wed, 24 Jan 2001 23:16:49 -0600
From: "John Michael" <johnm@acadiacom.net>
Subject: Re: cache question
Message-Id: <3a6fb876@news.acadiacom.net>

Check out:
http://realtimescripts.com/docs/tutorials.htm#Crontab

There is also a free script there called Auto updater that might be of some
use in this situation.
Cya
John Michael


"cam" <cam@home.com> wrote in message
news:7ANb6.65780$ED.2756641@news1.rdc1.bc.home.com...
> Hi:
>
> I would like to be able to execute a script at a specific time, then cache
> the results.
>
> For instance:
> at 12am, execute script "hello.pl" and put the results in a file on the
> server.
>
> Any ideas/resources/links to learn how to do this?
>
> Cam
> cam@home.com
>
>




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

Date: Thu, 25 Jan 2001 16:26:23 +1100
From: "Chris W" <chrisw@dynamite.com.au>
Subject: Re: cache question
Message-Id: <qPOb6.61$d76.2342@news0.optus.net.au>


"Nathan Zorn" <zornnh@musc.edu> wrote in message
news:xgOb6.187217$iy3.45633929@news1.rdc1.tn.home.com...
> In your crontab put
> 02 4 * * *  /path/to/script/hello.pl > /path/to/cache_file
>
>
> man crontab for more info.

Except if you are a victim of Windows...

On NT you should look at the AT command.
On Win 9x and I assume ME you'll need to use the scheduler tool.




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

Date: Thu, 25 Jan 2001 03:35:36 GMT
From: "Gio Ahmad" <gioahmad@bellatlantic.net>
Subject: Can some one help with a perl problem using lahey ED4W
Message-Id: <caNb6.373$xn.169045@typhoon2.ba-dsg.net>

I'm using lahey ED4W and  I think it can do perl but how any one please
e-mail

gioahmad@bellatlantic.net




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

Date: Thu, 25 Jan 2001 03:00:56 +0100
From: martin@radiogaga.harz.de (Martin Vorlaender)
Subject: Re: change tmp dir for file upload in cgi
Message-Id: <3a6f88d8.524144494f47414741@radiogaga.harz.de>

venkatmohan@my-deja.com wrote:
> Is it possible to change the temporary directory where the files are
> uploaded (through the input type file html form item).
>
> By default it uploads to /var/tmp I want to change this directory to
> some other directory.

It uses the first of

/usr/tmp
/var/tmp
/tmp
/temp
/Temporary Items
 .

it can find. To set it, use

  BEGIN { $TempFile::TMPDIRECTORY = '/your/directory' }
  use CGI;

or see the comment at the beginning of CGI.pm to set it system-wide.

cu,
  Martin
--
One OS to rule them all       | Martin Vorlaender  |  VMS & WNT programmer
One OS to find them           | work: mv@pdv-systeme.de
One OS to bring them all      |       http://www.pdv-systeme.de/users/martinv/
And in the Darkness bind them.| home: martin@radiogaga.harz.de


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

Date: Wed, 24 Jan 2001 21:01:45 +0000
From: David Colson <davecolson@pro-usa.net>
Subject: Confussed on IPC
Message-Id: <3A6F42B8.33F6A7DF@pro-usa.net>

Hi,

Can some tell me how write a code segment that will allow me to start a
program
and then be able to commuicate with it, both read and write.
The perl doc on IPC is not very clear to me. I am not a programmer by
trade.
Thanks Dave Colson



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

Date: Thu, 25 Jan 2001 03:04:18 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: Confussed on IPC
Message-Id: <comdog-45B8BF.03041825012001@news.panix.com>

In article <3A6F42B8.33F6A7DF@pro-usa.net>, David Colson 
<davecolson@pro-usa.net> wrote:

> Can some tell me how write a code segment that will allow me to start a
> program
> and then be able to commuicate with it, both read and write.
> The perl doc on IPC is not very clear to me. I am not a programmer by
> trade.

please crosspost rather than posting the same message separately
to several groups.  see my answer in the first group where i saw
this. ;)

-- 
brian d foy <comdog@panix.com>
no longer for hire ;)


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

Date: Thu, 25 Jan 2001 05:48:58 GMT
From: pularis@my-deja.com
Subject: Converting text to html
Message-Id: <94oeo9$lsd$1@nnrp1.deja.com>

Hey,

   I was trying to convert a text file to html file using my limited
perl skills. It seems to work fine, with minor issues. I am using the
<pre> tah and then I use the following to copy the contents of one file
to another.

while(<FILEONE>)
{
chomp;
print FILETWO "$_ \n";
}

Where FILETWO is my html file. Now this works fine but this is what I
need help with -

  If a line begins with certain words ( i.e Server ) I want the line to
be centred ( by including the line between <center> tags ) how can I do
this ?.


 Also I would like to make all numbers bold ( by including em in
<b>,</b> tag.

What regular xpressions should i use to accomplish this task. thx


Sent via Deja.com
http://www.deja.com/


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

Date: Thu, 25 Jan 2001 08:51:08 +0100
From: "mellouet.ronan" <mellouet.ronan@wanadoo.fr>
Subject: database
Message-Id: <94olj9$lh3$1@wanadoo.fr>

Hi,

I've just finished the program Hello word in the book "Introduction to perl"
at O'REILLY.

But, I don't succeed to run the database of the name and password.

the sub program is :

sub init_words {
     while ( defined($filename=glob("*.secret")) ){

        open (WORDLIST, $filename)|| die "couldn't open wordlist: $!";
         if(-M WORDLIST<7.0) {

            while ($name=<WORDLIST>){
              chomp ($name);
              $words=<WORDLIST>;
              chomp ($word);
              $words{$name}=$word;
         }

     } else {
          rename ($filename,"$filename.old") || die "can't rename file: $!";
     }

     close (WORDLIST)||die "could't close wordlist: $!";
    }
}

So the problem is for read the database wordlist : I' don't know wich name I
should give to it. The program doesn't recognize it. I've tried
"wordlist.txt" and "wordlist" but it doesn't work. The database is in the
same directorie of my program Hello.pl.

Can you help me!!

ronan@long-dian.com




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

Date: Thu, 25 Jan 2001 12:42:00 +1000
From: "Jeffrey Grace" <gracenews@optusnet.com.au>
Subject: Re: DOS commands with long directory names
Message-Id: <3a6f927c$0$16404$7f31c96c@news01.syd.optusnet.com.au>

"Chris Stith" <mischief@velma.motion.net> wrote in message
news:t6u6nb4lmv0ke2@corp.supernews.com...
>
> DOS can accept forward slashes in a batch file, too. The following
> should work on your Windows system, or at least it does on my Win2k
> Professional at my desk at work:
>
>        @if exist c:/windows/win.com echo It worked!
>

It didn't work on Windows 98.  You'll find that Microsoft's later efforts
with their command prompt emulators(for want of a better word) in WinNT and
Win2K, are a lot more intelligent about slashes, spaces in names and
basically better POSIX support (try redirecting a file to STDERR under win9x
;-) ).

> Even in the worst of times, there is always someone who's
> never had it better. Even in the best of times, there is
> always someone who's never had it worse.
>
Nice quote btw. Do you have an author/speaker for that one? (off-topic
question, reply by email please)

--
Jeffrey Grace
~~~~~~~~~~~~~~~~~~~~
Queensland, Australia





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

Date: Thu, 25 Jan 2001 02:10:48 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: exec cgi with parameters problem. Can any of you beautiful people help?
Message-Id: <slrn96v2o9.e18.efflandt@efflandt.xnet.com>

On Wed, 24 Jan 2001, Master <webmaster@homecinemachoice.zerospam.com> wrote:
>I have several websites on a dedicated server and they share the
>Ultimate Bulletin Board in one of the domains.
>What I want to do is insert one of the forum pages into a page of one
>of the other domains.
>Obviously I can't #include virtual since the page being included is on
>the same server but in a different domain.
>The only apparent solution is to run a cgi script to display the
>document :
>
>In the source page :
><!--#exec cgi="/cgi-bin/review_comments.pl?page=000067.html" -->

This is not a Perl question or even a CGI question.  You apparently
neglected to read the apache docs about 'mod_include'.  'exec cgi'
inherits the query string of the SSI page.  But the following should work,
assuming that .pl is recogized as CGI on your server, and that
review_comment.pl on the first vhost has the correct full system path to
the local doc on the other vhost you want it to send:

<!--#include virtual="/cgi-bin/review_comments.pl?page=000067.html" -->

Also you might want to look into using the CGI module, which can make life
easier.

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

Date: 25 Jan 2001 04:45:29 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: FAQ 1.14:   Where can I get a list of Larry Wall witticisms?
Message-Id: <94ob19$h9a$4@216.155.32.165>

In article <MSFb6.1267$B9.192880640@news.frii.net>, PerlFAQ Server 
<faq@denver.pm.org> wrote:

 | +
 |   Where can I get a list of Larry Wall witticisms?
 | 
 |     Over a hundred quips by Larry, from postings of his or source code, 
 |     can
 |     be found at http://www.perl.com/CPAN/misc/lwall-quotes.txt.gz .
 | 
 |     Newer examples can be found by perusing Larry's postings:
 | 
 |         http://x1.dejanews.com/dnquery.xp?QRY=*&DBS=2&ST=PS&defaultOp=AND
 |         &LNG=ALL&format=terse&showsort=date&maxhits=100&subjects=&groups=
 |         &authors=larry@*wall.org&fromdate=&todate=


heh just out of curiosity I poked around a bit. 

Thread :Bare Blocks

Larry's comment : "This topic is dead. Don't feed the bears." 

:-j

*eyerolls* 

Do all tech-related people acquire a bizarre sense of humor eventually 
or is that a sub-function of Usenet in general? :)

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Thu, 25 Jan 2001 07:03:30 GMT
From: "Brent Dax" <brentdax1_@_earthlink.net>
Subject: Re: FAQ 8.44:   How do I open a file without blocking?
Message-Id: <6dQb6.7724$KJ3.464712@newsread2.prod.itd.earthlink.net>


Hash: SHA1

"Reto Hersiczky" <fight_against_spam_cut_here_retoh@dplanet.ch> wrote
in message news:Xns902AA9AA1fightagainstspamcuth@195.141.200.222...
>
> Could pls. somebody explain any sense for reading a file without
> blocking besides a real-time application? As far as I can imagine,
> this mode makes no sense in a CGI/modperl-based application. Tell
> me, if I'm wrong. --Reto

What if you're reading a file, and then the file is changed out from
under you?  Example: your Perl CGI script reads in a bunch of HTML
files and combines them to make a page, but in the middle of this you
modify a file, seriously $#!^ing up your CGI script--unless you've
share-locked the file, in which case the program about to write to it
(assuming it requests an exclusive lock) waits until you unlock the
file.


Version: PGPfreeware 6.5.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBOm/PnLJgQ5JqNEGyEQJ+QwCg0v6KWqpcBnVNwfc+kHQqFFNQtFoAoPZx
ckAYgP0wC+/k5L5gBmhhIEhE
=8NZb
-----END PGP SIGNATURE-----





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

Date: Thu, 25 Jan 2001 03:38:41 +0100
From: martin@radiogaga.harz.de (Martin Vorlaender)
Subject: Re: FileHandle Question?
Message-Id: <3a6f91b1.524144494f47414741@radiogaga.harz.de>

knb50@my-deja.com wrote:
> Just have a quick question about FileHandles in Perl.  I am
> quite confused.  I have five file which I need to run the same program
> over.  I was just going to open(FILE, "<$file"), in the for loop  and
> change out $file each time with the new filename, but I only get every
> other file to open up.
>
> ----------------------
> my @array=("*.f1","*.f2","*.f3","*.f4","*.f5);
> for($i=0; $i<5; $i++){
>      $file=$array[$i];
>      open (FILE,"<$file")||die...
>      # do the program stuff here...
>      close(FILE);
> }
> ----------------------
>
> Is this completely illegal?--to use the same FileHandle for different
> files? or am I completely insane at this point?

No and no.

Perl can even assist you in that it closes an open filehandle if you
use it in an open statement. See `perldoc -f close'.

But it won't work with wildcarded file names. Or do you really have
files named *.f1 on your disk?

And a style thingie: The above form of the for loop is only used if
you explicitely need access to the loop variable. Otherwise, iterating
over an array can be done by

  for my $file (@array) {
    #...
  }

cu,
  Martin
--
One OS to rule them all       | Martin Vorlaender  |  VMS & WNT programmer
One OS to find them           | work: mv@pdv-systeme.de
One OS to bring them all      |       http://www.pdv-systeme.de/users/martinv/
And in the Darkness bind them.| home: martin@radiogaga.harz.de


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

Date: Thu, 25 Jan 2001 01:04:27 -0500
From: "Art Heyman" <us004258@mindspring.com>
Subject: Re: FileHandle Question?
Message-Id: <94off6$m6m$1@slb7.atl.mindspring.net>

 One OS to rule them all       | Martin Vorlaender  |  VMS & WNT programmer
 One OS to find them           | work: mv@pdv-systeme.de
 One OS to bring them all      |
http://www.pdv-systeme.de/users/martinv/
 And in the Darkness bind them.| home: martin@radiogaga.harz.de

In the land of Mordor where the shadow lies ??? Yikes !






Martin Vorlaender <martin@radiogaga.harz.de> wrote in message
news:3a6f91b1.524144494f47414741@radiogaga.harz.de...
> knb50@my-deja.com wrote:
> > Just have a quick question about FileHandles in Perl.  I am
> > quite confused.  I have five file which I need to run the same program
> > over.  I was just going to open(FILE, "<$file"), in the for loop  and
> > change out $file each time with the new filename, but I only get every
> > other file to open up.
> >
> > ----------------------
> > my @array=("*.f1","*.f2","*.f3","*.f4","*.f5);
> > for($i=0; $i<5; $i++){
> >      $file=$array[$i];
> >      open (FILE,"<$file")||die...
> >      # do the program stuff here...
> >      close(FILE);
> > }
> > ----------------------
> >
> > Is this completely illegal?--to use the same FileHandle for different
> > files? or am I completely insane at this point?
>
> No and no.
>
> Perl can even assist you in that it closes an open filehandle if you
> use it in an open statement. See `perldoc -f close'.
>
> But it won't work with wildcarded file names. Or do you really have
> files named *.f1 on your disk?
>
> And a style thingie: The above form of the for loop is only used if
> you explicitely need access to the loop variable. Otherwise, iterating
> over an array can be done by
>
>   for my $file (@array) {
>     #...
>   }
>
> cu,
>   Martin
> --
> One OS to rule them all       | Martin Vorlaender  |  VMS & WNT programmer
> One OS to find them           | work: mv@pdv-systeme.de
> One OS to bring them all      |
http://www.pdv-systeme.de/users/martinv/
> And in the Darkness bind them.| home: martin@radiogaga.harz.de




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

Date: Thu, 25 Jan 2001 02:31:13 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: getting HTTP_referer
Message-Id: <slrn96v3uh.e18.efflandt@efflandt.xnet.com>

On Wed, 24 Jan 2001 16:31:42 GMT, Paul Goris <paul@indigoproductions.be> wrote:
>As I'm not an expert, please bear with me if I'm asking for the obvious ;-)
>
>I have a problem getting the HTTP_REFERER data into my script.
>
>I think i should be able to get this with $ENV{HTTP_REFERER} or, to have it
>printed, something like:
>
>print "HTTP_referer is : $ENV{HTTP_REFERER}";
>
>Only this produces no results.

HTTP_REFERER is an 'optional' browser variable that may not exist and is
easily faked.  The only thing this has to do with Perl is that your script
should not trust it for security if it does exist, and should ignore it if
it does not exist.

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

Date: Thu, 25 Jan 2001 05:58:14 GMT
From: Mario <m_ario@my-deja.com>
Subject: Re: getting HTTP_referer
Message-Id: <94of9k$ma7$1@nnrp1.deja.com>


>
> I have a problem getting the HTTP_REFERER data into my script.
>
> I think i should be able to get this with $ENV{HTTP_REFERER} or, to
have it
> printed, something like:
>
> print "HTTP_referer is : $ENV{HTTP_REFERER}";
>
> Only this produces no results.
>

You could start by getting a list of the environment variables
available on the system.

use CGI;
print "Content-type:text/html\n\n";
for (keys(%ENV)) {print "$_: $ENV{$_}<br>";}

---
Mario
diab.lito\@usa.net


Sent via Deja.com
http://www.deja.com/


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

Date: 25 Jan 2001 03:21:34 GMT
From: eroth001@aol.com (EROTH001)
Subject: Help with one line of perl
Message-Id: <20010124222134.13187.00001031@ng-mh1.aol.com>

HEllo,

I am trying to incorporate a new variable into a if-else statement  but I do
not know the proper syntax.  

Currently the line (with surrounding code) reads like this:

sub thank_you
{
  if ($action eq "unsubscribe")
    { $whichaction = "removed from";}
    else { $whichaction = "added to";}
print "Content-type: text/html\n\n";
print <<__END_THANKS__;
<BODY BGCOLOR="#000000" TEXT="#FFFF33" >

etc etc etc.......

I would like to introduce a new variable called $confirmation so that the
if-else statement does something like this:

  if ($action eq "unsubscribe")
    { $whichaction = "removed from" and $confirmation = "youre_removed;}
    else { $whichaction = "added to" and $confirmation = "youre_subscribed;}

Is this the correct syntax for a line like this?  If not, please advise

Thanking you in advance

Eric
eroth001@aol.com


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

Date: Wed, 24 Jan 2001 23:19:26 -0600
From: "John Michael" <johnm@acadiacom.net>
Subject: Re: Help with one line of perl
Message-Id: <3a6fb913@news.acadiacom.net>

 if ($action eq "unsubscribe"){
        $whichaction = "removed from";
        $confirmation = "youre_removed";
}
else {
        $whichaction = "added to";
        $confirmation = "youre_subscribed";
}
Cya
John Michael
http://realtimescripts.com




"EROTH001" <eroth001@aol.com> wrote in message
news:20010124222134.13187.00001031@ng-mh1.aol.com...
> HEllo,
>
> I am trying to incorporate a new variable into a if-else statement  but I
do
> not know the proper syntax.
>
> Currently the line (with surrounding code) reads like this:
>
> sub thank_you
> {
>   if ($action eq "unsubscribe")
>     { $whichaction = "removed from";}
>     else { $whichaction = "added to";}
> print "Content-type: text/html\n\n";
> print <<__END_THANKS__;
> <BODY BGCOLOR="#000000" TEXT="#FFFF33" >
>
> etc etc etc.......
>
> I would like to introduce a new variable called $confirmation so that the
> if-else statement does something like this:
>
>   if ($action eq "unsubscribe")
>     { $whichaction = "removed from" and $confirmation = "youre_removed;}
>     else { $whichaction = "added to" and $confirmation =
"youre_subscribed;}
>
> Is this the correct syntax for a line like this?  If not, please advise
>
> Thanking you in advance
>
> Eric
> eroth001@aol.com




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

Date: Thu, 25 Jan 2001 06:30:31 GMT
From: Mario <m_ario@my-deja.com>
Subject: Re: Help with one line of perl
Message-Id: <94oh67$nm8$1@nnrp1.deja.com>

In article <20010124222134.13187.00001031@ng-mh1.aol.com>,
  eroth001@aol.com (EROTH001) wrote:
> HEllo,
>
> I am trying to incorporate a new variable into a if-else statement
but I do
> not know the proper syntax.
>
> Currently the line (with surrounding code) reads like this:
>
> sub thank_you
> {
>   if ($action eq "unsubscribe")
>     { $whichaction = "removed from";}
>     else { $whichaction = "added to";}
> print "Content-type: text/html\n\n";
> print <<__END_THANKS__;
> <BODY BGCOLOR="#000000" TEXT="#FFFF33" >
>
> etc etc etc.......
>
> I would like to introduce a new variable called $confirmation so that
the
> if-else statement does something like this:
>
>   if ($action eq "unsubscribe")
>     { $whichaction = "removed from" and $confirmation
= "youre_removed;}
>     else { $whichaction = "added to" and $confirmation
= "youre_subscribed;}
>
> Is this the correct syntax for a line like this?  If not, please
advise
>

just use ';' instead of 'and'.

if ($action eq "removed") {
    $wichaction="removed from";
    $confirmation="you were removed";
}

--
Mario
diab.lito;usa.net


Sent via Deja.com
http://www.deja.com/


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

Date: Thu, 25 Jan 2001 03:06:12 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: Help with one line of perl
Message-Id: <comdog-14F7F8.03061225012001@news.panix.com>

In article <20010124222134.13187.00001031@ng-mh1.aol.com>, 
eroth001@aol.com (EROTH001) wrote:

> HEllo,
> 
> I am trying to incorporate a new variable into a if-else statement  but I do
> not know the proper syntax.  

please crosspost rather than posting the same message separately
to several groups.

-- 
brian d foy <comdog@panix.com>
no longer for hire ;)


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

Date: Thu, 25 Jan 2001 00:58:17 -0500
From: "Art Heyman" <us004258@mindspring.com>
Subject: looping and string comparison
Message-Id: <94of3k$5ju$1@slb7.atl.mindspring.net>

  Having read in a text file I  need to compare changing values as I run
down the  "records" - easy enough in Dbase, Delphi , VB - but where is the
"Skip", the "movenext" in Perl  ? Where do I capture one line's variable to
compare to the next line's ?

open (f1, ">textfile");
while ($line =<f1>)
{

etc






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

Date: Thu, 25 Jan 2001 03:01:47 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: MIF and PERL
Message-Id: <comdog-455508.03014725012001@news.panix.com>

In article <94np8o$48m$1@nnrp1.deja.com>, hanja <hanja@my-deja.com> 
wrote:

> This is urgent.  I need to find some scripts that uses MIF files.  Can
> you help?

please crosspost rather than posting the same message separately
to several groups.  see my answer in the group where i saw this
first ;)

-- 
brian d foy <comdog@panix.com>
no longer for hire ;)


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

Date: Tue, 23 Jan 2001 17:32:41 -0500
From: a246456 <a246456@fmr.com>
Subject: NET::TELNET 
Message-Id: <3A6E0689.DAA70DB9@fmr.com>

I am trying to do telnet to a list of servers from a file, if it fails
to connect to server then it has to generate alert saying it cannot
connect to that host and contiue. And also checks for valid username and
password, else it prints saying invalid username/password.. Somehow i am
not able to achieve this. I think i am doing some stupid thing inside
the loop.
Thanks inadvance..

$username ="tng";
$passwd ="c\@tng_98";

open(FH, "host.txt") || die "File host.txt not found\n";

while($host=<FH>){ #process list of servers from a file.
use Net::Telnet ();
chomp($host);
$t = new Net::Telnet (Timeout => 300, Errmode => "return",
                      Prompt => '/[\$%#>] $/');

 if($t->open($host))  #check for telnet connection
 {
   if($t->login(Name => $username,
           Password => $passwd))         #check username & password is
valid
    {
     @lines = $t->cmd("uname -a");
     print @lines;
     print "\n\n";
     @lines = $t->cmd("whoami");
     print @lines;

   else {
     print "Unable to connect $host\n";   #print if it cannot connect to
server.
    }
 else{
 print "Invalid username/password $host\n"; #print if username/password
is incorrect.
       }
      }
}
exit;
close(FH);



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

Date: Thu, 25 Jan 2001 03:01:24 GMT
From: metamp@my-deja.com
Subject: newbie question on exec command
Message-Id: <94o4u0$e2a$1@nnrp1.deja.com>

this script is causing error when called from a browser
but run ok from shell

#!/usr/bin/perl

$a = exec pwd;

print "content-type: text/html\n\n";
print "<html>";
print "$a";
print "</html>";


Sent via Deja.com
http://www.deja.com/


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

Date: Thu, 25 Jan 2001 03:14:57 GMT
From: hanja <hanja@my-deja.com>
Subject: Re: newbie question on exec command
Message-Id: <94o5nc$ere$1@nnrp1.deja.com>

I don't believe a broswer can execute the exec command but I am not
sure.

-hanja


Sent via Deja.com
http://www.deja.com/


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

Date: 25 Jan 2001 03:27:45 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: newbie question on exec command
Message-Id: <slrn96v7ag.1k9.damian@puma.qimr.edu.au>

Thus spake metamp@my-deja.com on Thu, 25 Jan 2001 03:01:24 GMT:
>this script is causing error when called from a browser
>but run ok from shell
>
>#!/usr/bin/perl
>
>$a = exec pwd;
>
>print "content-type: text/html\n\n";
>print "<html>";
>print "$a";
>print "</html>";
>

Did you notice you're not seeing the html stuff that you want to print in
the output when you run it from the command prompt? 

perldoc -f exec

perldoc -q exec 
	How come exec() doesn't return?

perldoc -q system
	Why can't I get the output of a command with system()?

HTH

Cheers,
Damian


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

Date: Thu, 25 Jan 2001 06:09:52 GMT
From: Mario <m_ario@my-deja.com>
Subject: Re: perl editors
Message-Id: <94ofvd$mpd$1@nnrp1.deja.com>


> Out of curiousity, what editor do you use to write your scripts?

Homesite.

--
Mario
diab.litoATusa.net


Sent via Deja.com
http://www.deja.com/


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

Date: Thu, 25 Jan 2001 03:12:38 GMT
From: speedpk@my-deja.com
Subject: PerlCGI writing to STDIN of another prog
Message-Id: <94o5j1$ept$1@nnrp1.deja.com>

Hello,

I'm having difficulties writing to the STDIN of another programm.
(Apache-Web Server (WINNT) with ActiveStatePerl 522)

This is what I'm trying to do: (just opening a File for writing into
STDIN)

    	$pid = open(Writer, "| ./exe/items.exe -t $laenge")||
&error_ausgabe("$filename: $! [1:neu_check]",10,$lang);
	print Writer $daten;
    close (Writer) || warn "WRITER:(close) $!";

The Problem: items.exe does not get $data, but it does know about the
parameter "-t $laenge".

items.exe does not seem to be the problem, because it works fine doing a

# type test.txt | items.exe -t 200

Does anybody have an idea?

Thanks and greetings from Germany

Arne Bippes




Sent via Deja.com
http://www.deja.com/


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

Date: Thu, 25 Jan 2001 07:37:28 GMT
From: MSherrill@compuserve.com
Subject: Re: Problem Connecting to Database
Message-Id: <3a6fd766.21187335@news.compuserve.com>

On Wed, 24 Jan 2001 21:42:35 GMT, "Robin Corcoran"
<robinc@LMGroup.com> wrote:

>my $dbh = DBI->connect('DBI:ODBC:xml')
>                or die "Couldn't connect to database: " . DBI->errstr;

In DBI->connect, "xml" doesn't refer to the base name of your Access
file.  (It doesn't refer to the "xml" part of "xml.mdb".)  It refers
to a data source name (DSN).  That's what the error messages are
complaining about, too.

Define DSNs through the ODBC admin program.  You will probably find it
in Control Panel | Data sources (ODBC), or in Programs | ODBC.
Specify a system DSN.

You might find this example makes more sense.  "IMS" is the DSN for
"Information Management Systems.mdb" here.

my $dsn = "DBI:ODBC:IMS";
my $user = "Admin";
my $password = "";
my $dbh = DBI->connect($dsn, $user, $password,
                    { RaiseError => 1,
                      AutoCommit => 1 });


-- 
Mike Sherrill
Information Management Systems


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

Date: 25 Jan 2001 07:46:31 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: problem with NET::TELNET (2)
Message-Id: <94olkn$q7d$0@216.155.33.13>

In article <3A6E0689.DAA70DB9@fmr.com>, a246456 <a246456@fmr.com> 
wrote:

use cross-posting rather than posting your question twice into separate 
groups. saves on redundancy. 

see my response to you in comp.lang.perl.modules, if you happen to read 
this first.

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Thu, 25 Jan 2001 02:20:10 GMT
From: Sundar <sdoraira@vt.edu>
Subject: Re: Reading form input
Message-Id: <94o2gl$c2a$1@nnrp1.deja.com>


> You still don't say how %input is being populated. Are you using the
CGI
> module? How are you parsing the CGI data?

I didn't, did I? Seems I wasn't parsing the data at all. I forgot to
include my cgi-lib.pl file. Everything works fine now.

>
> Cheers,
> Damian
>

Sundar

--
Sundar Dorai-Raj
Department of Statistics
Virginia Tech
http://www.stat.vt.edu/~sundar/
sdoraira@vt.edu


Sent via Deja.com
http://www.deja.com/


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

Date: Thu, 25 Jan 2001 02:29:54 GMT
From: KompuKit <kompukit@naisp.com>
Subject: script help
Message-Id: <94o32r$cgf$1@nnrp1.deja.com>

 I have a script that sets up hosting space on a server,
providing an editor to users, etc. just like on tripod,
or geocities.
However, the script want to create the new users' directorys
INSIDE the same folder as the main script file itself...making it hard
sometimes...to link back to the main script....for managing features....
or access to the guestbook.cgi...and counter.cgi etc.
The script works...but I need to know HOW to fix a couple of bugs in it.
I'd like the scripts to reside in the cgi-bin...but be able to create
the new users folders...in a members folder OUTSIDE the cgi-bin,but
inside the document root of the server's user. In other words,
I use linux...I have a user account called "kit"...which would be
referenced: http://www.host.com/~kit
path:  /home/kit/public_html

after creating a new user, say:

/home/kit/public_html/newuser

I still want the script to be able to refer back to its cgi files...
and not have the script create new users folder inside, say:
cgi-bin/hostscript/hosting.cgi
can someone help me with this fix...preferably using ICQ?
--
KompuKit
ICQ# 7110071
kit@kompukit.com
http://www.kompukit.com


Sent via Deja.com
http://www.deja.com/


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

Date: Thu, 25 Jan 2001 04:29:35 GMT
From: wyzelli@yahoo.com (Wyzelli)
Subject: Re: sprint replaces spaces with tabs in my text
Message-Id: <Xns903480E16wyzelliyahoocom@203.39.3.131>

nelsonjames@my-deja.com wrote in <94nlvh$11u$1@nnrp1.deja.com>:

>I hope someone knows how to preserve the oringinal
>spaces in this problem.
>
>When I cat my test file into this script, some of the
>multiple spaces become tab(s).  The concept of the
>file inputed is a prefix of up to 16 chars with spaces
>padding out whats left, then a wrapped line of text.
>(The text can be very long.)
>
>#!/usr/bin/perl -w
># mywrap jnelson@medar.com
>
>use Text::Wrap;
>
>while (defined($EACH= <STDIN>)){
>   $VARR=sprintf "%-16.16s", $EACH;
>   $EACH=~ s/................//;
>   $EACH=~ s/\,/\,\ /g;
>   $EACH=~ s/\ \ */\ /g;
>   print wrap("$VARR", "$VARR", "$EACH");
>   printf "%s\n", $VARR ;
>};
>
>I piped the output to "od -c" to verify that
>indeed, tabs were added that were not there
>before.
>

The problem is coming from wrap in Text::Wrap.  I made the following
modifications which seems to solve the problem.

#!/usr/bin/perl -w
# mywrap jnelson@medar.com
use strict;

use Text::Wrap;

while (defined(my $each= <DATA>)){
   my $varr = substr $each,0,16;
   $varr =~ s/ /#&/g;
   $each = substr $each,16;
   $each=~ s/,/, /g;
   $each=~ tr/ / /s;
   my $string = wrap("$varr", "$varr", "$each");
   $string =~ s/#&/ /g;
   $varr =~ s/#&/ /g;
   print $string;
   printf "%s\n", $varr;
};

__END__
000-0000        ENGINEERING ASSISTANCE REQ'D;; THIS IS A LONNNNNNNG LINE WHICH 
SHOULD WRAP  TEST DRAWING #FIELD      0
000-00000000    MFG/ENG/OFFICE EXPENSEDSUP;                              0
000-00000000    PORT ITEMS;;
000-0000X       DUMMYITEM                                                0
000-0001        FLOPPY DISK-DSDD360KB;;                                  6
000-0002        14 7/8 X 11 1412TC GREENBAR                             24
000-0002        WILLAMETTE #141107
000-0003        9 1/2 X 11 9510AJ WHTCONTINUE                            3

Note I also changed the variable names to lower case in accordance with
my preference and perlstyle.  You may want to read up on transliteration
(tr///) and substr.

Also added strict and scoped variables.

HTH

Wyzelli
-- 
#beer v2
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass it 
around');
for(reverse(1..100)){$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n$_$a$s$b\n$t\n";
$_--;$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n\n";}print"$c*hic*";


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

Date: 25 Jan 2001 05:52:26 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: Still Can't Get MIME Lite To Send Attachment...
Message-Id: <94oeuq$bn3$0@216.155.32.165>

In article <3a6ecd59.15849044@nntp.ix.netcom.com>, 
simberg.interglobal@trash.org (Rand Simberg) wrote:

 | >Now sounds like a mime question rather than a perl question, so
 | >it is becoming off topic.
 | 
 | What's the best ng for a mime question?
 | 

probably comp.mail.mime



although my first reaction to this was "mimes? aren't they supposed to, 
you know, not talk?" 

(:

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Thu, 25 Jan 2001 03:02:44 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: Totally strange
Message-Id: <comdog-B0784F.03024425012001@news.panix.com>

In article <3a6f6d6c@news-uk.onetel.net.uk>, "Edd" <edd@texscene.com> 
wrote:

> I am totally lost as to why a  web page created by my PERL code cannot be
> seen by other visitors while I can see it without any problems from my
> computer.

please crosspost rather than posting the same message separately
to several groups.  see my answer in the CGI group, where this
question belongs.

-- 
brian d foy <comdog@panix.com>
no longer for hire ;)


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

Date: Thu, 25 Jan 2001 07:37:18 GMT
From: upuautiii@my-deja.com
Subject: use of defined, undef on references (DBI::DBD)
Message-Id: <94ol3e$qf6$1@nnrp1.deja.com>

I'm using DBI::DBD features...
I'm using fetchrow_hashref in subroutines.
I'd like to 'return' the undefined value if a sql stmt returns no rows.
I'm doing the following, but it's not working.


in MAIN.pl
my $info = getUserInfo($key1);
if (!defined $info)
{
    print "no match";
}


in require1.pl
sub getUserInfo
{
    my $key = shift;
    $dbh = ...;
    $sth = ....;
    $sth->execute();
    my $numRows = $sth->rows();
    return undef if $numRows == 0;

    $row = $sth->fetchrow_hashref();
    return $row
}


I could use 'exists' on any of the expected keys
of the returned hash ref, but I'm curious how I'd make
the above work, using undefs.

thansk in advance.


Sent via Deja.com
http://www.deja.com/


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

Date: Wed, 24 Jan 2001 18:23:51 -0800
From: Buck <buck@private.mil>
Subject: Write me a perl program, please
Message-Id: <e51v6ts2kdh8ol1tchc166ibajudlkvb4a@4ax.com>

I am in need of a perl program that fixes a Y2K bug in my wife's Email
program.  Don't ask, Dude!  She ain't NEVER gonna change.  She's
running a Win98 box and I've tried to fix the Y2K bug in that
application with zero success, so I think the easiest way to handle
this is to intercept what is sent and fix it "on the fly".

I will pay a reasonable fee to anyone who writes a successful program.

Here's the setup:
I run a Linux box that is a firewall/proxy for all internet access.
It uses Postfix as the smtp daemon with AntiVir listening on port 25.
AntiVir dumps all incoming mail into a special directory and then runs
a virus scan on it.  Email that passes the virus scan is passed to
Postfix's sendmail; Postfix either puts it into the correct mailbox on
the Linux machine or connects to a remote site and puts it into that
system.

When she sends a message, AntiVir passes it to Postfix.  Postfix is
set up to divert all mail to port 10025 and expects what it diverted
there to come back in on port 10026.  This is where the correction
needs to be made.  (Postfix is picky; it keeps saying I've corrupted
the mail that goes through this pipe.)

Here is an example of the line in the Email that needs to be fixed:
Date: Sun, 14 Jan 101 19:12:22 GMT

The "101" needs to have 1900 added to it so that it becomes 2001.  Of
course, next year  "102" will need to become 2002.

Caveats:
Since both RECEIVED and SENT mail go through Postfix, only that mail
that is created by this "the things we do for love" program needs to
have the fix applied.  Thus, one must find the fifth (space separated)
field in the string and add 1900 to it, but only when the value there
is less than 999.

Since I won't give up Antivir, you can't use port 25; I have disabled
the Postfix smptd daemon, replacing it with AntiVir.  (When I change
the port that Antivir listens to, Postfix says it contains an illegal
character.)  So the smtp source to perl comes in on 10025 and must be
output to 10026; and it is not a file, it is a data stream.


Here's my work e-address.  If you can't anti-spam it, you can't write
my perl.
charterhouse-at-icnt-dot-net.org

John Knemeyer


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V10 Issue 138
**************************************


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