[15647] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3060 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 16 09:05:24 2000

Date: Tue, 16 May 2000 06:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <958482312-v9-i3060@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 16 May 2000     Volume: 9 Number: 3060

Today's topics:
    Re: #How to parse and strip perl comments? <gellyfish@gellyfish.com>
    Re: About MAcPerl Webserver <gellyfish@gellyfish.com>
        Accurate IP return? <GBloke@actiongames.co.uk>
    Re: Change list another way ? <hans-jan@stack.nl>
    Re: Do YOU use taint-checking? <gellyfish@gellyfish.com>
    Re: File exists <peckert@epicrealm.com>
    Re: How to find distances? smnayeem@my-deja.com
    Re: How to find distances? <red_orc@my-deja.com>
    Re: How to replace "\" , HELP! <webmaster@linkworm.com>
    Re: How to replace "\" , HELP! <webmaster@linkworm.com>
    Re: Java/Perl lingo <gellyfish@gellyfish.com>
        MySQL Iteration <andy@u2me3.com>
    Re: NT ORACLE PERL DBD DBI->connect format <rereidy@indra.com>
    Re: Odd fork() problem (Bart Lateur)
    Re: perl & apache conf <duxbury@kentmere23.freeserve.co.uk>
    Re: perl & apache conf <All@n.due.net>
        Perl and binary files <dlocci@tiscali.it>
    Re: Perl and binary files (Greg McCarroll)
        perl compiler ? <avishaya@checkpoint.com>
    Re: perl compiler ? (Greg McCarroll)
    Re: Perl vs ActivePerl <saddek@arch.chalmers.se>
        redirect to self url as response to post request qchen@snet.net
        redirect to self url as response to post request richard_chen@my-deja.com
    Re: Sending mail from Perl on NT <sigvald.refsum@siemens.no>
        Sorting hash of hash by first then second key <abuse@borpin.co.uk>
        stdout redirect <stefanp@mediaaktiv.de>
    Re: stdout redirect (Bart Lateur)
    Re: stdout redirect <billy@arnis-bsl.com>
    Re: string starts with? <billy@arnis-bsl.com>
    Re: upgrading <gellyfish@gellyfish.com>
    Re: What's this line which Perl added to AUTOEXEC.BAT? (Bart Lateur)
    Re: zen and the art of trolling [OT] <peckert@epicrealm.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 16 May 2000 11:23:12 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: #How to parse and strip perl comments?
Message-Id: <AcaU4.1473$Kc1.204817@news.dircon.co.uk>

On 11 May 2000 17:22:54 GMT, Abigail Wrote:
> On 11 May 2000 08:44:58 GMT, Csaba Raduly <csaba_r@my-deja.com> wrote:
> ++ 
> ++ I doubt Homeros caused too many accidents in his time (then again, he 
> ++ was blind :-)
> 
> 
> And was has blindness to do with causing many accidents?
> 

Thoughtlessly designed working environment.

/J\


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

Date: 15 May 2000 18:29:48 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: About MAcPerl Webserver
Message-Id: <8fpc6c$2o9$1@orpheus.gellyfish.com>

On Sat, 13 May 2000 13:04:44 +0200 Salvo Jr wrote:
> to all: I just need a little help:
> 
> I use the webserver MacPerl 1.0b3.5
> All work fine!
> I just need a little help:
> I have a file .pl that work with Win32::ODBC
> How can I setup it to work under MacPerl webserver?
> 

There is very little chance that any program that uses a Win32::* module
is going to work on a Mac.  You might find that you can use DBI and
once of the DBD::* modules to access your database but I dont know anything
about MacPerl and the databases that are supported there.

/J\

-- 
Here's to alcohol: The source of, and answer to, all of life's problems.
-- 
fortune oscar homer


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

Date: Mon, 15 May 2000 22:39:04 +0100
From: "[TNN]G.Bloke" <GBloke@actiongames.co.uk>
Subject: Accurate IP return?
Message-Id: <8fpqqb$h9h$1@uranium.btinternet.com>

Is there a reliable method to return a users IP address?

I've have tried the $ENV variables remote_host and remote_addr but they both
return the web-server in most cases and not the end-users IP.

Why? Well I'm attempting to prevent multiple votes on a vote-system, agreed
IP and cookies won't stop the determined cheater but still.

P.S. If I have to use another persons (large) chunk of code I will, but I'd
prefer to keep most of it my own work as a learning experience.

--
[TNN]G.Bloke

Clan TNN
http://www.actiongames.co.uk/tnn/
Actiongames.co.uk
http://www.actiongames.co.uk/




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

