[16789] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4201 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 1 14:15:41 2000

Date: Fri, 1 Sep 2000 11:15:29 -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: <967832128-v9-i4201@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 1 Sep 2000     Volume: 9 Number: 4201

Today's topics:
        PerlMagick Compile Errors/ ASAPIMagick d_gaudreault666@my-deja.com
        print before exec <bachelart.pierre@skynet.be>
        Problem running perl script as owner alesmith@my-deja.com
        problem with system call [was: Blat guru please !?!] <elephant@squirrelgroup.com>
    Re: Q. relating to  perlfaq(4) / sort <ren.maddox@tivoli.com>
    Re: Regular Expression Help <godzilla@stomp.stomp.tokyo>
    Re: Regular Expression Help <dangerar@my-deja.com>
        Sun Solaris Serial Port Question <liuels@usa.alcatel.com>
    Re: using unix commands within perl script <mattbee@soup-kitchen.net>
    Re: using unix commands within perl script <elephant@squirrelgroup.com>
    Re: using unix commands within perl script <E.L.Stoten@ncl.ac.uk>
    Re: using unix commands within perl script <justin.flavin@ntlworld.com>
    Re: using unix commands within perl script <elephant@squirrelgroup.com>
    Re: using unix commands within perl script (Abigail)
        working out signatures (matt venn)
    Re: working out signatures <peckert@epicrealm.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 01 Sep 2000 15:19:49 GMT
From: d_gaudreault666@my-deja.com
Subject: PerlMagick Compile Errors/ ASAPIMagick
Message-Id: <8oohds$nuh$1@nnrp1.deja.com>

I have tried to compile PerlMagick 5.2.2 and 5.2.3 under win-2k.
However, It keeps asking for the Imagick.dll. I have all the sources
for both ImageMagick and PerlMagick and neither seem to build this DLL.
Can anybody give me a pointer regarding this perplexing problem?


Also, I have seen an ASAPI shim in the filters directory. This may
provide the functionality that I require. I was wondering if anyone
knows how to use it?

Thanks,
Dan Gaudreault


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


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

Date: Fri, 1 Sep 2000 19:27:47 +0200
From: "tuple" <bachelart.pierre@skynet.be>
Subject: print before exec
Message-Id: <8ooota$iof$1@news0.skynet.be>

#!/usr/bin/perl !
some code
  ...
  ...
print "hello\n";
exec("another perl program");   # last line of my script

When i start this in a cron i don't see the result of the print
statement.  Any idea ?
If i replace exec by system i have no problem but i don't
like this solution.

Piere Bachelart.




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

Date: Fri, 01 Sep 2000 17:28:38 GMT
From: alesmith@my-deja.com
Subject: Problem running perl script as owner
Message-Id: <8ooovd$1c2$1@nnrp1.deja.com>

I'm having problem executing perl scripts that have the
set-user-ID-on-execution bit set through Apache and at the command
line.  For example:

When I try and execute a perl script at the command line as root with
the set-user-ID-on-execution bit set,

-rwsr-xr-x   1 root  wheel    718     Aug 21 20:02     checklogin.pl

the script works given three valid inputs, the location of the password
file, a valid username, and a valid password.  When I su to http and
execute the script wth the same three inputs it fails to open the passwd
file and exits at the 11th line,

--cut--
        open (PASSWD, $passwdfile) or exit 1;
--cut--

Why is an executable file that is set to run as the owner, root, unable
to open the master.passwd file?  This works on other machines with
FreeBSD and Linux(using shadow instead of master.passwd) and doesn't
work on this machine.  FreeBSD 2.2.8 w/ Apache 1.3.12 w/ Perl 5.6.0.  Am
I using the set-user-ID-on-execution bit correctly?

Here is the script described above.
--------------------
#!/usr/bin/perl -T

my ($username, $password, $usr, $pswd, $passwdfile);
my $passcorrect = 0; # default to correct, set incorrect when determined

my $line;
chomp($passwdfile = <STDIN>);
chomp($username = <STDIN>);
chomp($password = <STDIN>);

if ( $passwdfile && $username && $password ) {
   open (PASSWD, $passwdfile) or exit 1;
   print ("passwd openned", "\n");                  # added for testing
   while (defined($line = <PASSWD>)) {
      ($usr,$pswd) = (split(/:/, $line))[0,1];
      last if ($usr eq $username); # We've found the user in /etc/passwd

   }
   close (PASSWD);
   if (($usr ne $username) or (crypt($password, $pswd) ne $pswd)) {
      $passcorrect = 1; # User/Pass combo is WRONG!
   }
} else {
   $passcorrect = 1;
}
print ($passcorrect, "\n");                             # added for
testing
exit $passcorrect;


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


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

