[13616] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1026 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 8 22:05:36 1999

Date: Fri, 8 Oct 1999 19:05:20 -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: <939434719-v9-i1026@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 8 Oct 1999     Volume: 9 Number: 1026

Today's topics:
    Re: A perl dereferencing problem <dchristensen@california.com>
    Re: Bug with localtime() in Perl 5.004 and 5.005 (Ilya Zakharevich)
    Re: calling a dll from perl <dchristensen@california.com>
    Re: How to write an EOF in to a file? (Kragen Sitaker)
    Re: Looking for Perl script to parse Ada code (Kragen Sitaker)
    Re: matching (Kragen Sitaker)
    Re: Overkill of warnings in module (Kragen Sitaker)
    Re: parenthesizing arguments to grep - BLOCK form <uri@sysarch.com>
        perl headers, setsockopt, multicast <bcboy@cisco.com>
    Re: Possible to Protect Code?? <dwozmak@rational.com>
    Re: Sending mail with Perl? <dove@synopsys.com>
    Re: sendmail problem <dove@synopsys.com>
    Re: sendmail problem (Kragen Sitaker)
        Server-Push Script <arndt@arweb.de>
    Re: Shell and Perl have different $? (Kragen Sitaker)
    Re: Shell and Perl have different $? <dchristensen@california.com>
    Re: Shell and Perl have different $? (Sam Carmalt)
    Re: Ubi nil vales...  1603   [1/2] <uri@sysarch.com>
    Re: Using a regexp in an index function, can it be done <ltl@rgsun40.viasystems.com>
    Re: Using a regexp in an index function, can it be done (Ilya Zakharevich)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 8 Oct 1999 18:35:25 -0700
From: "David Christensen" <dchristensen@california.com>
Subject: Re: A perl dereferencing problem
Message-Id: <37fe9872_5@news5.newsfeeds.com>

manojska:

Please post more code and a sample run.

--
David Christensen
dchristensen@california.com



manojska@my-deja.com wrote in message
<7tldq5$vu0$1@nnrp1.deja.com>...
>Hi Perls ..
>
>In one of my scripts I have a class call my_class, then
>ref($self->{message}->[$count]) returns 'my_class'. But when I
call the
>method print_me of my_class like
>        $self->{message}->[$count]->print_me()
>
>I get the error ' Can't call method "print_me" without a package
or
>object reference at my_class.pm line 44, <MANXQ> chunk 44. '
>
>Pls help. Thanks in advance.
>
>  manojska
>
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.




  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 8 Oct 1999 22:38:22 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Bug with localtime() in Perl 5.004 and 5.005
Message-Id: <7tlrou$bu2$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Rick Delaney 
<rick.delaney@home.com>],
who wrote in article <37FE5F8C.2FE2D568@home.com>:
> > Moreover, leap seconds are "mostly" governed by the changes in the
> > rate of Earth rotation, which IIRC are in turn mostly governed by
> > whether changes.  Since one cannot predict the latter, making
> > prediction about the former would be kinda stupid.
> 
> Predictions based on weather forecasts are suspect, but this has nothing
> (or negligible enough to be called nothing) to do with the rotation of
> the Earth or leap seconds.
> 
> Leap seconds are periodically added to a standard atomic clock (which I
> shall call SAC) because there are less than 86400 SAC seconds in one
> Earth rotation.

You probably mean *more*, not *less*.

Now *why* there are less than ??? seconds in one Earth rotation?
Because the notion of the second was settled down with necessary
precision some time ago.  That time (50's?) there was exactly 86400
seconds *on average*.

> The difference is such that a second must be added once
> or twice a year so that the SAC time doesn't drift away from how a solar
> year is measured.
> 
> Prediction is not really necessary.  When the SAC time is lagging by
> about a second as measured against the solar time then it is time to add
> a leap second.  These are usually added in June or December, I think,
> but could probably be added anytime the drift becomes too great.

IIRC, There is a predictable part of the drift, and weather-related
deviations.  IIRC, nowadays on a span of 6 months the total
unpredictable deviation has the same order of magnitude as the
predicitable one.  This is why one cannot announce in advance when
leap seconds will be added.

Of course, when earth rotation slows down more and more, the
predictable part will become larger and larger.  When one Earth
rotation becomes slower than 86424 IAC seconds in a solar day, you
will need more than 1 leap second in at least one hour a day.  ;-)

