[15720] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3133 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 23 11:05:31 2000

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

Perl-Users Digest           Tue, 23 May 2000     Volume: 9 Number: 3133

Today's topics:
        &#037; translating ascii to unicode? <spam-abuse@uk2.net>
    Re: &#037; translating ascii to unicode? <jeff@vpservices.com>
    Re: A definition of true? <bchauvet@capgemini.fr>
    Re: About "sprint f" ? <sweeheng@usa.net>
        activestate Perl5.6 /w win2000? <kflin@csie.nctu.edu.tw>
    Re: Ask Expert about Perl5 DBM files <Qiang.Wu@motorola.com>
    Re: Basic scripting question (Gwyn Judd)
    Re: Basic scripting question <dave@dave.org.uk>
    Re: Basic scripting question <uri@sysarch.com>
    Re: Basic scripting question <nobody@newsfeeds.com>
    Re: Basic scripting question <nobody@newsfeeds.com>
    Re: Does WARN have a reset?? <tturton@ntx.waymark.net>
    Re: file locking (Randal L. Schwartz)
    Re: HELP MEEEEEE (Bart Lateur)
    Re: Including variables defined outside the script <hmerrill@my-deja.com>
    Re: join " ", do {$x++}, do {$x++}, do {$x++}; (Gwyn Judd)
    Re: join " ", do {$x++}, do {$x++}, do {$x++}; (Bart Lateur)
    Re: Looking for a good editor... <webmaster@outofthisworld.org>
    Re: my algorythms suck (Gwyn Judd)
        Need help with su <aakbari@crosskeys.com>
    Re: Need help with su <rhomberg@ife.ee.ethz.ch>
    Re: Need help with su <elaine@chaos.wustl.edu>
    Re: Need help with su <thunderbear@bigfoot.com>
    Re: need help <aakbari@crosskeys.com>
        Norton identifies Perl as a worm <sotmesc@datasync.com>
    Re: Norton identifies Perl as a worm <kiera@nnickee.com>
    Re: param prob <bchauvet@capgemini.fr>
    Re: param prob <blah@nospam.com>
    Re: Perl pipe, IO, open3 (Mr. Stan M. Gerbig)
    Re: rotation of images td@lavalink.com.au
    Re: Server Push <uri@sysarch.com>
    Re: Server Push <gellyfish@gellyfish.com>
    Re: sorting a list of mixed numbers and text as in perl (Gwyn Judd)
    Re: splitting lines of DOS file in UNIX <sweeheng@usa.net>
    Re: the use of $_ (Brandon Metcalf)
    Re: Visibility of package lexicals in debugger msouth@fulcrum.org
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 23 May 2000 14:52:36 +0100
From: Nadja Herkova <spam-abuse@uk2.net>
Subject: &#037; translating ascii to unicode?
Message-Id: <392A8D21.EDFB70B0@uk2.net>

I'm sure it must exist in modules; parser to convert ascii characters
into their html safe unicode (?) counterparts in the &#xxx; format  -
I've been searching for hours but have not found any help. Is there a
special name for the &#xxx; format that I have missed ?

thanks
Nadja



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

Date: Tue, 23 May 2000 07:42:30 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: &#037; translating ascii to unicode?
Message-Id: <392A98D6.462FA2DB@vpservices.com>

Nadja Herkova wrote:
> 
> I'm sure it must exist in modules; parser to convert ascii characters
> into their html safe unicode (?) counterparts in the &#xxx; format  -
> I've been searching for hours but have not found any help. Is there a
> special name for the &#xxx; format that I have missed ?

I think what you are looking for is the HTML::entities module which is
part of the HTML::Parser distribution.  Unicode has nothing to do with
it.

-- 
Jeff


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

Date: Tue, 23 May 2000 15:09:38 +0200
From: "Orabīg" <bchauvet@capgemini.fr>
Subject: Re: A definition of true?
Message-Id: <8gdv6g$eev$1@heraut.schneider.fr>


Hardy Merrill <hmerrill@my-deja.com> a écrit dans le message :
8gdt8i$bml$1@nnrp1.deja.com...
> As far as I know, there are *NO* predefined values of "True" and/or
> "False" - variables are evaluated according to these rules to determine
> true/false.  I sometimes use the numbers 0 and 1 to mean true and false,
> like this:

Yes. It's... true !
:)
I've made the mistake some time ago, and spend some hours to fix it !

Try this :

#perl

$test = (1==2);
print "1 equals 2 !\n" if ($test == true);
print "1 does not equal 2 !\n" if ($test == false);

--
Orabīg




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

Date: Tue, 23 May 2000 21:58:37 +0800
From: "Swee Heng" <sweeheng@usa.net>
Subject: Re: About "sprint f" ?
Message-Id: <8ge2g7$jrr$1@mawar.singnet.com.sg>