Date: 16 May 2000 13:03:50 GMT
From: Hans <hans-jan@stack.nl>
Subject: Re: Change list another way ?
Message-Id: <8frgvm$blu$1@news.tue.nl>


I made a mistake or i left out some information.
Subroutine attach_files adds from 0 to 20 files to an email message using
the MIME::Lite module.
To make it work I have to change the msg->attach lines. $tpe_file or
\$tpe_file does not work.

H.

---
use strict;
use MIME::Lite;

sub some_sub{
my $msg = MIME::Lite->new(
        To       =>'hans-jan@stack.nl',
        Subject  =>'Helloooooo, nurse! 3',
        Type    => 'multipart/mixed'
        );     
&attach_files ($msg);
$msg->send; 
}

sub attach_files {
my ($msg_in) = @_;
 .....
$msg_in->attach(
      Type     =>$tpe_file,
      Encoding =>$enc_type,
      Path     =>$file_name);                            
return $msg_in;
}


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

Date: Tue, 16 May 2000 11:11:44 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Do YOU use taint-checking?
Message-Id: <Q1aU4.1472$Kc1.204643@news.dircon.co.uk>

On Mon, 15 May 2000 20:15:48 GMT, webqueen, queen of the web Wrote:
> I avoid system() and `` calls and try to stick to things that are safe,
> yet -T seems to complain about almost everything.
> 

Then perhaps you should read the perlsec manpage again.

It would seem silly to avoid the opportunity that '-T' affords for
preventing your programs from being exploited in unforeseen but horrible
ways.  Any programme that must deal with untrusted ( ie any :) user input
should be run with taint checking enabled.  Of course this should not be
a crutch that will prevent you from taking other security measures ....

/J\


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

Date: Tue, 16 May 2000 12:17:56 GMT
From: Paul Eckert <peckert@epicrealm.com>
Subject: Re: File exists
Message-Id: <39213B5B.9E569792@epicrealm.com>

Dear Shoaib:
   You didn't mention whether or not the first 2 characters were unique.
   I'll assume they are.
   Here's a possible way to accomplish it using file globbing:

#!/usr/local/bin/perl -w
my $first_two = "aa";
@allfiles = (<$first_two*>);
if ($#allfiles+1) {
   # found it
   print "Found the file: $allfiles[0]\n";
} else {
   # didn't find it
   print "Didn't find the file.\n";
}

shoaibq@my-deja.com wrote:
> 
> I have a file in a directory and what i am trying to do is check for
> it's existence. I know the -e operator works but the thing is that the
> filename that i will search for will change from time to time. Only the
> first two letters of the filename will remain the same. i tried:
> 
> $fname = "aa" . "\*\.\*";
> if (-e "$fname") {
> printf(STDOUT "File exists");
> }
> else {
> printf(STDOUT "Not found");
> }
> 
> Any suggestions?
> 
> Thx. in advance
> 
> Shoaib
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.

-- 
Paul Eckert
Sr. Software Engineer
Epicrealm Inc.
1651 N. Glenville Dr., Suite 212
Richardson, TX 75081
(972) 479-0135 x300
peckert@epicrealm.com


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

Date: Tue, 16 May 2000 10:13:46 GMT
From: smnayeem@my-deja.com
Subject: Re: How to find distances?
Message-Id: <8fr70f$m53$1@nnrp1.deja.com>

In article <WROT4.1279$Kc1.184697@news.dircon.co.uk>,
  Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> On Mon, 15 May 2000 07:15:56 GMT, smnayeem@my-deja.com Wrote:
> > I need a module in perl so that I can find the distance between two
> > different places. Does anyone know of any module or know where I can
> > find one??
>
> You might have a look at
>
>       <http://www.perl.com/reference/query.cgi?geographical>
>
> To get the latitude and longitude.  Then the rest is simple
trigonometry.

Thanks for the link J. However it only allows locations within USA to
be matched, it fetches the data from the census gov something. I was
lookin for something that would allow me to look up distances all over
the world from ANY cities to any other cities.

N.

>
> /J\
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 16 May 2000 12:28:22 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: How to find distances?
Message-Id: <8fresl$ung$1@nnrp1.deja.com>

In article <8fr70f$m53$1@nnrp1.deja.com>,
  smnayeem@my-deja.com wrote:
> In article <WROT4.1279$Kc1.184697@news.dircon.co.uk>,
>   Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> > On Mon, 15 May 2000 07:15:56 GMT, smnayeem@my-deja.com Wrote:
> > > I need a module in perl so that I can find the distance between
two
> > > different places. Does anyone know of any module or know where I
can
> > > find one??
> >
> > You might have a look at
> >
> >       <http://www.perl.com/reference/query.cgi?geographical>
> >
> > To get the latitude and longitude.  Then the rest is simple
> trigonometry.
>
> Thanks for the link J. However it only allows locations within USA to
> be matched, it fetches the data from the census gov something. I was
> lookin for something that would allow me to look up distances all over
> the world from ANY cities to any other cities.
>

'course, you have to know the longitude/latitude, but it's still just
spherical trig.  try any search engine with the search string "great
circle distances":

http://www.ips.gov.au/papers/richard/great_circle.html

generally, given the long/lat of two points, the great circle distance
from one to the other is defined by:

gcd = R * arccos (cos(lat1)*cos(long1)*cos(lat2)*cos(long2) +
                  cos(lat1)*sin(long1)*cos(lat2)*sin(long2) +
                  sin(lat1)*sin(lat2)),
                  where R is the radius of the earth (3444 nm)



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 16 May 2000 03:18:25 -0700
From: "LinkWorm Software, Inc." <webmaster@linkworm.com>
Subject: Re: How to replace "\" , HELP!
Message-Id: <39212071.D3098660@linkworm.com>

Jeff Zucker wrote:
> 
> "LinkWorm Software, Inc." wrote:
> >
> > When you upload a file via a CGI script, it only uploads the file, not
> > the path.
> 
> Wrong, the path is sent along with the file.

Okay, I have no idea how this user coded his program, but the path of
the file being uploaded shouldn't be an issue and he shouldn't need to
filter out "\" (back slashes).

> > The path on their local machine has no impact or relevance on
> > the remote web server.
> 
> True, unless one wants to capture the original filename separated from
> the original path.

Well, by your above comment, it does have some relevance. If it sends
the full path, than it's relevant, right? Of course it's relevant if he
wants to capture the full path, but I didn't think that was his
intention. I guess I missed the important posts in this thread.
 
> > Further, the file name won't contain a back
> > slashes anyway, Windows won't allow it.
> 
> Say what???????

Okay, let me make this clear, you can't name a file
"afile\name.whatevwer". Windows won't allow you to have a "\" in the
file _name_.
 
> >I fail to understand your
> > dilemma...
> 
> I think I've already answered the OP's question in another posting on
> this thread, but the dilemma is this:  if I upload c:\foo\bar.txt from
> windoze to nix and I want to save the file with the same name in
> /usr/uploads, how do I find out that the original file was named
> "bar.txt".

The original file "name", or the file on the remote user's system to
know what the path of the file is being uploaded, so it can find it on
the remote user's system? See, that's what I assumed the user meant, as
in he thought the latter, which is obviously not the case. Again, I
suppose I missed the relevant posts in this thread. I thought he just
wanted to strip out all occurrences of the back slash (\) to create a
result that will be the uploaded file's "name", which wouldn't be
correct -- which accounts for my response. Hopefully I didn't confuse
this problem for anyone. I hate trying to guess what someone means,
which is why I usually don't. I think I see what you mean now, he just
wanted to know the original file name that it was called on the user's
local system, am I correct?

> The answer is:  either I do a regex splitting off everything
> up to and including the last backslash, or I use File::Basename.

Hmm, okay... Well, that was definitely not what I thought his problem
was when I responded. :-)
-- 
Regards,
Tim Greer: tech@linkworm.com | LinkWorm Software http://www.linkworm.com
Tel: 530 247-1749. Programming, CGI, Perl, C/C++, ASP, SQL, more. Design
Web Server & Network Administration, Security, Consulting, Installations
Configuration. Unix/Linux/FreeBSD & NT. Apache, IIS, TCP/IP, LAN/WAN/WWW


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

Date: Tue, 16 May 2000 03:19:34 -0700
From: "LinkWorm Software, Inc." <webmaster@linkworm.com>
Subject: Re: How to replace "\" , HELP!
Message-Id: <392120B5.DFAB2E58@linkworm.com>

workshop wrote:
> 
> just do this
> $string =~ s/\\/\,/;

<SNIP>

By viewing his post, I believe he said he tried exactly that.
-- 
Regards,
Tim Greer: tech@linkworm.com | LinkWorm Software http://www.linkworm.com
Tel: 530 247-1749. Programming, CGI, Perl, C/C++, ASP, SQL, more. Design
Web Server & Network Administration, Security, Consulting, Installations
Configuration. Unix/Linux/FreeBSD & NT. Apache, IIS, TCP/IP, LAN/WAN/WWW


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