Ilya


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

Date: Fri, 8 Oct 1999 18:34:33 -0700
From: "David Christensen" <dchristensen@california.com>
Subject: Re: calling a dll from perl
Message-Id: <37fe9847_4@news5.newsfeeds.com>

Tait:

Sounds like you need to write a Perl XS module that encapsulates
the DLL.  See  'perldoc perlxs'.

A less efficient approach would be to write a console interface for
the DLL and use backticks and/ or system().

--
David Christensen
dchristensen@california.com


tlars@my-deja.com wrote in message <7tl6u0$qur$1@nnrp1.deja.com>...
>Does anyone know if it's possible to call a dll in the Win32
version of
>perl?  If so, could you please direct me to the module that allows
you
>to do this.
>
>Thanks,
>
>Tait
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.




  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Sat, 09 Oct 1999 02:03:26 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: How to write an EOF in to a file?
Message-Id: <OnxL3.10099$eM4.665486@typ11.nn.bcandid.com>

In article <MPG.1267d02d1ae13aa598a060@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>In article <7tkdaf$gbk$1@news.ntu.edu.sg> on Fri, 8 Oct 1999 17:23:25 
>+0800, Daniel Y.L. <linyong2000@990.net> says...
>> # undef $/;
>> # $contents = <FILEHANDLE>;        # it only read one line, it is correct;
>
>Why do you say it reads only one line?  It should read the entire file.

The way he has it written, it won't read anything -- it's commented
out.  I suspect that when undef $/ was commented out, but $contents =
<FILEHANDLE> was not, it only read one line.

>> I also tried to clear the $INPUTY_RECROD_SEPARATOR, $/ to read the whole
>> file contents.  But, it also hang up.
>
>The 'canonical' way to read an entire file into a scalar is:
>
>    $contents = do { local $/; <FILEHANDLE> };
>
>It would be surprising if you tried that and found that it didn't work.  
>Perhaps you forgot to check the results of the open() to see that the 
>file was opened successfully for reading.

I'm curious how big this file is.  Maybe it contains huge unmapped
blocks of nulls?

Daniel, how far into the file does it get before it hangs?  Is it an
ordinary text file?  How big is it?

Larry's solution is probably better, but your solution -- while it does
only read every other line into your variable -- should not hang.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Fri Oct 08 1999
32 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Sat, 09 Oct 1999 01:55:21 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Looking for Perl script to parse Ada code
Message-Id: <dgxL3.10090$eM4.665284@typ11.nn.bcandid.com>

In article <x7g0zlongx.fsf@home.sysarch.com>,
Uri Guttman  <uri@sysarch.com> wrote:
>>>>>> "S" == Streesh  <streesh@caci.com> writes:
>
>  S> Does anyone know where I might find this?
>
>only ada can parse ada.
>
>:-)

Basically, Uri is correct: if you want to parse Ada, you'll have to
write an Ada parser.  Ada's syntax is well-documented and relatively
clean, if complex.

As far as I know, nobody has yet written an Ada parser in Perl, so
you'd have to write your own.

There are several modules intended to help you write parsers.

MJD has written a LALR(1) parser generator -- actually a sort of Perl
backend for Bison -- called "py", which is available at
http://www.plover.com/~mjd/perl/py/.  This sort of thing is ideal if
you have an LALR(1) grammar for Ada handy.  (My copy of
MIL-STD-1815A-1983 has a BNF syntax for Ada on pages E-1 through E-6.
I don't imagine it would be too difficult to type it in in bison format
and get a workable parser, although I don't really know.  Of course,
this is Ada 1983, not Ada95.)

There are also Parse::Lex, Parse::RecDescent, and Parse::Yapp.  They
all sound like they might be helpful to you (although not all at once
-- you probably don't want to use py, Yapp, and RecDescent in the same
parser :)

HTH.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Fri Oct 08 1999
32 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Sat, 09 Oct 1999 01:59:14 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: matching
Message-Id: <SjxL3.10095$eM4.666159@typ11.nn.bcandid.com>

In article <7tm2kq$fa7$1@nnrp1.deja.com>,  <jimmyory@my-deja.com> wrote:
>I am writing a script that is logging information
>to a a file.  I then open this file and find how
>many times a certain address is in the file.  How
>can i put the number of times matches and set it
>to a number

