[22351] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4572 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Feb 16 09:05:44 2003

Date: Sun, 16 Feb 2003 06:05:06 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 16 Feb 2003     Volume: 10 Number: 4572

Today's topics:
    Re: $^S == 0 inside eval (v5.6.1) (Paul Wood)
        (not 1) and (!1) yield zero length string <parv_fm@emailgroupsWhereElse.net>
    Re: (not 1) and (!1) yield zero length string <sfandino@yahoo.com>
        Bug in Net::FTP - ls() command doesn't work (Mark McKay)
        counter <pons@gmx.li>
    Re: counter <krahnj@acm.org>
    Re: counter <pons@gmx.li>
        Perl dies silently. (tî'pô)
    Re: Perl dies silently. <tassilo.parseval@post.rwth-aachen.de>
    Re: Perl dies silently. <espenmyr@start.no.cretinfilter>
        program contol <d.borland@ntlworld.com>
    Re: program contol <d.borland@ntlworld.com>
    Re: program contol <tassilo.parseval@post.rwth-aachen.de>
    Re: program contol <rereidy@indra.com>
    Re: program contol <Juha.Laiho@iki.fi>
    Re: use lib Apache->server_root_relative('lib/perl'); <Pop@goesthe.net>
    Re: use lib Apache->server_root_relative('lib/perl'); <tassilo.parseval@post.rwth-aachen.de>
    Re: Using a variable to create a slice <REMOVEsdnCAPS@comcast.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 16 Feb 2003 04:32:50 -0800
From: paul@torporific.org (Paul Wood)
Subject: Re: $^S == 0 inside eval (v5.6.1)
Message-Id: <a2702001.0302160432.88b0648@posting.google.com>

Benjamin Goldberg <goldbb2@earthlink.net> wrote in message news:<3E4F1C8E.12168611@earthlink.net>...
> Paul Wood wrote:
> > 
> > Hi.
> > 
> > I'm having trouble with $^S being zero inside an eval { }.
> 
> That's proper behavior.  It's only supposed to be true in eval ( ).
> 
> If you can't tell the difference between {} and (), make your text
> bigger, or use a different font.

Hmm. My mistake. The documentation in perlvar isn't very clear on the
subject, however.

So how is it possible to tell if you're inside an eval { } ?

The situation I'm using this in is a CORE::GLOBAL::die override... I
want to use eval { } to catch exceptions but if one is uncaught then
it shouldn't die() but rather print a message to STDOUT and exit(0);

So, esssentially, I test for $^S inside the die wrapper to see if I
should continue and call the real die(), knowing that the exception
will be caught, or whether to print the message and exit;

Thanks for the help,

-Paul.


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

Date: Sun, 16 Feb 2003 10:32:17 GMT
From: parv <parv_fm@emailgroupsWhereElse.net>
Subject: (not 1) and (!1) yield zero length string
Message-Id: <slrnb4uq8s.17r9.parv_fm@localhost.holy.cow>

I am mystified that (not 1 ...) & (!1 ...) yield _zero_length_string_
but not the following operations...

  (!0 && 0) , (!0 and 0) , (not 0 && 0) , (not 0 and 0)


 ...which produce 0, 0, 1, 0 respectively.

The perlop (perl 5.6.1) states that qw{and && or ||} operators return
the last value evaluated.

So, does (not 1) or (!1) change/short-circuit to 0 which is false
value, and empty string is a false value, which is then returned?

But isn't 1 the value being evaluated which should be returned,
though very odd & unexpected, according to the perlop?  In case
perlop is referring to the value of "not 1", then there is ambiguity
there, IMO.


  - parv

-- 

  please don't send me private e-mail.
  if you must, do away w/ WhereElse in the address.


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

Date: Sun, 16 Feb 2003 12:09:45 +0000
From: =?ISO-8859-1?Q?Salvador_Fandi=F1o_Garc=EDa?= <sfandino@yahoo.com>
Subject: Re: (not 1) and (!1) yield zero length string
Message-Id: <3E4F7F89.8090508@yahoo.com>

Hi

> I am mystified that (not 1 ...) & (!1 ...) yield _zero_length_string_
> but not the following operations...

It seems that (not 1) returns a magic scalar that renders as 0 in 
numeric context and '' in other scalar contexts.

try that:

   use warnings;

   print(not(1)+2); # no warning
   print(''+2); # warning!



>   (!0 && 0) , (!0 and 0) , (not 0 && 0) , (not 0 and 0)

   (!0 && 0) => ((!0) && 0) => (1 && 0) => 0
   (!0 and 0) => ((!0) && 0) => (1 && 0) => 0
   (not 0 && 0) => !(0 && 0) => !0 => 1
   (not 0 and 0) => ((!0) && 0) => (1 && 0) => 0

Bye,

   - Salva



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

Date: 16 Feb 2003 00:45:52 -0800
From: mark@kitfox.com (Mark McKay)
Subject: Bug in Net::FTP - ls() command doesn't work
Message-Id: <52de739f.0302160045.7b2070c@posting.google.com>

I'm having some trouble with porting some code that uses the Net::FTP
package from Windows to Linux. On Linux, I'm using the libnet-1.12
module, while for Windows I'm using ActiveState with Net::FTP
installed using the Perl Package Manager.

Anyhow, the following works on windows, but not on Linux.  The
FTP::ls() returns empty for some reason, even though the directory
exists and is not empty:




#Connect to server
print "Connecting to server\n";

my $ftp = Net::FTP->new("ftp.mydomain.com", Debug => 0);

print "Connection established\n";

$ftp->login("mylogin","password");

print "Logged in\n";

$ftp->cwd("/public_html/comics");

my $dir = $ftp->pwd();
print "Switched to directory $dir\n";

@comicFiles = $ftp->ls();

print "Filelist:\n@comicFiles\n";





Any help would be appreciated.

Mark McKay

--
http://www.kitfox.com


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

Date: Sun, 16 Feb 2003 10:56:50 +0200
From: "Pons" <pons@gmx.li>
Subject: counter
Message-Id: <b2njd0$1e1se8$1@ID-172702.news.dfncis.de>

I want to add this perl script at my web server
but still confused which steps should be taken
to make the counter available.

-Pons
#! /usr/bin/perl

# access.pl  Mark Brettin  7/31/98
# Web page access counter.



$DEBUG=0;

if($DEBUG)
{
  @key=keys(%ENV);
  $array_size=@key;
  for($i=0;$i<$array_size;$i++)
  {
    print "<pre>";
    print "DEBUG Name: $key[$i]\n";
    print "      Value: $ENV{$key[$i]}\n</pre>";
  }
}

unless(open(FILE, "./access.dat")){print "Unable to open access.dat<br>\n";
exit;}
@count = <FILE>;
close(FILE);

$size = length($count[0]);
for($x=0; $x<$size; $x++)
{
  if(substr($count[0], $x, 1) eq "0")
    {$image .= "<img src=\"../images/0glowing.gif\" border=\"0\">\n";}
  if(substr($count[0], $x, 1) eq "1")
    {$image .= "<img src=\"../images/1glowing.gif\" border=\"0\">\n";}
  if(substr($count[0], $x, 1) eq "2")
    {$image .= "<img src=\"../images/2glowing.gif\" border=\"0\">\n";}
  if(substr($count[0], $x, 1) eq "3")
    {$image .= "<img src=\"../images/3glowing.gif\" border=\"0\">\n";}
  if(substr($count[0], $x, 1) eq "4")
    {$image .= "<img src=\"../images/4glowing.gif\" border=\"0\">\n";}
  if(substr($count[0], $x, 1) eq "5")
    {$image .= "<img src=\"../images/5glowing.gif\" border=\"0\">\n";}
  if(substr($count[0], $x, 1) eq "6")
    {$image .= "<img src=\"../images/6glowing.gif\" border=\"0\">\n";}
  if(substr($count[0], $x, 1) eq "7")
    {$image .= "<img src=\"../images/7glowing.gif\" border=\"0\">\n";}
  if(substr($count[0], $x, 1) eq "8")
    {$image .= "<img src=\"../images/8glowing.gif\" border=\"0\">\n";}
  if(substr($count[0], $x, 1) eq "9")
    {$image .= "<img src=\"../images/9glowing.gif\" border=\"0\">\n";}
}

# linker.lanl.gov
if($ENV{REMOTE_ADDR} eq "128.165.24.227"){print "$image"; exit();}
# hepatitis.lanl.gov
#if($ENV{REMOTE_ADDR} eq "128.165.24.117"){print "$image"; exit();}


$count[0] += 1;

unless(open(FILE, ">access.dat")){print "unable to open file\n"; exit;}

for($x=0; $x<@count; $x++)
{
  chomp($count[$x]);
  print FILE "$count[$x]\n";
}

print FILE "@count";
close(FILE);

unless(open(FILE, ">>access.dat")){print "unable to open file\n"; exit;}
print FILE "\n------------ IP addresses and client
information ------------\n";
print FILE "\nDate / Time:       " . localtime();
print FILE "\nRemote IP Address: $ENV{REMOTE_ADDR}";
print FILE "\nRemote Host:       $ENV{REMOTE_HOST}";
print FILE "\nHTTP User Agent:   $ENV{HTTP_USER_AGENT}\n";
close(FILE);

#print "$image";
#print "$count[0]";







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

Date: Sun, 16 Feb 2003 09:37:27 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: counter
Message-Id: <3E4F5B43.F414D07F@acm.org>

Pons wrote:
> 
> I want to add this perl script at my web server
> but still confused which steps should be taken
> to make the counter available.

Web counters are covered in perlfaq5

       I still don't get locking.  I just want to increment the
       number in the file.  How can I do this?

       Didn't anyone ever tell you web-page hit counters were
       useless?  They don't count number of hits, they're a waste
       of time, and they serve only to stroke the writer's van­
       ity.  Better to pick a random number.  It's more realis­
       tic.

       Anyway, this is what you can do if you can't help your­
       self.


> #! /usr/bin/perl

use warnings;
use strict;


> # access.pl  Mark Brettin  7/31/98
> # Web page access counter.
> 
> $DEBUG=0;
> 
> if($DEBUG)
> {
>   @key=keys(%ENV);
>   $array_size=@key;
>   for($i=0;$i<$array_size;$i++)
>   {
>     print "<pre>";
>     print "DEBUG Name: $key[$i]\n";
>     print "      Value: $ENV{$key[$i]}\n</pre>";
>   }
> }

A more perlish way to do that:

if ( $DEBUG ) {
  for ( keys %ENV ) {
    print "<pre>DEBUG Name: $_\n";
    print "      Value: $ENV{$_}\n</pre>";
}


> unless(open(FILE, "./access.dat")){print "Unable to open access.dat<br>\n";
> exit;}
> @count = <FILE>;
> close(FILE);
> 
> $size = length($count[0]);
> for($x=0; $x<$size; $x++)
> {
>   if(substr($count[0], $x, 1) eq "0")
>     {$image .= "<img src=\"../images/0glowing.gif\" border=\"0\">\n";}
>   if(substr($count[0], $x, 1) eq "1")
>     {$image .= "<img src=\"../images/1glowing.gif\" border=\"0\">\n";}
>   if(substr($count[0], $x, 1) eq "2")
>     {$image .= "<img src=\"../images/2glowing.gif\" border=\"0\">\n";}
>   if(substr($count[0], $x, 1) eq "3")
>     {$image .= "<img src=\"../images/3glowing.gif\" border=\"0\">\n";}
>   if(substr($count[0], $x, 1) eq "4")
>     {$image .= "<img src=\"../images/4glowing.gif\" border=\"0\">\n";}
>   if(substr($count[0], $x, 1) eq "5")
>     {$image .= "<img src=\"../images/5glowing.gif\" border=\"0\">\n";}
>   if(substr($count[0], $x, 1) eq "6")
>     {$image .= "<img src=\"../images/6glowing.gif\" border=\"0\">\n";}
>   if(substr($count[0], $x, 1) eq "7")
>     {$image .= "<img src=\"../images/7glowing.gif\" border=\"0\">\n";}
>   if(substr($count[0], $x, 1) eq "8")
>     {$image .= "<img src=\"../images/8glowing.gif\" border=\"0\">\n";}
>   if(substr($count[0], $x, 1) eq "9")
>     {$image .= "<img src=\"../images/9glowing.gif\" border=\"0\">\n";}
> }

A more perlish way to do that:

my $image = '';
for ( $count[0] =~ /\d/g ) {
  $image .= qq[<img src="../images/${_}glowing.gif" border="0">\n];
  }


> # linker.lanl.gov
> if($ENV{REMOTE_ADDR} eq "128.165.24.227"){print "$image"; exit();}
> # hepatitis.lanl.gov
> #if($ENV{REMOTE_ADDR} eq "128.165.24.117"){print "$image"; exit();}
> 
> $count[0] += 1;
> 
> unless(open(FILE, ">access.dat")){print "unable to open file\n"; exit;}

What happens if another process modified the file before you get to this
point?

> for($x=0; $x<@count; $x++)
> {
>   chomp($count[$x]);
>   print FILE "$count[$x]\n";

Why chomp the newline on one line and then add it back on the next line?

> }
> 
> print FILE "@count";

Why are you printing the array to the file a second time?

perldoc -q "Why do I get weird spaces when I print an array of lines"


> close(FILE);
> 
> unless(open(FILE, ">>access.dat")){print "unable to open file\n"; exit;}
> print FILE "\n------------ IP addresses and client
> information ------------\n";
> print FILE "\nDate / Time:       " . localtime();
> print FILE "\nRemote IP Address: $ENV{REMOTE_ADDR}";
> print FILE "\nRemote Host:       $ENV{REMOTE_HOST}";
> print FILE "\nHTTP User Agent:   $ENV{HTTP_USER_AGENT}\n";
> close(FILE);
> 
> #print "$image";
> #print "$count[0]";


John
-- 
use Perl;
program
fulfillment


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

Date: Sun, 16 Feb 2003 15:46:20 +0200
From: "Pons" <pons@gmx.li>
Subject: Re: counter
Message-Id: <b2o4br$1ekuek$1@ID-172702.news.dfncis.de>

i have a perl script access.pl for web counting access.pl, I want to add
this to my web to make the counter available , I placed the pl script under
/usr/local/www/cgi-bin,
can any onw tell me how to add it to my index.html
-Pons

"Pons" <pons@gmx.li> wrote in message
news:b2njd0$1e1se8$1@ID-172702.news.dfncis.de...
> I want to add this perl script at my web server
> but still confused which steps should be taken
> to make the counter available.
>
> -Pons
> #! /usr/bin/perl
>
> # access.pl  Mark Brettin  7/31/98
> # Web page access counter.
>
>
>
> $DEBUG=0;
>
> if($DEBUG)
> {
>   @key=keys(%ENV);
>   $array_size=@key;
>   for($i=0;$i<$array_size;$i++)
>   {
>     print "<pre>";
>     print "DEBUG Name: $key[$i]\n";
>     print "      Value: $ENV{$key[$i]}\n</pre>";
>   }
> }
>
> unless(open(FILE, "./access.dat")){print "Unable to open
access.dat<br>\n";
> exit;}
> @count = <FILE>;
> close(FILE);
>
> $size = length($count[0]);
> for($x=0; $x<$size; $x++)
> {
>   if(substr($count[0], $x, 1) eq "0")
>     {$image .= "<img src=\"../images/0glowing.gif\" border=\"0\">\n";}
>   if(substr($count[0], $x, 1) eq "1")
>     {$image .= "<img src=\"../images/1glowing.gif\" border=\"0\">\n";}
>   if(substr($count[0], $x, 1) eq "2")
>     {$image .= "<img src=\"../images/2glowing.gif\" border=\"0\">\n";}
>   if(substr($count[0], $x, 1) eq "3")
>     {$image .= "<img src=\"../images/3glowing.gif\" border=\"0\">\n";}
>   if(substr($count[0], $x, 1) eq "4")
>     {$image .= "<img src=\"../images/4glowing.gif\" border=\"0\">\n";}
>   if(substr($count[0], $x, 1) eq "5")
>     {$image .= "<img src=\"../images/5glowing.gif\" border=\"0\">\n";}
>   if(substr($count[0], $x, 1) eq "6")
>     {$image .= "<img src=\"../images/6glowing.gif\" border=\"0\">\n";}
>   if(substr($count[0], $x, 1) eq "7")
>     {$image .= "<img src=\"../images/7glowing.gif\" border=\"0\">\n";}
>   if(substr($count[0], $x, 1) eq "8")
>     {$image .= "<img src=\"../images/8glowing.gif\" border=\"0\">\n";}
>   if(substr($count[0], $x, 1) eq "9")
>     {$image .= "<img src=\"../images/9glowing.gif\" border=\"0\">\n";}
> }
>
> # linker.lanl.gov
> if($ENV{REMOTE_ADDR} eq "128.165.24.227"){print "$image"; exit();}
> # hepatitis.lanl.gov
> #if($ENV{REMOTE_ADDR} eq "128.165.24.117"){print "$image"; exit();}
>
>
> $count[0] += 1;
>
> unless(open(FILE, ">access.dat")){print "unable to open file\n"; exit;}
>
> for($x=0; $x<@count; $x++)
> {
>   chomp($count[$x]);
>   print FILE "$count[$x]\n";
> }
>
> print FILE "@count";
> close(FILE);
>
> unless(open(FILE, ">>access.dat")){print "unable to open file\n"; exit;}
> print FILE "\n------------ IP addresses and client
> information ------------\n";
> print FILE "\nDate / Time:       " . localtime();
> print FILE "\nRemote IP Address: $ENV{REMOTE_ADDR}";
> print FILE "\nRemote Host:       $ENV{REMOTE_HOST}";
> print FILE "\nHTTP User Agent:   $ENV{HTTP_USER_AGENT}\n";
> close(FILE);
>
> #print "$image";
> #print "$count[0]";
>
>
>
>
>




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

Date: Sun, 16 Feb 2003 14:52:46 +0200
From: "Teh (tî'pô)" <teh@mindless.com>
Subject: Perl dies silently.
Message-Id: <iu1v4vgfbegana1eanjv573vkg4gmvjitb@4ax.com>

Hi, I'm having a wield problem.
I'm maintaining a bit Perl project and every now and then perl dies
silently.

This happens in some cases when there's a fatal error (call a method
on an unblessed scalar) and sometimes when die or croak are called
explicitly, if I run the process via the debugger I see the output
otherwise it's just not there.

STDERR hasn't been closed, if I print stuff explicitly to STDERR it
makes it to the console.

Does anyone have an idea where I should start looking for the problem?

Thanks in advance.


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

Date: 16 Feb 2003 13:00:37 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: Perl dies silently.
Message-Id: <b2o21l$pc4$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Teh (tî'pô):

> Hi, I'm having a wield problem.
> I'm maintaining a bit Perl project and every now and then perl dies
> silently.
> 
> This happens in some cases when there's a fatal error (call a method
> on an unblessed scalar) and sometimes when die or croak are called
> explicitly, if I run the process via the debugger I see the output
> otherwise it's just not there.
> 
> STDERR hasn't been closed, if I print stuff explicitly to STDERR it
> makes it to the console.
> 
> Does anyone have an idea where I should start looking for the problem?

Not yet. Perhaps you install a signal-handler for fatal errors and write
the stuff into a file:

    sub $SIG{ __DIE__ } = sub {
        open my $h, ">>", "fatal.log" 
            or die...; # err, a little odd in a __DIE__ handler
        print $h scalar localtime, ": @_";
        close $h;
        die @_;
    };

Thus you can inspect further where the error occured and maybe why
nothing got printed.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: 16 Feb 2003 14:58:47 +0100
From: Espen Myrland <espenmyr@start.no.cretinfilter>
Subject: Re: Perl dies silently.
Message-Id: <87y94gnx7s.fsf@chello.no>

"Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de> writes:

> Not yet. Perhaps you install a signal-handler for fatal errors and write
> the stuff into a file:
> 
>     sub $SIG{ __DIE__ } = sub {
>         open my $h, ">>", "fatal.log" 
>             or die...; # err, a little odd in a __DIE__ handler
>         print $h scalar localtime, ": @_";
>         close $h;
>         die @_;
>     };
> 
> Thus you can inspect further where the error occured and maybe why
> nothing got printed.


Yes if it works.. The progam maybe dies with a string containing a
newline..: 

perl -e 'die "$empty \n"'
perl -e 'die "$empty"'

perl -e 'die ""'
perl -e 'die "\n"'



-- 
espen



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

Date: Sun, 16 Feb 2003 10:23:49 -0000
From: "d.borland" <d.borland@ntlworld.com>
Subject: program contol
Message-Id: <XFJ3a.35$44.32715@newsfep2-gui>

He all,

I am currently trying to write a script which will execute a program on the
users system and then pass data to the program.  That's all i want.

I have got as far as opening the program using the snippet of code below,
but when i try to pass any data to it i get nothing, could anyone help me
out here?

code for opening program:
open(PROGHANDLE, "programname |");

code to pass data to program, which doesn't work:
print PROGHANDLE "data to send";

I'm not sure how easy or hard something like this is to do in perl, as ii am
still in early stages of learning.

Thanks for your time, any help is much appreciated.

Kain

';'




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

Date: Sun, 16 Feb 2003 10:30:31 -0000
From: "d.borland" <d.borland@ntlworld.com>
Subject: Re: program contol
Message-Id: <cMJ3a.36$44.35773@newsfep2-gui>

Just though i'd follow that message up, to let you know that program i an
trying to control with the script simply waits for a whole number(although
possibly as sort of data in the future) to be entered into it, cannot be
passed as an arg on program execucution.

I can catch the output that the program produces, cannot pass data to it.

Hope that helps.


"d.borland" <d.borland@ntlworld.com> wrote in message
news:XFJ3a.35$44.32715@newsfep2-gui...
> He all,
>
> I am currently trying to write a script which will execute a program on
the
> users system and then pass data to the program.  That's all i want.
>
> I have got as far as opening the program using the snippet of code below,
> but when i try to pass any data to it i get nothing, could anyone help me
> out here?
>
> code for opening program:
> open(PROGHANDLE, "programname |");
>
> code to pass data to program, which doesn't work:
> print PROGHANDLE "data to send";
>
> I'm not sure how easy or hard something like this is to do in perl, as ii
am
> still in early stages of learning.
>
> Thanks for your time, any help is much appreciated.
>
> Kain
>
> ';'
>
>
>




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

Date: 16 Feb 2003 12:06:56 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: program contol
Message-Id: <b2nut0$mdn$1@nets3.rz.RWTH-Aachen.DE>

Also sprach d.borland:

> I am currently trying to write a script which will execute a program on the
> users system and then pass data to the program.  That's all i want.
> 
> I have got as far as opening the program using the snippet of code below,
> but when i try to pass any data to it i get nothing, could anyone help me
> out here?
> 
> code for opening program:
> open(PROGHANDLE, "programname |");
> 
> code to pass data to program, which doesn't work:
> print PROGHANDLE "data to send";

You are opening a pipe from the program to your script. If you want to
send data to it, that's the wrong way around. Therefore:

    open PROGHANDLE, "| programname" or die $!;
    print PROGHANDLE "data to send";
    close PROGHANDLE;

Also notice the "or die $!"-part that should never miss when you do
system-calls. They can go wrong in a lot of ways and $! tells you the
reason when this happens.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: Sun, 16 Feb 2003 05:13:41 -0700
From: Ron Reidy <rereidy@indra.com>
Subject: Re: program contol
Message-Id: <3E4F8075.4090206@indra.com>

See

1.  perldoc perlipc, the section on "Safe Pipe Opens"
2.  Look at the Expect module

--
Ron Reidy
Oracle DBA

d.borland wrote:
> He all,
> 
> I am currently trying to write a script which will execute a program on the
> users system and then pass data to the program.  That's all i want.
> 
> I have got as far as opening the program using the snippet of code below,
> but when i try to pass any data to it i get nothing, could anyone help me
> out here?
> 
> code for opening program:
> open(PROGHANDLE, "programname |");
> 
> code to pass data to program, which doesn't work:
> print PROGHANDLE "data to send";
> 
> I'm not sure how easy or hard something like this is to do in perl, as ii am
> still in early stages of learning.
> 
> Thanks for your time, any help is much appreciated.
> 
> Kain
> 
> ';'
> 
> 



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

Date: Sun, 16 Feb 2003 12:32:00 GMT
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: program contol
Message-Id: <b2o08m$las$2@ichaos.ichaos-int>

"d.borland" <d.borland@ntlworld.com> said:
>I am currently trying to write a script which will execute a program on the
>users system and then pass data to the program.  That's all i want.
>
>I have got as far as opening the program using the snippet of code below,
>but when i try to pass any data to it i get nothing, could anyone help me
>out here?
>
>code for opening program:
>open(PROGHANDLE, "programname |");

Here you run the program so that you allow your script to read whatever
is produced by the program. If you instead want to write to the program
you should use
open(PROGHANDLE, "| programname");

If, however, you want to read as well as write, there are some pitfalls
ahead. Please see the answer to question
"How can I open a pipe both to and from a command?" in the perl FAQ;
it contains pointers for further documentation.
-- 
Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
         PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)


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