Date: Tue, 16 May 2000 11:42:53 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Java/Perl lingo
Message-Id: <1vaU4.1474$Kc1.204817@news.dircon.co.uk>

On Tue, 16 May 2000 09:34:06 GMT, stbruno@my-deja.com Wrote:
> Does anyone know if this is still available as part of Perl5.6 and if there's
> any documentation?

Yes. Yes.  Look in the jpl/ directory.


/J\


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

Date: Mon, 15 May 2000 21:09:09 +0100
From: "Andy Chantrill" <andy@u2me3.com>
Subject: MySQL Iteration
Message-Id: <8fplkp$3hd$1@uranium.btinternet.com>

Hey,

I need to iterate through the records in an entity within one of my MySQL
databases ...

The pseudo code that I would have thought was best for this kind of
operation would be the following:

--
1. Get the total number of records (x),
2. Load chunks of (y) primary keys into array,
3. Iterate through array, pulling in data from database, using primary key,
4. Do operation on selected data,
5. End when total number of records (x) is reached.
--

Of course, the efficiency of using this method would be the value of (y), in
step 2 (the number of records in the entity is too great to simply load them
all into memory at once).

Anyone have any tips / suggestions / comments on this?


Thanks, Andy.
andy@u2me3.com





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

Date: Tue, 16 May 2000 05:35:03 -0600
From: Ron Reidy <rereidy@indra.com>
Subject: Re: NT ORACLE PERL DBD DBI->connect format
Message-Id: <39213267.8A2400A0@indra.com>

Jonathan Stowe wrote:
> 
> On Fri, 12 May 2000 21:58:35 GMT mozarty@my-deja.com wrote:
> > Hi,
> >
> > I installed Perl 5.6.0 and DBI on my NT 4.0 Sevice pack 5
> > With DBD::ODBC it works fine with ORACLE 8i 8.1.5 databse
> > Then I installed DBD::Oracle and I have problem trying to connect
> > database
> >
> > I tried two formats:
> >
> > my $dbh = DBI->connect('DBI:Oracle:host=$dbserver ,sid=$dbname', $user,
> > $pass, 'Oracle');
> > and
> > $dbh = DBI->connect
> > ('dbi:Oracle:G21DEV', 'USERNAME', 'PASSWORD', 'Oracle')
> >
> > I have error message:
> > Database connection not made: ORA-00000: normal, successful completion
> > (DBD: log
> > in failed, check ORACLE_HOME/bin is on your PATH) at test5.pl line 36.
> >
> > On my NT ORACLE_HOME\bin is on PATH
> >
> 
> I have a feeling that Oracle 8i is not the same as the mainstream Oracle
> database in some respects - you will almost certainly want to ask in
> comp.databases.oracle to find out more.
> 
> /J\
> --
> Lisa, stop that racket! I'm trying to fix your mother's camera. Easy,
> easy....I think I'll need a bigger drill.
> --
> fortune oscar homer

According to perldoc DBI, both your ways are incorrect.  The 3rd
argument (optional) should be a hash ref:

  $dbh = DBI->connect("dbi:Oracle:SID", $uid, $pass, {RasieError => 1,
PrintError => 0, AuotCommit => 0}) || die $DBI::errstr;
-- 

Ron Reidy
Oracle DBA
Reidy Consulting, L.L.C.


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

Date: Tue, 16 May 2000 11:04:30 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Odd fork() problem
Message-Id: <392529a6.5869065@news.skynet.be>

Scott Gifford wrote:

>I'm trying to speed up a process by reading in chunks of input,
>forking off a process to process each chunk and write the result into
>a temp file, then joining all of these files together at the end.

>The slow part is processing the file chunks, so this speeds things up
>noticably.

If you'e saying that the CPU is the bottleneck: I'd think not. Not
unless you divide your program over several computers.

You want more cake? Cut it into 24 parts instead of in 6. Now everybody
gets 4 slices of cake!

-- 
	Bart.


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

Date: Tue, 16 May 2000 11:46:51 +0100
From: "Ian" <duxbury@kentmere23.freeserve.co.uk>
Subject: Re: perl & apache conf
Message-Id: <8fr8tk$clh$1@news6.svr.pol.co.uk>

I have changed the shebang line as you suggested, I'm using Win98 so I have
changed it as below. The error log is still reading:-