my $count = 0;
while (<FILE>) { ++$count if /$certain_address/o; }
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Fri Oct 08 1999
32 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Fri, 08 Oct 1999 22:44:04 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Overkill of warnings in module
Message-Id: <UsuL3.9470$eM4.629768@typ11.nn.bcandid.com>

In article <37FE6F3B.D06D7C7E@mail.cor.epa.gov>,
David Cassell  <cassell@mail.cor.epa.gov> wrote:
>[someone else wrote:]
>> Is there a way to turn these warnings of locally?
>
>Yes.  You can do this:
>
>$^W = 0;
>         # lines of troublesome code go here
>$^W = 1;


You might be better off with local $^W = 0, which has the advantage of
(a) not turning -w on after the troublesome code if it was off
previously, and (b) not allowing you to forget to restore $^W.  For
example:

#!/usr/bin/perl -w
use strict;
my $x;
print "$x\n";   # produces warning
{
  local $^W = 0;
  print "$x\n"; # produces no warning
}
print "$x\n";   # produces warning

which looks like this:
kirk:/home/kragen/ perl tmpscript
Use of uninitialized value at tmpscript line 4.


Use of uninitialized value at tmpscript line 9.

kirk:/home/kragen/
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Fri Oct 08 1999
32 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: 08 Oct 1999 21:23:29 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: parenthesizing arguments to grep - BLOCK form
Message-Id: <x74sg1nx7y.fsf@home.sysarch.com>

>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:

  LR> The following all work equally well, interpreting the first argument as 
  LR> a filehandle regardless of the parentheses:

  LR> print STDOUT 'foo', 'bar';

  LR> print STDOUT ('foo', 'bar');

  LR> print (STDOUT 'foo', 'bar');

  LR> print(STDOUT 'foo', 'bar');

  LR> But 'grep BLOCK LIST' works differently.  Bug?

  >> so only the second one is odd as it is not a legal list in parens and it
  >> is not a function syntax. somehow that is converted into the first
  >> version in the parser.

  LR> perlsyn says "Perl is, for the most part, a free-form language. (The 
  LR> only exception to this is format declarations, for obvious reasons.)"

and of course pod too.

  LR> The response by the original poster reads:  "I never thought of putting 
  LR> a space before the opening parenthesis.  Must be some deep heuristic 
  LR> magic going on here."  What might that be?  Bug?

  LR> Earlier today, you chomped on a newbie for yelling 'Bug?'.  Now bite on 
  LR> me.
 
nah, because you checked the docs, showed working and non-working code
and obviously did your homework. also you didn't yell bug in the subject
even after you found it (or the original poster found it and you
examined it more closely). i would call this some sort of parsing bug
but not a fatal one in any case. report it to perlbug or p5p and let
them have at it. i bet someone there is into these. ronald's super
spaceship on FWP is also an odd parsing bug. so only perl parses perl,
and even it doesn't do it correctly (for some values (not ansi!) of
correct).

uri


-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Fri, 08 Oct 1999 15:20:14 -0700
From: Brian Craft <bcboy@cisco.com>
Subject: perl headers, setsockopt, multicast
Message-Id: <37FE6E1E.5E70360E@cisco.com>

Hi all --

I was just trying to set up a multicast socket & ran into the problem
that
IP_ADD_MEMBERSHIP was undefined. It shows up in netinet/in.ph, but
a "require 'netinet/in.ph'" totally futzes up Socket.pm. A bunch of
stuff ends
up redefined & the script recurses to death.

How are constants like this supposed to be handled? Why is Socket.pm
conflicting with the Perl header files? Are the header files there to be
used, or
merely left over arcana? Shouldn't Socket.pm include the multicast
options?

My current bogus workaround is to avoid the offending redefines, like
so:

sub _ASM_SOCKET_H {};
sub __BITS_SOCKET_H{};
require 'netinet/in.ph';

This can't be good.

b.c.



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

Date: Fri, 08 Oct 1999 17:49:01 -0400
From: David Wozmak <dwozmak@rational.com>
Subject: Re: Possible to Protect Code??
Message-Id: <37FE66CD.7E5916E1@rational.com>



vivekvp wrote:
> 
> Hello,
> 
> I have a perl script that has variables to set up at the top of the
> script.  Then there is a section that states it is not to be changed -
> changing data might cause the script not to function.  All I am trying
> to do is change the spelling of a couple of words with in html brackets
> <>  ie.  favor can be changed to favour.  when i upload the script -
> reset the permissions - i get an internal 500 premature end of headers 0
> but when i re upload the script - changing the word 'favour' back to
> favor - it works!