Lee <lee@factory.co.kr> wrote in message
news:8gd359$bcb$1@news2.kornet.net...
> Hi,
> I have two questions about sprint f.
you mean sprintf?

> $padding_value = $basevalue . ( ' ' x (30-length($basevalue)) );
> With above.
>
> 1. It seems only count characters not white spaces.
> If it is, how can I solve this to count spaces ?
What makes you think so? "print length('123 567')" gives me 7.

> 2. If the $basevalue is longer than 30 characters,
> How can I cut off the letters at 30 ?
substr()

This example seems to work:

$padding_value = sprintf ('%-30s', substr($basevalue,0,30));

1. extract first 30 characters.
2. then pad it with ' '.
3. length($padding_value) should be 30.

see "perldoc -f sprintf" and "perldoc -f substr".




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

Date: 23 May 2000 13:40:36 GMT
From: „[µįæß <kflin@csie.nctu.edu.tw>
Subject: activestate Perl5.6 /w win2000?
Message-Id: <8ge1ok$l84$1@netnews2.csie.nctu.edu.tw>

Hi all,

I've just downloaded the Perl5.6 for Win32 from 
ActiveState in binary form. While installing
in Windows 2000, I got the error for
"Premature Ended" without any further info
for failure reason. The ActiveState states
that we don't need any other requirement
to install Perl package for win2k. Also I didn't 
get any resolution in their FAQ.
So I'd like to know if anyone got the same
problem? Or has any resolution?
Thanks in advance.




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

Date: Tue, 23 May 2000 09:17:27 -0500
From: Qiang Wu <Qiang.Wu@motorola.com>
Subject: Re: Ask Expert about Perl5 DBM files
Message-Id: <392A92F7.D545F4D8@motorola.com>

He does. But he suggested me another way instead of solving the problem.
This is the first time I use this newsgroup. Can I post questions on
different newsgroup?

Qiang

Tom Phoenix wrote:

> On Mon, 22 May 2000, Qiang Wu wrote:
>
> > Subject: Ask Expert about Perl5 DBM files
>
> Please check out this helpful information on choosing good subject
> lines. It will be a big help to you in making it more likely that your
> requests will be answered.
>
>     http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
>
> >      I want to convert a text file to a DBM file. This text file
> > contains 150000 records.
>
> Didn't Randal already answer this in c.l.p.modules? Please, read
> news.announce.newusers to learn about crossposting. Thanks!
>
> --
> Tom Phoenix       Perl Training and Hacking       Esperanto
> Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 23 May 2000 13:26:18 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Basic scripting question
Message-Id: <slrn8inm7u.81p.tjla@thislove.dyndns.org>

I was shocked! How could Dave Cross <dave@dave.org.uk>
say such a terrible thing:
>On Tue, 23 May 2000 02:51:29 GMT, Uri Guttman <uri@sysarch.com> wrote:
>
>>and what a shitload of code to do this:
>>
>>	perl -ne 'print unless $. % 3' input_file > output_file
>
><pedant>
>
>Actually, Uri, I _think_ you meant
>
>perl -ne 'print if $. % 3' input_file > output_file

I think the thing was to print every line but every third not the other
way around.

-- 
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
Paranoid Club meeting this Friday.  Now ... just try to find out where!


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

Date: Tue, 23 May 2000 14:35:28 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: Basic scripting question
Message-Id: <j72lis03g611djo6c4iivbrfj9lsd70ajf@4ax.com>

On Tue, 23 May 2000 13:26:18 GMT, tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
wrote:

>I was shocked! How could Dave Cross <dave@dave.org.uk>
>say such a terrible thing:
>>On Tue, 23 May 2000 02:51:29 GMT, Uri Guttman <uri@sysarch.com> wrote:
>>
>>>and what a shitload of code to do this:
>>>
>>>	perl -ne 'print unless $. % 3' input_file > output_file
>>
>><pedant>
>>
>>Actually, Uri, I _think_ you meant
>>
>>perl -ne 'print if $. % 3' input_file > output_file
>
>I think the thing was to print every line but every third not the other
>way around.

My version prints lines 1, 2, 4, 5 ,7,8, etc, which is what the OP
wanted.

Dave...

-- 
<http://www.dave.org.uk>  SMS: sms@dave.org.uk
yapc::Europe - London, 22 - 24 Sep <http://www.yapc.org/Europe/>

"There ain't half been some clever bastards" - Ian Dury [RIP]


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

Date: Tue, 23 May 2000 14:26:59 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Basic scripting question
Message-Id: <x7snv9cpfw.fsf@home.sysarch.com>

>>>>> "DC" == Dave Cross <dave@dave.org.uk> writes:

  DC> On Tue, 23 May 2000 02:51:29 GMT, Uri Guttman <uri@sysarch.com> wrote:
  >> perl -ne 'print unless $. % 3' input_file > output_file

  DC> <pedant>

  DC> Actually, Uri, I _think_ you meant

  DC> perl -ne 'print if $. % 3' input_file > output_file

  DC> </pedant>

it wasn't always clear to print every third line or skip it. i saw both
types in this thread.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Tue, 23 May 2000 07:56:58 -0700
From: Anonymous <nobody@newsfeeds.com>
Subject: Re: Basic scripting question
Message-Id: <392A9C3A.C8F9CD98@no.spam>

brian d foy wrote:

> of course, all of this is much more simply written as
 
>    while( <LINES> )
>       {
>       print unless ++$line_counter % 3;
>       }

Crap code that does nothing. Post code that
works or don't post.

Anonymoose

  --------== Posted Anonymously via Newsfeeds.Com ==-------
     Featuring the worlds only Anonymous Usenet Server
    -----------== http://www.newsfeeds.com ==----------


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

Date: Tue, 23 May 2000 08:02:48 -0700
From: Anonymous <nobody@newsfeeds.com>
Subject: Re: Basic scripting question
Message-Id: <392A9D98.447492FE@no.spam>

Uri Guttman wrote:
> 
> >>>>> "DC" == Dave Cross <dave@dave.org.uk> writes:
> 
>   DC> On Tue, 23 May 2000 02:51:29 GMT, Uri Guttman <uri@sysarch.com> wrote:
>   >> perl -ne 'print unless $. % 3' input_file > output_file
> 
>   DC> <pedant>
> 
>   DC> Actually, Uri, I _think_ you meant
> 
>   DC> perl -ne 'print if $. % 3' input_file > output_file
> 
>   DC> </pedant>
> 
> it wasn't always clear to print every third line or skip it. i saw both
> types in this thread.


stop posting crap code that does nothing. Post code that works or don't
post.

Anonymoose

  --------== Posted Anonymously via Newsfeeds.Com ==-------
     Featuring the worlds only Anonymous Usenet Server
    -----------== http://www.newsfeeds.com ==----------


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

Date: Tue, 23 May 2000 09:44:50 -0500
From: Tom Turton <tturton@ntx.waymark.net>
Subject: Re: Does WARN have a reset??
Message-Id: <392A9962.7C4475A9@ntx.waymark.net>

That was EXACTLY it...thanks for clearing up the mystery!

I ran a small test program:

for (1..10) {
    if ($_ > 5) {
        warn "Big Number coming>>>> $_\n";
    }
}

Got five warning messages BECAUSE of printing out number making warning
line unique.  If I deleted the $_ in the warn message, AND had 'use
diagnostics' I only got ONE warn message.  When I commented out the 'use
diagnostics', it resumed giving me all 5 warn messages.

Having messed around with PERL for almost 3 years now, and read enough
on this newsgroup to NEVER, EVER write a program without 'use
diagnostics', I was a bit surprised by this 'feature' of Perl ;-)  
Thanks for unlocking another mystery.

---Tom T.

"M.J.T. Guy" wrote:
> 
> Tom Turton  <tturton@ntx.waymark.net> wrote:
> >In a subroutine, I have an if block, and in one branch, I use warn to
> >print a warning (warn "WARNING:: Outside of allowable limits.\n";)
> >
> >The first time through this branch, I get the warning, but subsequent
> >passes fail to display the warning.  Yet I follow the 'warn' with a
> >debug print statment, and I see that each time, so I know I'm exercising
> >the branch of the if block.
> >
> >Does 'warn' have a flag I need to clear or reset?
> 
> Let me guess  -  you're using "use diagnostics" ?
> 
> There's a little known (and even less documented) feature that it
> suppresses repeats of the same warning message.    It should probably
> only do this for messages from Perl itself, but ...
> 
> I tend to generate my error messages with
> 
>        print STDERR "Some message here\n";
> 
> but that of course has its own disadvantages.
> 
> Mike Guy


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

Date: 23 May 2000 07:32:00 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: file locking
Message-Id: <m1u2fpwd5r.fsf@halfdome.holdit.com>

>>>>> "Rick" == Rick Delaney <rick.delaney@home.com> writes:

Rick> Can you produce an example program that will reproduce this behaviour? 
Rick> I've never been able to get garbled output, despite numerous attempts.

>> I've never seen any problems with appending a single line to a
>> logfile, though... Have I been lucky so far, or would that qualify
>> as a single write() operation ?

Rick> <aol>I'd like to know the answer to this too.</aol>

"asked and answered", the lawyers would scream.  Just go up a few
messages in this thread.

If it's less than the buffering size of your STDIO buffer (typically
8K or so), it's probably gonna be a single write(2) call, and you get
O/S assistance to ensure atomicity.  If it's greater than that, you
will probably lose at some point.  Solution, use syswrite(), but be
prepared for the rare short write (which again won't be atomic, but at
least you'll know it happened).

print "Just another Perl hacker,"

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Tue, 23 May 2000 14:04:08 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: HELP MEEEEEE
Message-Id: <393083f7.17453627@news.skynet.be>

Marco Natoni wrote:

> I was not clear enough:  How can we live *without* heredocs? :)