[Tue May 16 11:42:29 2000] [error] [client 127.0.0.1] (2)No such file or
directory: couldn't spawn child process: c:/program files/apache
group/apache/cgi-bin/p20_5.pl


#!c:\progra~1\apache~1\apache\cgi-bin\p20_5.pl

use CGI;
$wp=new CGI;
# fetch user name entered in form
$user_name =$wp->param ('user');
print $wp->header;
print $wp->start_html (
        -title=>'A CGI script to interact with the user',
        -bgcolor=>'white');
#send message back to user
print "<body>\n";
print "Hello, $user_name,\n";
print "welcome to my web page\n";
print "THIS IS A MESSAGE SENT TO $user_name BY THE WEB SERVER\n";
print "</body>\n";

print $wp->end_html;


Michael Holzer <michael.holzer@attglobal.net> wrote in message
news:39206647_4@news3.prserv.net...
> |
> |#!p20_5.pl
> |
> That's your problem, after the shebang '#!' you're supposed to give the
> path of a program that may interpret the following code. Under unix
> this will propably be something like '#!/usr/bin/perl', under NT something
> like '#!c:\perl\bin\perl.exe'.
>
> hope this helps
>
> Michael
>
>




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

Date: Tue, 16 May 2000 12:15:11 GMT
From: "Allan M. Due" <All@n.due.net>
Subject: Re: perl & apache conf
Message-Id: <jZaU4.86223$hT2.363012@news1.rdc1.ct.home.com>

"Ian" <duxbury@kentmere23.freeserve.co.uk> wrote in message
news:8fr8tk$clh$1@news6.svr.pol.co.uk...
: I have changed the shebang line as you suggested, I'm using Win98 so I have
: changed it as below. The error log is still reading:-
:
: [Tue May 16 11:42:29 2000] [error] [client 127.0.0.1] (2)No such file or
: directory: couldn't spawn child process: c:/program files/apache
: group/apache/cgi-bin/p20_5.pl
:
: #!c:\progra~1\apache~1\apache\cgi-bin\p20_5.pl

No, not the path to your script; the path to perl.exe.  Something like:

#!c:\perl\bin\perl

as was suggested.

HTH

AmD
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--Random Quote--
A computer lets you make more mistakes faster than any invention in human
history - with the possible exceptions of handguns and tequila.
  Mitch Ratliffe




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

Date: Tue, 16 May 2000 12:32:43 +0200
From: "Davide Locci" <dlocci@tiscali.it>
Subject: Perl and binary files
Message-Id: <8fr83i$f8c$1@pegasus.tiscalinet.it>

Hi all,

I would like to know why Perl for WIN32S doesn't allow to copy a binary file
using the following script?

 open (INPUT, "anag.dat");
 open (OUTPUT, ">anag.tmp");
 while (<INPUT>) {
      print OUTPUT;
 }
 close (OUTPUT);
 close (INPUT);


I need to use this script because i have to pars the byinary string in the
file.
How can i solve this problem?

Thanks Davide


--

-------------
Davide Locci
Tiscali SpA
VOLTrade System Administrator





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

Date: 16 May 2000 10:39:43 GMT
From: gem@news.cis.dfn.de (Greg McCarroll)
Subject: Re: Perl and binary files
Message-Id: <slrn8i29ct.1s8.gem@mccarroll.demon.co.uk>

On Tue, 16 May 2000 12:32:43 +0200, Davide Locci <dlocci@tiscali.it> wrote:
> Hi all,
> 
> I would like to know why Perl for WIN32S doesn't allow to copy a binary file
> using the following script?
> 

perldoc -f binmode


-- 
Greg McCarroll                        http://www.mccarroll.uklinux.net
       perl hacker | book collector | wannabee mailing list kook
   yapc::Europe - September 22-24, London - http://yapc.org/Europe/


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

Date: Tue, 16 May 2000 13:08:26 +0200
From: avishay ashkenazi <avishaya@checkpoint.com>
Subject: perl compiler ?
Message-Id: <39212C2A.C1059066@checkpoint.com>

Does anyone knows where can I get a free stable PERL compiler and it's
man pages ?




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

Date: 16 May 2000 10:39:11 GMT
From: gem@news.cis.dfn.de (Greg McCarroll)
Subject: Re: perl compiler ?
Message-Id: <slrn8i29br.1s8.gem@mccarroll.demon.co.uk>

On Tue, 16 May 2000 13:08:26 +0200, avishay ashkenazi <avishaya@checkpoint.com> wrote:
> Does anyone knows where can I get a free stable PERL compiler and it's
> man pages ?
> 

   perldoc -q compile