Actually...this sounds like a funny thing... is it possible that the
original programmer was SO WORRIED about a certain block of code being
changed that he possibly actually CHECKS the source using a checksum or
something like that, along with a subroutine that will DIE if the
checksum don't sum...?

> 
> is it possible to protect code against modification?  

sure it is.  Code can be set up to read itself, do a checksum or some
other function on the text of the source, compare it to a known value,
tank if it's different.

It would be pretty easy to get around...all you'd have to do is disable
the checksum sub by eviscerating it. A good programmer could obfuscate
the code to make it hard to find...

Try changing "favour" to "favo r" and see if that works.  If so, he's
probably just checking the length, and no checksum is involved.  


The second possibility is that he's put in a "Content-Length: ..." line,
with a specific content length hard-coded in.  If you see a line that
says:

print "Content-Length: ...<some number>";

then delete it, and try that.

it look like plain
> text to me - but all the code that should not be altered is bunched
> together - no spaces or separation by lines...

post it here.

sounds like a sorry attempt at obfuscation.


> 
> any help - please email.

nope -- read it here!

dwoz


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

Date: Fri, 08 Oct 1999 18:28:36 -0700
From: David Amann <dove@synopsys.com>
Subject: Re: Sending mail with Perl?
Message-Id: <37FE9A43.EE313536@synopsys.com>

Hi Phillip,

Unigni wrote:

> What's the easiest way to make a Perl program (for Windows, using
> ActivePerl) that can send an e-mail?

For Windows, the easiest way I can think of is to use the Mail::Mailer
module and use the 'smtp' option.

Here's a quick script I wrote that might help you.

Hope this helps,
-=dav

#!perl -w

# Author: David Amann
# Version: 1.0

use strict;           # Always use strict
use Mail::Mailer;     # Import the Mail::Mailer module

my $smtp_server  = "mailhost.synopsys.com";
my $from         = "dove\@synopsys.com";
my $to           = "dove\@synopsys.com";
my $subject      = "Testing A Mail Program";
my $body         = "This is the body\n";

my $mailer = new Mail::Mailer ("smtp", $smtp_server);

$mailer->open({ From      => $from,
                To        => $to,
                Subject   => $subject,
        })
  or die "Can't open: $!\n";

print $mailer $body;
$mailer->close();



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

Date: Fri, 08 Oct 1999 18:03:19 -0700
From: David Amann <dove@synopsys.com>
Subject: Re: sendmail problem
Message-Id: <37FE9457.88E79441@synopsys.com>

Hi Robert,

Robbertc wrote:

> i have a problem with sendmail. I've written this piece of code and it works
> on my linux machine (with apache running on it).
> Whenever i upload the script to my ISP and run it, nothing happens. I'm sure
> the path is correct and i can use sendmail... so i guess there must me some
> kind of error i'm overlooking...

You might try using the Mail::Mailer module from CPAN.  I haven't used it
myself, but from the Perl Cookbook, by T. Christiansen and N. Torkingten:

      "When Mail::Mailer is installed, it looks for mail, Mail, and other
     names mail-sending programs tend to hide under.  It also looks in
     common locaitons for sendmail.  When you create a Mail::Mailer object,
     you get convenient access to those programs (and SMTP mail servers)
     without needing to know their aurgment structure or how they return
     errors."

Here's a quick example on how to use the Mail::Mailer (again from the Perl
Cookbook).

use Mail::Mailer;

$mailer = Mail::Mailer->new();
$mailer->open({ From    => $from_address,
                To      => $to_address,
                Subject => $subject,
               })
     or die "Can't open: $!\n";
print $mailer $body;
$mailer->close();

Hope this helps,
-=dav




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

Date: Sat, 09 Oct 1999 01:28:58 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: sendmail problem
Message-Id: <uTwL3.10051$eM4.657062@typ11.nn.bcandid.com>

In article <7tm2eu$4f3$1@rguxd.viasystems.com>,
lt lindley  <lee.lindley@bigfoot.com> wrote:
>Welcome back Kragen.  Been on holiday?

Rather the reverse -- been busy at work, got a new dog, and just busy
all around.  Thanks for asking!