You may, if you wish. Why would you want to?

print "This is
a multiline
string.";

No problemo! Except that you have to backwhack the quotes, of course.

I think that here-docs are more readable. You don't have to visually
scan for the closing quote.

-- 
	Bart.


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

Date: Tue, 23 May 2000 12:59:14 GMT
From: Hardy Merrill <hmerrill@my-deja.com>
Subject: Re: Including variables defined outside the script
Message-Id: <8gdvao$d3a$1@nnrp1.deja.com>


> In in the file MyModule.pm, there are a few lines like this:
>
> my $var="data';
> my $var2="moredata";
>
> In my script, I have these lines:
>
> use lib "path/to/my/modules/dir";
> use strict;
> use MyModule;
>
> It finds MyModule (no errors reported), but when I try to use those
variables, it says
> they must have explicit package names.  I know this means the
variables aren't getting
> defined, but why?  The module does not have any "package" statements
in it.  Why aren't
> the variables being defined in $main:: ?
>
> I read the pertinant parts  in the Camel book, and searched deja, but
it hasn't clicked in my
> head. Any hints?
>
> --
> Joshua Kugler
> ASUAF Information Services Director
> isd@as.uaf.edu
>
>

Joshua, I'm not a Perl module expert, so I'm not going to try to explain
your problem.  Try looking at the "perlmod"(Perl packages and symbol
table entries) documentation by doing

    perldoc perlmod