or perldoc perlfaq3

hth

-- 
Greg McCarroll                        http://www.mccarroll.uklinux.net
       perl hacker | book collector | wannabee mailing list kook
   yapc::Europe - September 22-24, London - http://yapc.org/Europe/


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

Date: Tue, 16 May 2000 12:07:41 +0200
From: Saddek Rehal <saddek@arch.chalmers.se>
Subject: Re: Perl vs ActivePerl
Message-Id: <39211DED.4AD32B38@arch.chalmers.se>



Saddek Rehal wrote:

> Can someone tell me the difference between Perl 5. 03 and perl 5.6.
>
> A part of my script look like this, and works very well under perl 5.003
> but not Perl 5.6
>
> #!/apache/Perl/bin/perl.exe      #this line is used for perl 5.003
> #!/apache/ActivePerl/bin/perl.exe     #this line is used for perl 5.6
> #---------------
> $dateprg = "/apache/ActivePerl/bin/date1.exe";
> $hdateprg = "/apache/ActivePerl/bin/hdate.exe";
>
> require "cgi-lib.pl";
> &ReadParse;
> print &PrintHeader;
>
> $hdateout= `$hdateprg`;
> $dateout = `$dateprg +"%B %e, %Y"`;
>
> print "$hdateout";
> print "$dateout ";
> #------------------------------
>
> The problem is that I get only the second print statement that
> "$dateout" , when I run perl 5.6
> The 2 versions of Perl are of course in different directories.
>
> I am running the script from Win NT and Apache in Netscape.
>
>

I discovered now that if I put my program hdate.exe at the root directory
and change the line $hdateprg = "/apache/ActivePerl/bin/hdate.exe"; to
$hdateprg = "/hdate.exe";    than my script works correctly, Why???

> regards
>
> Saddek Rehal

--
Saddek Rehal
Chalmers tekniska högskola,
Arkitektur, Byggnadskonst
412 96 Göteborg
Tel: 031-772 24 75




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

Date: Tue, 16 May 2000 11:23:38 GMT
From: qchen@snet.net
Subject: redirect to self url as response to post request
Message-Id: <_caU4.799$oA.75237@typhoon.snet.net>

Problem Description:
	Redirect to self url as a response to post reqest does not work.

Demo cgi script:

#!/usr/bin/perl -wl
use CGI qw(:all);
if ( param() ) {
        open(FH,">>/tmp/foo") or die $!;
        print FH param('foo')."|".time."\n";
        close FH;
        print redirect(url);
#       print header(-Refresh=>'0; URL='.url);
} else {
        my(@line);
        if (-e "/tmp/foo") {
                open(FH,"</tmp/foo") or die $!;
                        @line=<FH>;
                        close FH;
        }
        print header,start_html,start_form,
                textfield(-name=>'foo'),
                submit,reset,end_form,"\n",join("<br>",@line),end_html;
}

The problem is that after the redirection, the browser does
not show updated page but a blank one. However, if instead,
one uses the commented out line, everything is fine.

I am using Apache 1.3.6 and both IE and Netscape browsers.

Anyone know what caused this problem?

Thanks for any info.

Richard


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

Date: Tue, 16 May 2000 11:36:07 GMT
From: richard_chen@my-deja.com
Subject: redirect to self url as response to post request
Message-Id: <8frbr6$rg7$1@nnrp1.deja.com>

Problem Description:
     Redirect to self url as a response to post request does not work.

Demo cgi script:

#!/usr/bin/perl -w
use CGI qw(:all);
if ( param() ) {
        open(FH,">>/tmp/foo") or die $!;
        print FH param('foo')."|".time."\n";
        close FH;
        print redirect(url); # this leads to blank page
#       print header(-Refresh=>'0; URL='.url); # this works fine
} else {
        my(@line);
        if (-e "/tmp/foo") {
                open(FH,"</tmp/foo") or die $!;
                @line=<FH>;
                close FH;
        }
        print header,start_html,start_form,
                textfield(-name=>'foo'),
                submit,reset,end_form,"\n",join("<br>",@line),end_html;
}

The problem is that after the redirection, the browser does
not show updated page but a blank one. However, if instead,
one uses the commented out line, everything is fine.

I am using Apache 1.3.6 and both IE and Netscape browsers.
Anyone know what caused this problem? Is it due to CGI?,
or http?, or Apache? or browser?

Thanks for any info.

Richard


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 16 May 2000 12:12:35 +0200
From: Sigvald Refsum <sigvald.refsum@siemens.no>
To: old_flyer@my-deja.com
Subject: Re: Sending mail from Perl on NT
Message-Id: <39211F13.97143F72@siemens.no>