Date: Sun, 16 Feb 2003 11:22:10 GMT
From: "Papa Oohmawmaw" <Pop@goesthe.net>
Subject: Re: use lib Apache->server_root_relative('lib/perl');
Message-Id: <CvK3a.123150$SD6.6461@sccrnsc03>

I have posted a lot to newsgroups (for years), have never read a FAQ and
have no intention of EVER doing so. It never ceases to amaze me why some
people want to point out about cross posting (which I did not do). Go to a
moderated group of your own so you have total control if things aren't to
your liking. I posted to one group. If this person goes to every group that
has PERL or 'wild indian' in it, that's his problem. He should stay in one
group. Who gives a rat's ass, anyway? If you have read the message or seen
it before, skip over it. The people that tell you to read the FAQ's are the
ones at work (or anywhere else for that matter) that like to point things
out that (that they perceive) people are not doing it 'the correct way.' The
problem with the world today is somebody thinks someone else is not doing it
'the right way.' I'm not the least bit sorry I'm not doing it 'the right
way', which is, of course, his way. Killfiles, go ahead, I change my
username all the time. That's an exercise in futility. I usually consult
Google before posting anyway. If I happen to read an answer that I need by
the person in question, I'll use it. I, also, won't care if I see his answer
3 or 4 times or if he's answered the same question before in a different
group.