There's some great documentation there about perl modules and packages.
I will tell you that in the modules that I've developed, I've included a
package name at the start of each one.  And where that module doesn't
explicitely "export" variables/functions that you want to use, in a Perl
script that uses variables/function from that module I have to preface
the variable/function with the package name of that module.  There are a
few things to consider - the Camel book has some documentation - p.284-
285, 405-407, and there are some others.  Another good book is
"Effective Perl Programming" - there's a whole section on creating Perl
modules in that.

Hope this helps.
--
Hardy Merrill
Mission Critical Linux
http://www.missioncriticallinux.com


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


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

Date: Tue, 23 May 2000 13:37:35 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: join " ", do {$x++}, do {$x++}, do {$x++};
Message-Id: <slrn8inmt3.81p.tjla@thislove.dyndns.org>

I was shocked! How could Intergalactic Denizen of Mystery <Tbone@pimpdaddy.com>
say such a terrible thing:
>tjla@guvfybir.qlaqaf.bet writes:
>>I was shocked! How could Intergalactic Denizen of Mystery <Tbone@pimpdaddy.com>
>>say such a terrible thing:
>
>The internet gave me the courage.
>
>>>I seem to have lost the ability to RTFM... could someone point me
>>>to where it says that the above (see subject line) will guarantedly
>>>produce "1 2 3"?
>>
>>did you try it? I got:
>>
>>[gwyn@thislove:~]$ perl -e 'print join " ", do {$x++}, do {$x++}, do
>>{$x++};'
>>0 1 2
>
>True... the question was, is this just an accident?

Probably not...In C (and presumably perl) they have
this rule that goes something like (paraphrased) "don't chang the value of
a variable more than once in an expression" or something (I forget exactly).
I know I'm not explaining this very well. Look basically you can't do an
expression like this "$i = $i++" because it will give you undefined
results. The reason is you are assigning to $i twice and this confuses
compilers. The same goes for the function call above where you are
assigning multiple times to $x in the one expression. eg if you did a
function call like this "f($i++, $i++)" where $i originally had the
value 7, then the function might be called like f(7,7), f(7,8), f(8,7)
or whatever. I don't really understand why this happens. I suggest
having a look at the comp.lang.c FAQ for a better explanation.

-- 
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
If you worry about your customers,
you won't have to worry about money.
		-- Les Welch, in "Bicycle USA", March/April 1990


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

Date: Tue, 23 May 2000 14:04:11 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: join " ", do {$x++}, do {$x++}, do {$x++};
Message-Id: <393184fc.17714905@news.skynet.be>

Orabīg wrote:

>> foo($x, $x++, $x++, $x++);
>>
>> sub foo { print "@_\n" }