old_flyer@my-deja.com wrote:

> Ok. I am familiar with calling system commands in UNIX, but I also have
> Active Perl on my NT machine. I want to use MS Outlook to mail out from
> a list of e-mail addresses.  I have done this easily in Perl, but
> anyone have any experience calling Outlook from the command line?  Can
> it be done, or do I need to get another mail client?
>

I have an outlook script which works with attachments. I have
included all the options I have got to work.

The script is far from perfect and is only ment to demonstrate
functionallity, any syntaxt can be wrong.

Hope this helps

    Sigvald Refsum

Script for Outlook follows:
############################

use Win32::OLE qw(in with);

my $OutLook = Win32::OLE->new('Outlook.Application.8')
   or die "Couldn't connect to Outlook";

my $NewMail;
# Create Mail object
$NewMail = $OutLook->CreateItem(0);

# Address Mail Object, can be repeated for several recipients
$NewMail->Recipients->Add('sigvald');

# CC Address Mail Object, can be repeated for several recipients
$NewMail->Recipients->Add('sigvald');
$NewMail->Recipients->Item('sigvald')->{Type} = 2;

# Resolve addresses
$NewMail->Recipients->ResolveAll();

# Categories string
$NewMail->{Categories} ="PVCS operation";

# Voting option string
$NewMail->{VotingOptions} ="Pizza;Salat;China";

# Originator Delivery Report Requested
$NewMail->{OriginatorDeliveryReportRequested} = 1;

# Subject string
$NewMail->{Subject} ="hei";

# Body
$NewMail->{Body} = "kåre heisan\n";

#Attachments
$NewMail->Attachments->Add('H:\C_wrk\parser\outlookSend.pl');

# Print
# $NewMail->PrintOut();

# Reminder
my $hour   = (16 * 3600)*(1/86400);
my $minute = (20 * 60)*(1/86400);

$NewMail->{FlagDueBy} = 36538+$hour+$minute;
$NewMail->{FlagRequest} = 'Review Tue 13.01.00 16:20';


# Away it goes
$NewMail->Send;

# Quit
$OutLook->Close();






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

Date: Tue, 16 May 2000 11:39:51 +0100
From: Brian Orpin <abuse@borpin.co.uk>
Subject: Sorting hash of hash by first then second key
Message-Id: <k082iscofpf50df58s7v1sqepbv2vvfql8@4ax.com>

I have a hash

$hash{key1}{key2} = val

I want to sort it on the first key and then on the second key. So that on
key value of;

3 - 2
3 - 1
1 - 2
4 - 2

would sort to
1 - 2
3 - 1
3 - 2
4 - 2

