[16551] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3963 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 9 11:10:28 2000

Date: Wed, 9 Aug 2000 08:10:18 -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: <965833817-v9-i3963@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 9 Aug 2000     Volume: 9 Number: 3963

Today's topics:
    Re: Problem with Net::Telnet jpalloz@my-deja.com
    Re: reg expressions - protect html (Keith Calvert Ivey)
    Re: Running other programs in background wutang_warrior@my-deja.com
    Re: setuid root perl script (Robert Hallgren)
    Re: Simple reg expression question (Keith Calvert Ivey)
        sorting problem! output should be (a A aA AA). <eknaap@lucent.com>
    Re: sorting problem! output should be (a A aA AA). (Anno Siegel)
    Re: sorting problem! output should be (a A aA AA). (Greg Bacon)
    Re: sorting problem! output should be (a A aA AA). <abe@ztreet.demon.nl>
        use strGlobal symbol "$YP_D"use strict" error message <jhijas@yahoo.es>
    Re: Using Bit::Vector for large hex-number arithmetic <sb@muccpu1.muc.sdm.de>
    Re: Using Bit::Vector for large hex-number arithmetic <sb@muccpu1.muc.sdm.de>
    Re: Using Bit::Vector for large hex-number arithmetic (Anno Siegel)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 09 Aug 2000 14:00:35 GMT
From: jpalloz@my-deja.com
Subject: Re: Problem with Net::Telnet
Message-Id: <8mro61$m3q$1@nnrp1.deja.com>

In article <39912ea0$1@news.datev.de>,
  "Guenther Degenfelder" <guenther.degenfelder@datev.de> wrote:
>
> <jpalloz@my-deja.com> schrieb im Newsbeitrag
> news:8mq02o$iuv$1@nnrp1.deja.com...
> > I need to use Net::Telnet to telnet into a propeitary database
> > interface, similiar to sqlplus.
> >
> > The idea is to telnet into this database from an outside perl/cgi,
> > and then either create new records or update existing ones.
> >
> > The problem is this particular interface has no prompt. The cursor
> > simply blinks at the beginning of the line waiting for you to issue
> > your commands.
>
> The login-method is waiting for the prompts 'user:' and 'password:'
(or
> seomething else?!) and then prints the UserID and Password. This is
done
> with
>     $t->waitfor('/user:/');
>     $t->print($UserID);
>     $t->waitfor('/password:/');
>     $t->print($Password);
>
> If you have problems with YOUR shape of prompts, you have to another
>     $t->waitfor('/something else/');
>     $t->print($UserID);
>     ...
>
> But be careful:
> Don't send your $Password to unknown prompts!    ;-)
>
>     Guenther
>
>

Guenther,

Thank you for the response. The login/password stuff doesn't have any
prompt, like $user: $password: , as a matter of fact as I stated earlier
in my message there is no prompt in this database interface. The cursor
simply blinks at the far left spot on the line, and I actually think
this is the crux of all my problems. This Telnet module seems to be very
dependent, from the doc I've read, on having some kind of discernable
prompt to work with. Anyway, do you have any more suggestions. I've
tried using the double carriage return as a prompt because that signals
the end of a command in this database interface, but that has not worked
either.

Any help would be greatly appreciated.

Thanks,

John P.


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


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

Date: Wed, 09 Aug 2000 13:28:38 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: reg expressions - protect html
Message-Id: <39935a4c.39641942@news.newsguy.com>

Stephen Kloder <stephenk@cc.gatech.edu> wrote:

>I've noticed that many here advocate using a(n?) HTML moule to parse this.
>But it can be done without one, without getting too ugly:

Only if you make assumptions that may come back to bite you
later.  Your solution assumes that no < is ever outside a tag
and no > is ever inside a tag.  Many things will confuse your
program: sections of commented-out HTML, occurrences of > within
attribute values, < (followed by whitespace) in text, < and > in
JavaScript.  Read the FAQ.

By the way, "an HTML module" is correct.  Unless you pronounce
"HTML" as "hitmull", it starts with a vowel *sound*.  The choice
of "a" or "an" is determined by pronunciation, not spelling.
(Well, perhaps I'm being parochial.  There are people in Ireland
-- and elsewhere? -- who say "haitch-tee-em-ell".)

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC


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