>> Output:
>> 6 3 4 5
>
>OK, could someone explain this one for me ? I just give up... :s

First of all: arguments to subs are passed by reference. therefore, if
you pass a variable, and later on change the variable, the argument will
change too!

Witness:

	$, = " "; $\ = "\n";  # format printout
	$x = 0;
	print "$x", $x, "$x", $x++;
-->
	0 1 0 0

See that? The second argument, the bare $x, has changed, because of the
$x++, while "$x", which makes a stringified copy of the value at that
time, isn't changed by that increment, neither in front nor at the back
of the bare $x.

Second: $x++ returns a copy of the value before the variable is changed.
Therefore, all changes to that variable, afterwards, are ignored. The
copy doesn't change, only the original. That's why you see:

	$x = 0;
	print $x++, $x++, $x++;
-->
	0 1 2

Notice:

	$x = 0;
	print ++$x, ++$x, ++$x;
-->
	3 3 3

So, apparently, ++$x increments the variable, and returns a reference to
the original variable, not to a copy of the value.

   HTH,
   Bart.


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

Date: Tue, 23 May 2000 14:50:57 GMT
From: Phill Allen <webmaster@outofthisworld.org>
Subject: Re: Looking for a good editor...
Message-Id: <392A9ACF.D2F681CB@outofthisworld.org>


A good text editor that includes PERL dictionary highlighting and
has a nice integrated FTP interface is UltraEdit 
www.UltraEdit.com for Windows!

This is an inexpensive editor that has lost of potential.

Phill
jcentrix@hotmail.com

John Springer wrote:
> 
> in article 8g8o5s$oma$2@news2.kornet.net, Padawan at perl@sigmainstitute.com
> wrote on 5/21/00 6:25 AM:
> 
> > Good day,
> > I'm a Perl Padawan (beginner) and have tried a few of Perl editing and
> > testing programs (Perl Builder, Perl Studio, DZ Perl Editor), but I want to
> > put the money down on a highly recommended editor.  What do the Jedi Masters
> > of Perl and Perl/CGI use?
> >
> > Thanks in advance...
> >
> This one uses BBEdit on a Macintosh.
> I've never seen anything on windoze yet that would convince me to switch.
> 
> --
> John Springer
>    Sitting in the rain in Portland.
>    Pondering my perl.
>    Moss everywhere.
>    Perfect.


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

Date: Tue, 23 May 2000 13:55:09 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: my algorythms suck
Message-Id: <slrn8innu1.81p.tjla@thislove.dyndns.org>

I was shocked! How could klidge <klidge@mailbox.gr>
say such a terrible thing:
>so i have an index file for a forum i want to create on the web
>
>1?1?0?subject 1?nick1?10?02?00

<snip>

>field 1 -> post id
>field 2 -> subject id
>field 3 -> the id of the post that the current post is a reply to(zero
>totally new subject)
>field 4 -> subject
>field 5 -> senders name/nick
>field 6,7,8 -> date,month,year
>
>i want an algorythm which using the above data can create this output:
>
>subject 3
> |->subject 3-1
>   |->subject 3-1-1
>   |->subject 3-1-2
> |->subject 3-2
>   |->subject 3-2-1
>
>of course i don't have any problem with the html code.i just can't find
>how can i make perl to do it.i 'm open to ANY suggestions :)

Well I am assuming you are wanting some sort of a solution in Perl to
solve this problem so I have pointed out a possible solution with hints
in parentheses for documentation to look at. Implementing it is up to
you :).
Well you could read in the file line by line (perldoc perlop, look for
the '<>' operator)  and use the 
split function (perldoc -f split) to split on the
'?' character which appears to seperate the fields. Look for a '-'
character in the subject field (perldoc perlre) and stick the related
articles into an array. Then print out your HTML from that array. HTH

-- 
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
Don't tell any big lies today. Small ones can be just as effective.

		-- Unknown


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

Date: Tue, 23 May 2000 09:23:05 -0400
From: Afshin Akbari <aakbari@crosskeys.com>
Subject: Need help with su
Message-Id: <392A8639.18FA6DE5@crosskeys.com>

All,

 How can I automate login to a machine in Perl.
 or
 This is the situation:
 I have a file that is owned by user A,
 and I need to copy it as root so when it is
 in the new location, it is owned by root.

 to me either I have to automate the login
 process or do something with "chmod"
 I have not been able to figure out which
 and how ???

Platform is solaris.


 All the help is greatly appreciated.

 Thanks,

 A.A.



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

Date: Tue, 23 May 2000 15:46:53 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: Need help with su
Message-Id: <392A8BCD.841F4DF4@ife.ee.ethz.ch>