Date: Fri, 01 Sep 2000 15:25:40 GMT
From: jason <elephant@squirrelgroup.com>
Subject: problem with system call [was: Blat guru please !?!]
Message-Id: <MPG.141a67eea5b440b7989743@localhost>

James R <reevehotNOSPAM@hotmail.com> wrote ..
>I am trying to port a unix form-mail script to my host's NT machine. They
>use Blat V 1.8.4 if that helps.
>
>The script works fine in writing the form's data to a temporary file (I can
>see and read the file in my FTP box), but it fails to send anything. Here's
>the excerpt I think is failing...
>
>   # If we're running under Windows, we actually send mail here...
>   if ($SERVER_OS eq "WIN") {
>     $WIN_TEMPFILE =~ s/\//\\/g;
>     $mailprog =~ s/\//\\/g;
>     $BLAT_ARGS = "$WIN_TEMPFILE -t $CONFIG{'recipient'}";
>     $BLAT_ARGS .= "-f $CONFIG{'email'} " if defined($CONFIG{'email'});
>     $BLAT_ARGS .= "-q";
>     system "$mailprog $BLAT_ARGS";

just replace your 'system' call here with a 'print' call to see what's 
actually being executed by 'system' .. then change your Perl code so 
that it reflects the command line that you use out in the shell to 
successfully send the mail

  [ subject adjusted from one that looks completely off topic ]

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: 01 Sep 2000 09:37:50 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Q. relating to  perlfaq(4) / sort
Message-Id: <m34s4041q9.fsf@dhcp11-177.support.tivoli.com>

Ren Maddox <ren.maddox@tivoli.com> writes:

> I read through this again (though I didn't go through the slides
> again), and I didn't see anything about arbitrary length signed
> "string" numbers.  I suppose it would be simple to just make it a
> two-key sort.  Sort by sign, then by magnitude.  Throwing in decimal
> places would, I suppose, necessitate either some clever handling to
> get the length right, or simply split the fractional portion into a
> third key.

Silly me... as long as you get the length right (which may be tricky),
the fractional portion should take care of itself (assuming you stick
a trailing null in before the original data).

> Nope, not good enough... negative values need to be reverse sorted by
> magnitude.  Perhaps preprocessing into two lists, one for negative
> values and one for non-negative values.  Sort both lists and then just
> combine them.

-- 
Ren Maddox
ren@tivoli.com


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

Date: Fri, 01 Sep 2000 08:05:30 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Regular Expression Help
Message-Id: <39AFC5BA.68487733@stomp.stomp.tokyo>

dangerous dan wrote:

 
> OK, guys I've R'd TFM till blue,

Highly unlikely.


>  but can't figure this out.

Highly likely.


> Following is a working perl program (5_004 on OS/390 USS).

No, it is a non-working program per your parameters.


> eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
> if 0;
> # testpl.pl - perl test case
> $_ = "/aaaa/bbbb/cccc/dddd.snork";
> $lev = 2;
> for ($i = $lev; $i >= 0; $i--) {
>   s#(.*)/.*?#$1#;
>   print "DIR: $_\n";
>   print "DL1: $1\n";
> }


> DIR: /aaaa/bbbb/ccccdddd.snork
> DL1: /aaaa/bbbb/cccc
> DIR: /aaaa/bbbbccccdddd.snork
> DL1: /aaaa/bbbb
> DIR: /aaaabbbbccccdddd.snork
> DL1: /aaaa

> From reading, I expected $_ and $1 to contain the same value.
> $1 is as expected, but $_ is not.


> What am I missing?

It is what should be missing.



TEST SCRIPT:
____________


#!/usr/local/bin/perl

print "Content-Type: text/plain\n\n";


print "Incorrect Syntax:\n\n";

$_ = "/aaaa/bbbb/cccc/dddd.snork";
$lev = 2;
for ($i = $lev; $i >= 0; $i--) {
  s#(.*)/.*?#$1#;
  print "DIR: $_\n";
  print "DL1: $1\n";
}


print "\n\nCorrect Syntax:\n\n";

$_ = "/aaaa/bbbb/cccc/dddd.snork";
$lev = 2;
for ($i = $lev; $i >= 0; $i--) {
  s#(.*)/.*#$1#;
  print "DIR: $_\n";
  print "DL1: $1\n";
}


print "\n\n\nGodzilla Rocks!\n--\n",
      "Stereotypical Perl Monger.\n",
      "  http://la.znet.com/~callgirl/monger.cgi";

exit;


PRINTED RESULTS:
________________


Incorrect Syntax:

DIR: /aaaa/bbbb/ccccdddd.snork
DL1: /aaaa/bbbb/cccc
DIR: /aaaa/bbbbccccdddd.snork
DL1: /aaaa/bbbb
DIR: /aaaabbbbccccdddd.snork
DL1: /aaaa


Correct Syntax:

DIR: /aaaa/bbbb/cccc
DL1: /aaaa/bbbb/cccc
DIR: /aaaa/bbbb
DL1: /aaaa/bbbb
DIR: /aaaa
DL1: /aaaa



Godzilla Rocks!
--
Stereotypical Perl Monger.
  http://la.znet.com/~callgirl/monger.cgi


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

Date: Fri, 01 Sep 2000 15:28:20 GMT
From: dangerous dan <dangerar@my-deja.com>
Subject: Re: Regular Expression Help
Message-Id: <8oohtn$oei$1@nnrp1.deja.com>

Thanks! For whatever reason, I had ? confused with $.

Now s#(.*)/.*$#$1#; works, but strangely(?)
    s#(.*)/.*\z#$1#; doesn't (no substitution at all).

Care to answer that one?

In article <1egag50.1qbx2zi1r0brzsN@[192.168.88.117]>,
  sumus@aut.dk (Jakob Schmidt) wrote:
> dangerous dan <dangerar@my-deja.com> wrote:
>
> > for ($i = $lev; $i >= 0; $i--) {
> >   s#(.*)/.*?#$1#;
> >   print "DIR: $_\n";
> >   print "DL1: $1\n";
> > }
>
> the problem is that .*? matches as few chars as possible. In this case
> zero.
>
> using s#(.*)/.*?$#$1#; or s#(.*)/.*?\z#$1#; should change things.
>
> Jakob
> --
> $_="rka rPrhoatuJs nte elHce\n";0while[$s=-int.5
> -.5*length]&&s&(.{$s})(.)(.{$s})&$1$3&s&&print$2
>

--
dangerous dan
----------------------------------------------------------------------
Pretty sure that he's gonna like Perl a lot, once he gets the hang of it


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


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

Date: Fri, 01 Sep 2000 10:28:49 -0500
From: Elbert Liu <liuels@usa.alcatel.com>
Subject: Sun Solaris Serial Port Question
Message-Id: <39AFCB31.E7751525@usa.alcatel.com>


--------------791F8E28B0FB4526A5C2D115
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,

I am a little new in experimenting with com (serial) ports on Sun Spac 5
with sun OS 2.6. Is there any FAQ on this? I am trying to talk to a
device with RS-232c interface. Please help... Currently runing perl
5.6.0.

Any Help would be appreciated.

Thanks in advance,


--
Elbert Liu



--------------791F8E28B0FB4526A5C2D115
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi,
<p>I am a little new in experimenting with com (serial)&nbsp;ports on Sun
Spac 5 with sun OS 2.6. Is there any FAQ&nbsp;on this? I am trying to talk
to a device with RS-232c interface. Please help... Currently runing perl
5.6.0.
<p>Any Help would be appreciated.
<p>Thanks in advance,
<br>&nbsp;
<pre>--&nbsp;
Elbert Liu
</pre>
&nbsp;</html>

--------------791F8E28B0FB4526A5C2D115--



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

Date: Fri, 01 Sep 2000 16:23:42 +0000
From: "Matthew Bloch" <mattbee@soup-kitchen.net>
Subject: Re: using unix commands within perl script
Message-Id: <TRPr5.4761$WT1.104200@news2-win.server.ntlworld.com>

In article <39AFC0CD.4243F90@ncl.ac.uk>, Emma Stoten
<E.L.Stoten@ncl.ac.uk> wrote:
> I'm trying to use a unix command within a perl script:
> 
> system(`COMMAND`);
> 
> I've tried using all three types of quotes, and still it doesn't work
> when executed. The command works at the command line and -c and -w
> options don't shed any light. 
> 
> I've exhausted all other lines of enquiry and hope someone can offer
> some advice.

People could help you out much more easily if you posted the actual bit of
code that was going wrong; PS the quotes in the message above are
backticks and probably not what you want.

-- 
Matthew



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

Date: Fri, 01 Sep 2000 15:28:30 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: using unix commands within perl script
Message-Id: <MPG.141a6896debbaf04989744@localhost>

Emma Stoten <E.L.Stoten@ncl.ac.uk> wrote ..
>I'm trying to use a unix command within a perl script:
>
>system(`COMMAND`);

what does this COMMAND command do at the command prompt ? .. or didn't 
you show exactly what you're trying - and exactly what you're expecting 
it to do ?

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Fri, 01 Sep 2000 16:35:49 +0100
From: Emma Stoten <E.L.Stoten@ncl.ac.uk>
Subject: Re: using unix commands within perl script
Message-Id: <39AFCCD5.B4062840@ncl.ac.uk>

I want to use the line with several different commands but an example is
this

	system('dbappend -df+ projectdb <project.file');

which works fine at the command line. 

project.file, projectdb and the perl script are all in the same
directory

Emma Stoten


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

Date: Fri, 1 Sep 2000 16:46:41 +0100
From: "Justin Flavin" <justin.flavin@ntlworld.com>
Subject: Re: using unix commands within perl script
Message-Id: <8ooj2m$b3j$1@newsg3.svr.pol.co.uk>

The solution is to call the system command with a string , to have the shell
interpret the string as a command line
e.g.
$status = system("vi $myfile");

Note the use of double-quotes.

A more in-depth discussion of this is available in receipe 16.2 of the Perl
Cookbook

Justin Flavin.



Emma Stoten <E.L.Stoten@ncl.ac.uk> wrote in message
news:39AFC0CD.4243F90@ncl.ac.uk...
> I'm trying to use a unix command within a perl script:
>
> system(`COMMAND`);
>
> I've tried using all three types of quotes, and still it doesn't work
> when executed. The command works at the command line and -c and -w
> options don't shed any light.
>
> I've exhausted all other lines of enquiry and hope someone can offer
> some advice.
>
> Cheers,
> Emma Stoten




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

Date: Fri, 01 Sep 2000 16:59:07 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: using unix commands within perl script
Message-Id: <MPG.141a7dd542dd9db5989746@localhost>

Emma Stoten <E.L.Stoten@ncl.ac.uk> wrote ..
>I want to use the line with several different commands but an example is
>this
>
>	system('dbappend -df+ projectdb <project.file');
>
>which works fine at the command line. 

ok .. one more step .. how does it fail ? .. does it just not work ? .. 
or is there some error or another ? .. what does system return ?

  my $returnValue = system('dbappend -df+ projectdb <project.file');
  print "System returned: $returnValue\n";

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: 01 Sep 2000 17:27:55 GMT
From: abigail@foad.org (Abigail)
Subject: Re: using unix commands within perl script
Message-Id: <slrn8qvpn7.8ac.abigail@alexandra.foad.org>

Emma Stoten (E.L.Stoten@ncl.ac.uk) wrote on MMDLVIII September MCMXCIII
in <URL:news:39AFCCD5.B4062840@ncl.ac.uk>:
__ I want to use the line with several different commands but an example is
__ this
__ 
__ 	system('dbappend -df+ projectdb <project.file');
__ 
__ which works fine at the command line. 
__ 
__ project.file, projectdb and the perl script are all in the same
__ directory


Do you get any errors? What is your $ENV {PATH}? What is the value of $?
afterwards? What happens if you do

   	system('./dbappend -df+ projectdb <./project.file');

Is the program in the directory you think it is?



Abigail
-- 
sub _ {$_ = shift and y/b-yB-Y/a-yB-Y/                xor      !@ _?
       exit print                                                  :
            print and push @_ => shift and goto &{(caller (0)) [3]}}
            split // => "KsvQtbuf fbsodpmu\ni flsI "  xor       & _


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

Date: Fri, 01 Sep 2000 17:37:44 GMT
From: matt@cipherdesign.com (matt venn)
Subject: working out signatures
Message-Id: <39afe85e.28873698@news.ntlworld.com>

hey all,

im trying to work out one of abigail's signatures, but im getting
nowhere.

im sure i read in a post to this newsgroup details on how to get perl
to show you what is has parsed the script to. this would help me out,
as i dont even understand how this particular script is parsed.

ive checked out the switches you can supply perl with, but nothing
strikes me as useful in this case. or do i need the debugger?

the particular signature im working on is:

perl  -e '$_ = q *4a75737420616e6f74686572205065726c204861636b65720a*;
          for ($*=******;$**=******;$**=******) {$**=*******s*..*qq}
          print chr 0x$& and q
          qq}*excess********}'

thanks, matt


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

Date: Fri, 01 Sep 2000 17:53:46 GMT
From: Paul Eckert <peckert@epicrealm.com>
Subject: Re: working out signatures
Message-Id: <39AFED51.F39B02E@epicrealm.com>


matt venn wrote:
> 
> im trying to work out one of abigail's signatures, but im getting nowhere.

That's my problem, too.
 
> the particular signature im working on is:
> 
> perl  -e '$_ = q *4a75737420616e6f74686572205065726c204861636b65720a*;
>           for ($*=******;$**=******;$**=******) {$**=*******s*..*qq}
>           print chr 0x$& and q
>           qq}*excess********}'
> 

I dunno.  
This one seems to be missing things.  It doesn't run on my Solaris 2.7 box,
either.
Are you sure you cut-n-pasted the entire signature?  Abigail's are usually
flawless.

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


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