Date: Wed, 09 Aug 2000 12:55:03 GMT
From: wutang_warrior@my-deja.com
Subject: Re: Running other programs in background
Message-Id: <8mrkb6$jf1$1@nnrp1.deja.com>

Hello.

The thing  is that it's an AT job, I really wanna put everything inside
the script and let it dynamically generate an output filename based on
what I want. The code runs fine, how do I capture what's going to the
console into a $var ?




In article <bsv1ps4jpq8utebl5868bnl6s4flstggk6@4ax.com>,
  Bart Lateur <bart.lateur@skynet.be> wrote:
> wutang_warrior@my-deja.com wrote:
>
> >How do I capture the output of the program (cmdline utility) to a
$var
> >or do it like above?
>
> Well, the usual trick is to shell a command line, by launching your
> shell with a special option indication "just this line", and the
command
> following it.
>
> On WIN95/98, that command line shell is still command.exe, a legacy
from
> DOS (yes, it's the DOS prompt). Using the "/c" option, plus your
actual
> command line, you can run just one command line. (n.b. "/k" does the
> same without closing the shell afterwards.)
>
> Example: click on "Run" in the Start menu, and type:
>
> 	command /c perl -v >c:\perlversion.txt
>
> Too bad that the shell's name is different on NT. ("cmd.exe", IIRC)
>
> --
> 	Bart.
>


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


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

Date: Wed, 09 Aug 2000 13:26:10 GMT
From: sandhall@swipnet.se (Robert Hallgren)
Subject: Re: setuid root perl script
Message-Id: <slrn8p2mgi.vk.sandhall@poetry.lipogram>

On Wed, 09 Aug 2000 10:16:51 GMT,
 bolero92@my-deja.com <bolero92@my-deja.com> wrote:

> I am writing a CGI script to change user e-mail forwarding configuration
> which will copy /etc/mail/aliases.save to /etc/mail/aliases and run
> "/usr/bin/newaliases"
> 
> but the script can't run successfully and the error log shows:
> Insecure $ENV{PATH} while running setuid at /dev/fd/3 line 61, <FILE2>
> chunk 133.
> 
> Why?

You should have a look at 'perldoc perlsec' before trying to do anything
setuid. The answer to your question is right in the beginning, second
paragraph:

  Perl automatically enables a set of special security checks, called
  taint mode, when it detects its program running with differing real and
  effective user or group IDs.

The answer to how to deal with this is also there.

Also be aware of a recently discovered suidperl-vulnerability. Maybe you
should even consider a C wrapper rather than running suidperl.

<URL: http://www.securityfocus.com/bid/1547 >


Robert
-- 
Robert Hallgren <sandhall@swipnet.se>

PGP: http://www.lipogram.com/pgpkey.asc
5F1E 95C2 F0D8 25A3 D1BE 0F16 D426 34BD 166A 566C


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

Date: Wed, 09 Aug 2000 13:14:03 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Simple reg expression question
Message-Id: <3992589c.39210539@news.newsguy.com>

Bart Lateur <bart.lateur@skynet.be> wrote:
>Kenny Lim wrote:
>
>>(b) The total given value to be incremented exceeded 9.
>>(ie. $2 = 9, current value is ETProj99, the outcome result would be 918
>>where it should be 108)
>
>Eh? So you jump from version 9.9 to 10.8?

Yeah, this whole idea of incrementing the major version while
leaving the minor version alone seems screwy in the extreme.
Under what conditions would you want to go from, say, version
2.26 to 3.26?  Shouldn't incrementing the major version reset
the minor version?

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC


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

Date: Wed, 09 Aug 2000 15:04:36 +0200
From: Erik van der Knaap <eknaap@lucent.com>
Subject: sorting problem! output should be (a A aA AA).
Message-Id: <399156E3.ECA637C5@lucent.com>

Folks,

I want to sort a list in a special way. I want to sort an abbreviation list.
@unsorted = qw(AA AAA aA a B C d E dD);

And I want the output as:
a aA AA AAA B C d dD E

Is there a nice way to do that?

Regards,
Erik


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

Date: 9 Aug 2000 13:29:31 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: sorting problem! output should be (a A aA AA).
Message-Id: <8mrmbr$3et$1@lublin.zrz.tu-berlin.de>

Erik van der Knaap  <eknaap@lucent.com> wrote in comp.lang.perl.misc:
>Folks,
>
>I want to sort a list in a special way. I want to sort an abbreviation list.
>@unsorted = qw(AA AAA aA a B C d E dD);
>
>And I want the output as:
>a aA AA AAA B C d dD E

Oh please!  If you want help with a problem, invest a little time
and give us a decent problem specification.  Just an example of
what the output should be for one particular input isn't enough.

   sort { lc $a cmp lc $b or $b cmp $a } @unsorted;

does what you want, but so does

  qw( a aA AA AAA B C d dD E);

Anno


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

Date: Wed, 09 Aug 2000 13:49:32 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: sorting problem! output should be (a A aA AA).
Message-Id: <sp2obc9k63a46@corp.supernews.com>

In article <8mrmbr$3et$1@lublin.zrz.tu-berlin.de>,
    Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:

: Erik van der Knaap  <eknaap@lucent.com> wrote in comp.lang.perl.misc:
:
: >I want to sort a list in a special way. I want to sort an
: >abbreviation list.  @unsorted = qw(AA AAA aA a B C d E dD);
: >
: >And I want the output as:
: >a aA AA AAA B C d dD E
: 
: Oh please!  If you want help with a problem, invest a little time
: and give us a decent problem specification.  Just an example of
: what the output should be for one particular input isn't enough.

I thought his example made it perfectly clear.

Greg
-- 
The circle algorithm was invented by mistake when I tried to save one
register in a display hack! 
    -- Minsky


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

Date: Wed, 09 Aug 2000 16:31:10 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: sorting problem! output should be (a A aA AA).
Message-Id: <5gq2ps0esb1coogk0943e2cqogr9v6q9tq@4ax.com>

On Wed, 09 Aug 2000 15:04:36 +0200, Erik van der Knaap
<eknaap@lucent.com> wrote:

> Folks,
> 
> I want to sort a list in a special way. I want to sort an abbreviation list.
> @unsorted = qw(AA AAA aA a B C d E dD);
> 
> And I want the output as:
> a aA AA AAA B C d dD E

OK, but where do you want 'aB' and 'Ab' to go?
 
> Is there a nice way to do that?

That depends on your definition of 'nice' :-)

	my @sorted = map $_->[-1] => 
		sort {	$a->[0] cmp $b->[0] ||
			$b->[-1] cmp $a->[-1]
		} map [ uc $_, $_ ] => @unsorted;
	