Afshin Akbari wrote:
> 
> All,
> 
>  How can I automate login to a machine in Perl.
>  or
>  This is the situation:
>  I have a file that is owned by user A,
>  and I need to copy it as root so when it is
>  in the new location, it is owned by root.
> 
>  to me either I have to automate the login
>  process or do something with "chmod"
>  I have not been able to figure out which
>  and how ???

You shouldn't automate login. Either use a suid script,
or better in this case, allow the exact chown with 'sudo'

In either case, it's not a Perl problem

- Alex


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

Date: Tue, 23 May 2000 14:09:17 GMT
From: Elaine Ashton <elaine@chaos.wustl.edu>
Subject: Re: Need help with su
Message-Id: <B550094C.4908%elaine@chaos.wustl.edu>

in article 392A8BCD.841F4DF4@ife.ee.ethz.ch, Alex Rhomberg at
rhomberg@ife.ee.ethz.ch quoth:

>> I have a file that is owned by user A,
>> and I need to copy it as root so when it is
>> in the new location, it is owned by root.
>> 
>> to me either I have to automate the login
>> process or do something with "chmod"
>> I have not been able to figure out which
>> and how ???
> 
> You shouldn't automate login. Either use a suid script,
> or better in this case, allow the exact chown with 'sudo'
> 
> In either case, it's not a Perl problem

Why isn't it? Sounds like a perfectly reasonable problem that System Admins
face all the time...and solve with Perl. I don't know, but manually logging
into a couple thousand machines just doesn't make me warm and fuzzy. The
same ideas can be applied to smaller-scale systems. Granted, he made the
mistake of asking a perfectly reasonable question here...but I digress.

There are several different options here. You can use the expect module, the
Net::Telnet module or you can use network shell which has lots of Perl
functionality built into it. You must weigh the security needs against the
practicality. You could always use rsh but that is far less attractive.

http://search.cpan.org/doc/JROGERS/Net-Telnet-3.01/lib/Net/Telnet.pm
http://www.networkshell.com/

enjoy.

e.



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

Date: Tue, 23 May 2000 16:19:26 +0200
From: =?iso-8859-1?Q?Thorbj=F8rn?= Ravn Andersen <thunderbear@bigfoot.com>
Subject: Re: Need help with su
Message-Id: <392A936E.FE168A96@bigfoot.com>



Afshin Akbari wrote:

>  I have a file that is owned by user A,
>  and I need to copy it as root so when it is
>  in the new location, it is owned by root.

Install sshd on B, and use scp.


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

Date: Tue, 23 May 2000 09:58:03 -0400
From: Afshin Akbari <aakbari@crosskeys.com>
Subject: Re: need help
Message-Id: <392A8E6B.5F7521E8@crosskeys.com>

Alex,

Thanks for the reply, I greatly appreciate that.


could you elaborate on either of the solutions you mentioned.

This is what I did to avoid the automating the login.

File 1.pl
 system (chmod u+s filename1.pl)
system (cp filename1.pl filename2.pl)

I was hopping that when I get filename2, it would be the owned by root
assuming that filename1.pl was owned by root. However it did not work.


You mentioned about the 2 command, 'suid' or 'sudo'
what do I pass to them /how do I use them with system ???

Thanks a whole lot.


A.A.



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

Date: 23 May 2000 13:09:42 GMT
From: Frosty  <sotmesc@datasync.com>
Subject: Norton identifies Perl as a worm
Message-Id: <8gdvum$lrh$2@news.datasync.com>


It seems in the post-Love Bug worm days Norton is making
some interesting mistakes.  The latest version of Norton
now identifies the Perl FAQ file as having the Love Bug
worm in it.  We've gone over the file here and it is not
the Love Bug worm, nor is it infected or a virus.

This file is installed with ActivePerl and can be found
at /perl/html/Perl-Win32/perlwin32faq.html.




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

Date: Tue, 23 May 2000 09:49:48 -0500
From: Kiera <kiera@nnickee.com>
Subject: Re: Norton identifies Perl as a worm
Message-Id: <DE10EF2AF9C59646.51B7D23CCDB87B44.2AB0B7B0C514A1FA@lp.airnews.net>

On 23 May 2000 13:09:42 GMT, someone claiming to be Frosty
<sotmesc@datasync.com> said:

>The latest version of Norton now identifies the Perl FAQ 
>file as having the Love Bug worm in it.  

Odd.  I just updated my virus defs for NA two days ago.  The scan
didn't have any problems on the partition where perl is installed, but
it did barf on the next partition - seemingly on one of my .pl
scripts.  It didn't say the file was infected, it just froze in place
on that script, 3 separate times.

Thanks for reminding me - I meant to send a little note to Symantec
the other day and just completely forgot.

Kiera



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