>// Lee.Lindley   /// I used to think that being right was everything.
>// @bigfoot.com  ///  Then I matured into the realization that getting
>////////////////////   along was more important.  Except on usenet.

Heh.  :)
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Fri Oct 08 1999
32 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Sat, 09 Oct 1999 00:23:32 +0200
From: Florian Arndt <arndt@arweb.de>
Subject: Server-Push Script
Message-Id: <37FE6EE4.AB4A5A3D@arweb.de>

Hi there,

I've got a little problem with a server-push script. I extracted it with
gzip and tar as usual under linux and it worked so far. But when I just
copied it and chmodded it to 755 it didn't work anymore. The script
looks like this:

#!/usr/bin/perl
print "$ENV{'SERVER_PROTOCOL'} 200 OK\n";
print "Server: $ENV{'SERVER_SOFTWARE'}\n";
print "Content-type: text/plain\n\n";
@words = ("This", "is", "a", "test"); $| = 1;
for ($loop = 0; $loop <= @words; $loop++) { print "$words[$loop]\n";
sleep (1); }

Pleeeease help me!

Thx in advance, Florian



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

Date: Sat, 09 Oct 1999 01:27:33 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Shell and Perl have different $?
Message-Id: <9SwL3.10049$eM4.660219@typ11.nn.bcandid.com>

In article <37fe7446.206902768@news.iprolink.ch>,
Sam Carmalt <scarmalt@swconsult.ch> wrote:
>I'v re-read that, and also the documentation for $?.  Both imply that
>the return value of $ia = system("something") will be set to the
>return value of something.  The documentation of $? implies that it
>will be set to the return value of whatever system() calls.

From the documentation of $?:

	     Note that this is the status word returned by the wait()
	     system call (or else is made up to look like it).  Thus,
	     the exit value of the subprocess is actually ($? >> 8),
	     and $? & 127 gives which signal, if any, the process died
	     from, and $? & 128 reports whether there was a core dump.

In other words, if you want the command's exit status -- what you get
with sh or csh $? -- you want ($? >> 8) in Perl.

>  Now I can
>speculate that going via the shell or not (by breaking the system
>arguments into multiple parts on not) would cause either one or the
>other of these tests to miss 'seeing' the error, but I still don't
>understand why BOTH the return value from system() and the $? variable
>fail to record the difference between success and failure.

I can't understand this either.  Are you saying the value you get in $?
is the same, no matter what status the command exits?  I'd be tempted
to speculate your Perl or your kernel is broken.

>This is obvious to you, but it still isn't to me; I'm hoping that
>someone can perhaps explain it in words different from the
>documentation so that I can understand it.

It isn't obvious to me either.

HTH.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Fri Oct 08 1999
32 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Fri, 8 Oct 1999 18:48:57 -0700
From: "David Christensen" <dchristensen@california.com>
Subject: Re: Shell and Perl have different $?
Message-Id: <37fe9b9e_6@news5.newsfeeds.com>

Sam:

I put my args for system() into a variable so I can see it.  Also,
try looking at $! just in case:


    my $line = "rcp $file_to_copy
user\@machine:/path/$file_remote";
    print "\$line = $line" if $debug;

    $ia = system($line);
    print "$ia = $ia   \$? = $?   \$! = $!\n" if $debug;


I think your bug is with the double quotes acting on \@ and $ --
try  "\\\@" and "\$" or '\\@' and '$'.


HTH,

--
David Christensen
dchristensen@california.com