-- 
Good luck,
Abe


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

Date: Wed, 09 Aug 2000 16:44:32 +0200
From: Javier Hijas <jhijas@yahoo.es>
Subject: use strGlobal symbol "$YP_D"use strict" error message
Message-Id: <39916E50.110DC06D@yahoo.es>

Global symbol "$YP_DIR" requires explicit package name at ./usradm line
16.

Could someone tell me what does it means?


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

Date: 9 Aug 2000 13:01:55 GMT
From: Steffen Beyer <sb@muccpu1.muc.sdm.de>
Subject: Re: Using Bit::Vector for large hex-number arithmetic
Message-Id: <8mrko3$k5c$1@solti3.sdm.de>

In comp.lang.perl.misc Ulrich Ackermann <uackermann@orga.com> wrote:

> I am trying to calculate things like (64 Byte hex)**(64 Byte hex) and
> thought, that Bit::Vector might be the right choice for that.
> But after reading the documentation and trying a bit I am really stuck
> with it.

> What I was trying looks like this:

> 1	#!/usr/local/bin/perl -w
> 2	
> 3	use strict; 
> 4	use Bit::Vector;
> 5
> 6	Bit::Vector->Configuration("input = hexadecimal");
> 7
> 8
> 9	my $vector1 = Bit::Vector->new(512);