Date: Tue, 23 May 2000 15:03:45 +0200
From: "Orabīg" <bchauvet@capgemini.fr>
Subject: Re: param prob
Message-Id: <8gdure$del$1@heraut.schneider.fr>


mc <avidbkdNOavSPAM@netscape.net.invalid> a écrit dans le message :
1f1a5ad0.fb9b1cb6@usw-ex0104-026.remarq.com...
> How do you pass a variable via the param command.
>
> The line: $ADate = $foo->param('Jan.30');
> works great, but if I try:
>
> $AString = "Jan.30";
> $ADate = $foo->param('$AString');

Try
$ADate = $foo->param("$AString");
or
$ADate = $foo->param($AString);

--
Orabīg




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

Date: Tue, 23 May 2000 15:57:48 +0200
From: Marco Natoni <blah@nospam.com>
Subject: Re: param prob
Message-Id: <392A8E5C.7B2E48DF@nospam.com>

mc,

mc wrote:
> How do you pass a variable via the param command.
> The line: $ADate = $foo->param('Jan.30');
> works great, but if I try:
> $AString = "Jan.30";
> $ADate = $foo->param('$AString');
> It does not work. Any suggestions?

  Surrounding a variable in single quotes inhibits its interpolation: 
If a parameter called $AString does not exist, you can not expect any
return value from the param method.


	Best regards,
		Marco


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

Date: 23 May 2000 08:25:58 -0500
From: sgerbig@trinity.ucs.indiana.edu (Mr. Stan M. Gerbig)
Subject: Re: Perl pipe, IO, open3
Message-Id: <8ge0t6$fjj$1@trinity.ucs.indiana.edu>


Well, part of the problem is, you aren't supplying the right arguments
to the commands you're opening. For example, sendmail is croaking
because you aren't supplying the "to" address in a way that sendmail
can understand.

Sendmail either want's the recip explicitly specified when you call
it, i.e.

    open(MAIL, "|/usr/lib/sendmail $recip") ||
        die "Error -\n$0 unable to open sendmail\n$!\n\n";

OR, you need to call sendmail with the "-t" option, and specify the
recipients in the text you pass it on STDIN. i.e.

    open(MAIL, "|/usr/lib/sendmail -t") ||
        die "Error -\n$0 unable to open sendmail\n$!\n\n";
    print MAIL <<"END";
    To: $recip
    From: $recip
    Subject: Test message

    here is some crap in the message body

    END

If you leave out both the recipient, and the -t flag, you get the
error you mentioned.

Not sure what problems you're having with passwd. Are you actually
getting back errors (anything in $!), or is it just failing? And I
guess if you don't really _need_ it to do passwd, then I'd probably
find something else to play with. It just seems like there's some bad
juju living down that road.


Clinton Mahoney <cmahoney@indiana.edu> wrote :

> 	I'm trying to use a perl script to send data to the Unix
> passwd command to allow a perl script to use it to change a
> password.  It's not really important that that I'm using passwd -
> I've just been trying to get anything to work to open a process with
> piped input.

> I've been trying to use IPC open3 which doesn't work.  I can't even
> get this to work:

>	open (HANDLE, "| somecommand");

> 	All it does is executes "somecommand" and doesn't even look at
> whatever I try to write to HANDLE - it's just a completely
> uncontrolled process.

> 	I've even downloaded scripts people have already written and I
> get the same thing.  Such as :

> 	open (MAIL, "| /usr/sbin/sendmail")
>       print MAIL "To: user@domain.com"

> 	All I get is "user... Recipient names must be specified" which
> is what you get when you invoke sendmail without any arguments.
> This should be the easiest thing but I can't get it to work - I
> didn't think I was an idiot but I guess I must be - please help!

> 	I guess I'd prefer to use open3 since it would allow me to get
> STDIN and STDOUT for the command - I'd really like to know how to do
> both.


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

Date: 23 May 2000 13:16:50 GMT
From: td@lavalink.com.au
Subject: Re: rotation of images
Message-Id: <959087809.24439@krakatua>

Tom Phoenix <rootbeer@redcat.com> wrote:
> On 22 May 2000 td@lavalink.com.au wrote:

>> I was wondering if anyone knows if GD.pm can
>> rotate and existing image. 

> I think it _can_ do that, but it wouldn't be easy. :-)

I'd still be interested if any one has any examples.

>> If not, does anyone know of a module or a simple
>> way to rotate a list of images?

> I think you want PerlMagick.

You don't think it would be an overkill for a simple task?
All I want the to is rotate an image by 90 degrees.

Cheers
Tony D


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

Date: Tue, 23 May 2000 14:38:24 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Server Push
Message-Id: <x7og5xcowx.fsf@home.sysarch.com>