Sam Carmalt wrote in message
<37fe1815.183298863@news.iprolink.ch>...
>I have a working script which does a remote copy.
>
>$file_to_copy = "file.x";
>$file_remote = "somedir/copy.x";
>system("rcp $file_to_copy user\@machine:/path/$file_remote");
>
>We recently decided that it would be good to know if this was
>successful (the most likely cause of failure being that the remote
>file system is not found).  At the shell
>
>>rcp file.x user@machine:/path/somedir/copy.x
>>echo $?
>
>returns 0 with success, and 1 with failure (due to setting somedir
to
>a non-existant value).  But the perl script statments
>
>$ia = system("rcp $file_to_copy
user\@machine:/path/$file_remote");
>print "\$? = $?      \$ia = $ia \n";
>
>Gives values of 0 both when the rcp works and when it doesn't.
>
>Have I missed something obvious?
>
>Thanks and regards
>




  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Fri, 08 Oct 1999 22:55:22 GMT
From: scarmalt@swconsult.ch (Sam Carmalt)
Subject: Re: Shell and Perl have different $?
Message-Id: <37fe7446.206902768@news.iprolink.ch>

Tom Briles <sariq@texas.net> wrote:

>Sam Carmalt wrote:
>> 
>> But the perl script statments
>> 
>> $ia = system("rcp $file_to_copy user\@machine:/path/$file_remote");
>> print "\$? = $?      \$ia = $ia \n";
>> 
>> Gives values of 0 both when the rcp works and when it doesn't.
>> 
>> Have I missed something obvious?
>
>Yes.  The documentation for 'system'.

I'v re-read that, and also the documentation for $?.  Both imply that
the return value of $ia = system("something") will be set to the
return value of something.  The documentation of $? implies that it
will be set to the return value of whatever system() calls.  Now I can
speculate that going via the shell or not (by breaking the system
arguments into multiple parts on not) would cause either one or the
other of these tests to miss 'seeing' the error, but I still don't
understand why BOTH the return value from system() and the $? variable
fail to record the difference between success and failure.

This is obvious to you, but it still isn't to me; I'm hoping that
someone can perhaps explain it in words different from the
documentation so that I can understand it.

Thanks and regards



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

Date: 08 Oct 1999 21:27:04 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Ubi nil vales...  1603   [1/2]
Message-Id: <x7zoxtmihj.fsf@home.sysarch.com>

>>>>> "s" == scwdbw  <scwdbw@rec.uk> writes:

  s> If you feel, that you are absolutely happy, totally satisfied with
  s> your accomplishments and your energy level is on the top, please,
  s> disregard this mail......

  s> ....Otherwise, you may want to spend a few minutes reading the
  s> attached letter and find something that could be very helpful to
  s> you !


  s> zbhlwqbyfhpbwreffrromtuifgzcbiyytpdkouvtmpfphzpwjqkpeprmkhnkirjhct

very interesting. i want to buy it or send you all my money and
savings. where do i send my loot?


anyone else notice this new breed of usenet spam? the subjects all seem
to have a integer in them which changes from group to group. also the
body always contains some gibberish string which changes. fortunaetly
many don't even have real content. it feels like someone is marketing a
counter spam operation given the past history of spam filters on
usenet. i bet the usenet masters know about this but some are still
getting thru like this one. if anyone knows the usenet masters please
relay this to them.

die spammers die!!

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: 9 Oct 1999 01:12:51 GMT
From: lt lindley <ltl@rgsun40.viasystems.com>
Subject: Re: Using a regexp in an index function, can it be done?
Message-Id: <7tm4qj$545$1@rguxd.viasystems.com>

Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
:>[A complimentary Cc of this posting was sent to Rick Delaney 
:><rick.delaney@home.com>],
:>who wrote in article <37FD3E41.6A05DD1F@home.com>:
:>> And if it needs those quantifiers you can so something like
:>> 
:>>     /($pattern)/g; # Add 'o' modifier if $pattern never changes
:>> 
:>>     print pos() - length $1, "\n";

:>pos = 0;

The above line is here why?  Since you normally have to go to lengths
to avoid a reset of pos, I think we can chalk it up to defensive
programming.

:>/(?=$pattern)/g;
:>print pos;

Otherwise, game, set, match, Zakharevich.

-- 
// Lee.Lindley   /// I used to think that being right was everything.
// @bigfoot.com  ///  Then I matured into the realization that getting
////////////////////   along was more important.  Except on usenet.


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

Date: 9 Oct 1999 01:50:52 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Using a regexp in an index function, can it be done?
Message-Id: <7tm71s$ddk$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to lt lindley 
<lee.lindley@viasystems.com>],
who wrote in article <7tm4qj$545$1@rguxd.viasystems.com>:
> :>pos = 0;
> 
> The above line is here why?  Since you normally have to go to lengths
> to avoid a reset of pos, I think we can chalk it up to defensive
> programming.
> 
> :>/(?=$pattern)/g;
> :>print pos;

Of course, it is better to rewrite it as

  {
    local pos;
    /(?=$pattern)/g;
    print pos;
  }

However, I do not remember whether C<local pos $string> actually works.

And: if you are not back in time a lot, you may use $-[0] as well.
Btw, I have no idea why it is so hideously slow...

Ilya


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

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


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