> 10	$vector1 = "88888888888888888888";

This line overwrites the bit vector and replaces it by a literal string.
=> Don't do that!

You probably want

        $vector1->from_Hex("88888888888888888888");

> 11	$vector1 **= "15";
> 12	print "vector1 = $vector1\n";

> If I try a number, bigger than that in line 10, I will get "vector1 =
> inf", independently from the number of bits I giving the new()-method.
> And if I use an "F" instead of the "15" in line 11 it gives me an error
> (Argument "F" isn't numeric in exponentiation) although I have the
> Configuration-Statement in line 6.
> I think, I am *really* missing something, but I cannot work out what it
> is.

You are. :-)

You are confusing Perl scalars and Perl objects.

A Perl object cannot be assigned to with "=".

> Any help appriciated,
> Ulrich

Hope this helps!

Regards,
-- 
    Steffen Beyer <sb@engelschall.com>
    http://www.engelschall.com/u/sb/whoami/ (Who am I)
    http://www.engelschall.com/u/sb/gallery/ (Fotos Brasil, USA, ...)
    http://www.engelschall.com/u/sb/download/ (Free Perl and C Software)


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

Date: 9 Aug 2000 13:13:28 GMT
From: Steffen Beyer <sb@muccpu1.muc.sdm.de>
Subject: Re: Using Bit::Vector for large hex-number arithmetic
Message-Id: <8mrldo$k5c$2@solti3.sdm.de>

In article <8mrkq6$39q$1@lublin.zrz.tu-berlin.de>, Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:

> Ulrich Ackermann  <uackermann@orga.com> wrote in comp.lang.perl.misc:

>>I am trying to calculate things like (64 Byte hex)**(64 Byte hex) and
>>thought, that Bit::Vector might be the right choice for that.
>>But after reading the documentation and trying a bit I am really stuck
>>with it.
>> [...]
>>9	my $vector1 = Bit::Vector->new(512);
>>10	$vector1 = "88888888888888888888";

> You have just overwritten the newly created Bit::Vector with an
> ordinary Perl scalar.

Exactly.

>>11	$vector1 **= "15";

> This, too, is not an operation that would be understood by Bit::Vector[1],
> even if $vector still were such an object.

Incorrect: This is a legal operation in Bit::Vector 5.8.

> [1] Well, not without some help from overload.  I don't think Bit::Vector
>     does that by default.

It does so since version 5.8, released about a week ago.

> See perldoc Bit::Vector (yes, it's a big doc) on how to set a vector
> to a desired value and how to do long arithmetic with them.

I know it's a huge doc, and I apologize :-), but the idea is actually
that you look up the command/method/operator of interest to you in
the "SYNOPSIS" section and then simply jump to the corresponding description
(with "/" in vi, for example).

Hope this helps!

Best regards,
-- 
    Steffen Beyer <sb@engelschall.com>
    http://www.engelschall.com/u/sb/whoami/ (Who am I)
    http://www.engelschall.com/u/sb/gallery/ (Fotos Brasil, USA, ...)
    http://www.engelschall.com/u/sb/download/ (Free Perl and C Software)


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

Date: 9 Aug 2000 13:42:42 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Using Bit::Vector for large hex-number arithmetic
Message-Id: <8mrn4i$3gq$1@lublin.zrz.tu-berlin.de>

Steffen Beyer  <sb@engelschall.com> wrote in comp.lang.perl.misc:
>In article <8mrkq6$39q$1@lublin.zrz.tu-berlin.de>, Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>> Ulrich Ackermann  <uackermann@orga.com> wrote in comp.lang.perl.misc:

[...]

>>>11	$vector1 **= "15";
>
>> This, too, is not an operation that would be understood by Bit::Vector[1],
>> even if $vector still were such an object.
>
>Incorrect: This is a legal operation in Bit::Vector 5.8.
>
>> [1] Well, not without some help from overload.  I don't think Bit::Vector
>>     does that by default.
>
>It does so since version 5.8, released about a week ago.

Oh.  Looks like I need to go see what my favorite module has been up to
while I wasn't looking.

Anno


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

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


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