>>>>> "s" == sang  <laoxiu100@hotmail.com> writes:

  s> I search for some perl samples used of server push.

push( @server, $client_data ) ;

:-)

better yet, go to the group comp.infosystems.www.authoring.cgi which
covers cgi which is what server push falls under.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Tue, 23 May 2000 14:39:31 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Server Push
Message-Id: <DKwW4.711$6T1.113342@news.dircon.co.uk>

On Tue, 23 May 2000 21:00:25 +0900, sang Wrote:
> Hi,alls
> 
> I search for some perl samples used of server push.
> 
> Any advice ?
> 

Yes use google <http://www.google.com/> - you'll find plenty of examples.

/J\


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

Date: Tue, 23 May 2000 13:24:15 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: sorting a list of mixed numbers and text as in perldoc
Message-Id: <slrn8inm42.81p.tjla@thislove.dyndns.org>

I was shocked! How could Uri Guttman <uri@sysarch.com>
say such a terrible thing:
>>>>>> "GJ" == Gwyn Judd <tjla@guvfybir.qlaqaf.bet> writes:
>
>  GJ> is it gives the "numerical value" of any text containing a number
>  GJ> *anywhere* in the string to that string. ie. the string "the2ofus" gets
>  GJ> the "numerical value" 2 rather than being considered text. It's not
>
>huh? what planet are you from? 'the2ofus' in a numerical context is 0,
>not 2.

*sigh* I suggest you read the code. There is no need to be offensive
okay? The string "the2ofus" would be interpolated by the expression
"m/(\d+)/ ? $1 : $text_val" into the number 2 in the code I posted. I
know that if you compare the string "the2ofus" using the <=> operator it
will treat it as a zero. That is not what we are trying to do here.

>  GJ> I think what you need is a compare function a bit like "cmp"
>  GJ> except it sorts digits after characters. Anyone know of such a
>  GJ> thing or will we have to end up writing one ourself?
>
>you obviously don't understand sorting. there are many ways to sort
>multiple fields including the ST and the GRT. you just have to order the
>fields in the priority you needs. it has nothing to do with sorting
>numbers after text with a rewrite of cmp.

Probably I don't understand sorting. That is after all why I started
this thread. What does ST and GRT mean?

-- 
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
Execute every act of thy life as though it were thy last.
		-- Marcus Aurelius


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

Date: Tue, 23 May 2000 22:59:21 +0800
From: "Swee Heng" <sweeheng@usa.net>
Subject: Re: splitting lines of DOS file in UNIX
Message-Id: <8ge62d$jt3$1@mawar.singnet.com.sg>

John Hunter <jdhunter@nitace.bsd.uchicago.edu> wrote in message
news:1raehi6kut.fsf@video.bsd.uchicago.edu...
> and I want to populate a hash with the stuff in the double quotes as a
> key for the integer values to the left of the comma.  Here is a code
> snippet:
>
> my $content = $tar->get_content("params/params.par");
>   my $line;
>   foreach $line ( split("[\n\r]+", $content) ) {
>     if (m/(\d+),"(.*)"/) {
This will perform a m// on $_.
What you really need is:
    if ($line =~ m/(\d+),"(.*)"/ {

The perl compiler may be smart, but it cannot read your mind! :)

Swee Heng




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

Date: 22 May 2000 05:40:08 GMT
From: bmetcalf@baynetworks.com (Brandon Metcalf)
Subject: Re: the use of $_
Message-Id: <8gah7o$fv1$1@spinner.corpeast.baynetworks.com>

godzilla@stomp.stomp.tokyo writes:

 > So, you personally have been harassing me for a quite
 > a period of time. Strut your stuff. Show me what you
 > can do in Perl 5. Write me a Perl 5 program equally as
 > extraordinary as one of mine, written in Perl 4. Write
 > me a wild and imaginative program in Perl 5, something
 > really different, something offbeat as my programs.

Show me your Perl4 code, and I'll show it to you in Perl5.  What you say
is absolutely ludicrous.

-brandon


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

Date: 23 May 2000 13:59:56 GMT
From: msouth@fulcrum.org
Subject: Re: Visibility of package lexicals in debugger
Message-Id: <8ge2ss$p7v$1@inxs.ncren.net>

Tom Phoenix <rootbeer@redcat.com> wrote:
> On 22 May 2000 msouth@fulcrum.org wrote:

[lots of stuff that's better left unrepeated]

My, was that embarrassing.  Thanks for all the corrections.

-- 
Michael South                   |   http://fulcrum.org
Head Mathophile,                |   101 Canyon Run
fulcrum.org                     |   Cary NC  27513 USA
(msouth@fulcrum.org)            |   (919) 465-9074


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

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


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