"Papa Oohmawmaw" <Pop@goesthe.net> wrote in message
news:veB3a.117585$iG3.14669@sccrnsc02...
> 1) Can someone tell me where the line below (a) is pointing to? It's from
my
> startup.pl file. I'm wanting it to go to "/home/perl_apache/lib/perl/."
>
>     a) use lib Apache->server_root_relative('lib/perl');
>
> 2) The startup.pl file is at this address (b)
>
>     b) /home/perl_apache/lib/perl/startup.pl
>
> 3) My httpd.conf is at this address (c)
>
>     c) /opt/apache/conf/httpd.conf
>
> Here's the error message I'm getting when trying to start Apache (d).
>
>     d) [root@ensim Apache2]# /opt/apache/bin/apachectl start
> [error] Can't locate object method "server_root_relative" via package
> "Apache" at /home/perl_apache/lib/perl/startup.pl line 5.
> BEGIN failed--compilation aborted at /home/perl_apache/lib/perl/startup.pl
> line 5.
> Compilation failed in require at (eval 1) line 1.
>
> [Sat Feb 15 18:37:35 2003] [error] Can't load Perl file:
> /home/perl_apache/lib/perl/startup.pl for server ensim.rackshack.net:0,
> exiting...
>
>




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

Date: 16 Feb 2003 12:41:27 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: use lib Apache->server_root_relative('lib/perl');
Message-Id: <b2o0tn$o6p$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Papa Oohmawmaw:

> I have posted a lot to newsgroups (for years), have never read a FAQ and
> have no intention of EVER doing so. It never ceases to amaze me why some
> people want to point out about cross posting (which I did not do). Go to a
> moderated group of your own so you have total control if things aren't to
> your liking. 

If you like it or not, the regulars (ie. those that do follow the
conventions here) have some sort of control over this group because
those are the ones you are likely to get help from, if any. The nitwits,
that is people like you who publically declare how much they don't care
about any rules, lack the experience and knowledge to give help (they
have an unmatched competence in trolling though, oddly enough). Those
are only the wanna-be consumers but the regulars in here generally take
good care that there's not too much they can consume (save for a smack
on the head).

So either you learn some manners (your parents haven't done their duty
quite right, eh?) or you tread off. Either way, there's not much to
harvest here for you any longer.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: Sun, 16 Feb 2003 07:25:47 -0600
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Using a variable to create a slice
Message-Id: <Xns932455BC4D96sdn.comcast@216.166.71.239>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

"James E Keenan" <jkeen@concentric.net> wrote in
news:b2eiv8$17g@dispatch.concentric.net: 

> "Terry Bolands" <tbolands@yahoo.com> wrote in message
> news:6393ea9a.0302121412.11235c6c@posting.google.com...
>> I want to do something like this:
>>
>>   @array[1,2,3] = (stuff);
>>
>> with a variable like this:
>>
>>   $v = "1,2,3";
>>   @array[$v] = (stuff);
>>
> You can't do this.  Inside the square brackets you can place either a
> single integer (or an expression that evaluates to an integer) or a
> range of integers indicated by the range operator. 

Or an array.

- -- 
Eric
print scalar reverse sort qw p ekca lre reh 
ts uJ p, $/.r, map $_.$", qw e p h tona e;
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32) - WinPT 0.5.13

iD8DBQE+T5FNY96i4h5M0egRAksaAJ9mjai74kmzq8aiafTzsYT41pi8YQCg18nw
fb+c5pgrKZ+audZzEzqRpEk=
=BL5r
-----END PGP SIGNATURE-----


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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


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