I have tried various combinations of sort with zero success.  I did
manage to get the second key sorted but I seem to have lost that now:-((

Help please.

-- 
Brian Orpin  **Reply to address is valid***
Selfbuilding and It'll be finished one day.
http://www.borpin.co.uk/  *I have exorcised the Demon*


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

Date: Tue, 16 May 2000 12:27:32 +0200
From: Stefan <stefanp@mediaaktiv.de>
Subject: stdout redirect
Message-Id: <39212294.E4505FEF@mediaaktiv.de>

Hi there,

i am looking for a forgotten function :

i want that the print function writes into the opened file...

if (!open (TEST, ">test.scn")) {
           print "test.scn could not be opened<BR>exiting...";
        exit(1001);
}

<missing function> ## was it stdout(TEST)... i dont know anymore here i
can set the default stdout to any filehandle but how ?

print "blablabl";   ## this should write into the file but NOT with---
print TEST "blablabl";  ----- only print "blabla";


thanx,
stefan







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

Date: Tue, 16 May 2000 11:04:33 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: stdout redirect
Message-Id: <392328f3.5689131@news.skynet.be>

Stefan wrote:

>if (!open (TEST, ">test.scn")) {
>           print "test.scn could not be opened<BR>exiting...";
>        exit(1001);
>}

That is pretty verbose.

><missing function> ## was it stdout(TEST)... i dont know anymore here i
>can set the default stdout to any filehandle but how ?

Er... something like:

	open STDOUT, ">test.scn";
or
	open STDOUT, ">&TEST";

or a simple

	select TEST;

might do.

-- 
	Bart.


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

Date: Tue, 16 May 2000 11:17:20 GMT
From: Ilja <billy@arnis-bsl.com>
Subject: Re: stdout redirect
Message-Id: <8franl$q9e$1@nnrp1.deja.com>

In article <39212294.E4505FEF@mediaaktiv.de>,
  Stefan <stefanp@mediaaktiv.de> wrote:
> Hi there,
>
> i am looking for a forgotten function :
>
> i want that the print function writes into the opened file...
>
> if (!open (TEST, ">test.scn")) {
>            print "test.scn could not be opened<BR>exiting...";
>         exit(1001);
> }
>
> <missing function> ## was it stdout(TEST)... i dont know anymore here i
> can set the default stdout to any filehandle but how ?
>
> print "blablabl";   ## this should write into the file but NOT with---
> print TEST "blablabl";  ----- only print "blabla";
>

perldoc -f select

#!/usr/bin/perl -w

use strict;

open TEST, '>test.scn' or die "test.scn could not be opened: $!\n";

print "this should go to STDOUT\n";

my $old_fh = select TEST;
print "and this to TEST\n";

select $old_fh;
print "and now to STDOUT again\n";

Good luck.

Ilja.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 16 May 2000 10:12:49 GMT
From: Ilja <billy@arnis-bsl.com>
Subject: Re: string starts with?
Message-Id: <8fr6uo$m4r$1@nnrp1.deja.com>

In article <3921164C.6313@modulus.com.au>,
  phill@modulus.com.au wrote:
> Henjo wrote:
> >
> > How can I check if a string starts with another string?
> > For example:
> >
> > I want to check if the string "iamareallycoolstring" starts with "iamnot"
>
> 1. Using regexs
> $_ = 'iamareallycoolstring';
> /^iamnot.*/ && print "starts with iamnot\n";

/^iamnot/ && print "starts with iamnot\n";

Ilja.




Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 15 May 2000 19:51:04 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: upgrading
Message-Id: <8fpguo$ill$1@orpheus.gellyfish.com>

On 13 May 2000 11:37:10 +0100 Jonathan Stowe wrote:
> On Fri, 12 May 2000 22:18:56 GMT mparker200@my-deja.com wrote:
>> How can I tell which perl modules have been installed on a Solaris
>> system?  I think that they should be installed in site_perl but that is
>> not always the case.
>> 
> 
> perldoc perllocal
> 

I failed to grok the subject properly ;-}  If you want an easy way of
reinstalling all of the modules you have now when you upgrade Perl
you might do :

   perl -MCPAN -eautobundle

and then after upgrading you can do :

  perl -MCPAN -e'install Bundle::<whatever>'

et voila !

/J\
-- 
I'm having the best day of my life, and I owe it all to not going
to Church!
-- 
fortune oscar homer


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

Date: Tue, 16 May 2000 11:09:37 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: What's this line which Perl added to AUTOEXEC.BAT?
Message-Id: <39272bda.6432266@news.skynet.be>

bjanko wrote:

>>> SET PATH=C:\Perl\bin\
>>>
>>> This seemed to make my computer unbootable.
>>
>>I very much doubt it.
>
>Golly gee, I was sittin' right here and it booted fine before
>installing Perl, but afterward it didn't boot.  I edited the
>line out of the autoexec.bat and it booted again.  I put the
>line back and it would not boot again.  But since you say YOU
>doubt it, I suppose I'll believe you and I guess it just never
>really happened!

It SHOULDN'T have happened. It doesn't happen with more than 99% of all
people installing ActivePerl. But on Win boxes, no screw-up is
impossible.

The line should have read, as J. Stowe wrote:

	SET PATH=C:\Perl\bin\;%PATH%


Try that, and see if it boots now.

-- 
	Bart.


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

Date: Tue, 16 May 2000 11:32:07 GMT
From: Paul Eckert <peckert@epicrealm.com>
Subject: Re: zen and the art of trolling [OT]
Message-Id: <3921309E.E51B1B05@epicrealm.com>

Dear Godzilla:
   This is a technical newsgroup.  
   Please confine yourself to technical subjects.
   Paul

"Godzilla!" wrote:
> 
> Neil Kandalgaonkar wrote:
> 
> > In article <3920917C.D2338697@stomp.stomp.tokyo>,
> > Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
> 
> (snip)
> 
> I will say this one last time.
> 
> "I find no benefit in spreading hatred...."
> 
> Godzilla!

-- 
Paul Eckert
Sr. Software Engineer
Epicrealm Inc.
1651 N. Glenville Dr., Suite 212
Richardson, TX 75081
(972) 479-0135 x300
peckert@epicrealm.com


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

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 V9 Issue 3060
**************************************


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