[23285] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5505 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 15 09:10:49 2003

Date: Mon, 15 Sep 2003 06:10:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 15 Sep 2003     Volume: 10 Number: 5505

Today's topics:
        shutdown or reboot computer <jochen.friedmann2@de.bosch.com>
    Re: shutdown or reboot computer (Anno Siegel)
    Re: shutdown or reboot computer <jochen.friedmann2@de.bosch.com>
    Re: shutdown or reboot computer <bernard.el-hagin@DODGE_THISlido-tech.net>
    Re: shutdown or reboot computer <cyde@umd.edu>
    Re: shutdown or reboot computer <ThomasKratz@REMOVEwebCAPS.de>
    Re: shutdown or reboot computer <kuujinbo@hotmail.com>
    Re: shutdown or reboot computer <ThomasKratz@REMOVEwebCAPS.de>
        Subroutine as a new Task <jochen.friedmann2@de.bosch.com>
        THOSE ANNOYING POP UP MESSAGES. <zxvsdgs@freeuk.com>
    Re: Tring to kill my kids, but they are stuborn little  (Heinrich Mislik)
        variable file glob into grep without glob() (qanda)
    Re: variable file glob into grep without glob() <tassilo.parseval@rwth-aachen.de>
    Re:  <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 15 Sep 2003 12:55:46 +0200
From: "Jochen Friedmann" <jochen.friedmann2@de.bosch.com>
Subject: shutdown or reboot computer
Message-Id: <bk45ri$b6p$1@ns2.fe.internet.bosch.com>

Hello,

how can I reboot, shutdown(PowerOff) or change the user with a Perl Script ?




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

Date: 15 Sep 2003 11:19:52 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: shutdown or reboot computer
Message-Id: <bk478o$lt4$2@mamenchi.zrz.TU-Berlin.DE>

Jochen Friedmann <jochen.friedmann2@de.bosch.com> wrote in comp.lang.perl.misc:
> Hello,
> 
> how can I reboot, shutdown(PowerOff) or change the user with a Perl Script ?

First answer the question how to reboot, shut down, or change the user
by any any means in your OS.  Then ask yourself how to do the same things
in Perl.

Anno


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

Date: Mon, 15 Sep 2003 13:39:58 +0200
From: "Jochen Friedmann" <jochen.friedmann2@de.bosch.com>
Subject: Re: shutdown or reboot computer
Message-Id: <bk48ef$e0k$1@ns2.fe.internet.bosch.com>

Oh, sorry

the OS is Win2000 or WinnNT

"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:bk478o$lt4$2@mamenchi.zrz.TU-Berlin.DE...
> Jochen Friedmann <jochen.friedmann2@de.bosch.com> wrote in
comp.lang.perl.misc:
> > Hello,
> >
> > how can I reboot, shutdown(PowerOff) or change the user with a Perl
Script ?
>
> First answer the question how to reboot, shut down, or change the user
> by any any means in your OS.  Then ask yourself how to do the same things
> in Perl.
>
> Anno




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

Date: Mon, 15 Sep 2003 11:45:36 +0000 (UTC)
From: "Bernard El-Hagin" <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: shutdown or reboot computer
Message-Id: <Xns93F78BE01142Eelhber1lidotechnet@62.89.127.66>


[Please don't top-post. Thanks]


Jochen Friedmann wrote:

> "Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
> news:bk478o$lt4$2@mamenchi.zrz.TU-Berlin.DE...
>> Jochen Friedmann <jochen.friedmann2@de.bosch.com> wrote in
> comp.lang.perl.misc:
>> > Hello,
>> >
>> > how can I reboot, shutdown(PowerOff) or change the user with a Perl
> Script ?
>>
>> First answer the question how to reboot, shut down, or change the
>> user by any any means in your OS.  Then ask yourself how to do the
>> same things in Perl.
>
>
> Oh, sorry
> 
> the OS is Win2000 or WinnNT


I think you misunderstood. This isn't a Perl question until you find out 
(and tell us) how to achieve by other means what you're trying to achieve 
with Perl. And no, by "other means" I don't mean pressing the power button. 

:-)


-- 
Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'



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

Date: Mon, 15 Sep 2003 08:31:38 -0400
From: Cyde Weys <cyde@umd.edu>
Subject: Re: shutdown or reboot computer
Message-Id: <bk4bfa$7ij$1@grapevine.wam.umd.edu>

Jochen Friedmann wrote:
> Hello,
> 
> how can I reboot, shutdown(PowerOff) or change the user with a Perl Script ?
> 
> 

system('shutdown -h now');
system('reboot');
system("su -l $newUser");



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

Date: Mon, 15 Sep 2003 14:28:23 +0200
From: "Thomas Kratz" <ThomasKratz@REMOVEwebCAPS.de>
Subject: Re: shutdown or reboot computer
Message-Id: <3f65b0db.0@juno.wiesbaden.netsurf.de>

DQoiSm9jaGVuIEZyaWVkbWFubiIgPGpvY2hlbi5mcmllZG1hbm4yQGRlLmJvc2NoLmNvbT4gd3Jv
dGUgaW4gbmV3czpiazQ4ZWYkZTBrJDFAbnMyLmZlLmludGVybmV0LmJvc2NoLmNvbS4uLg0KPiBP
aCwgc29ycnkNCj4gDQo+IHRoZSBPUyBpcyBXaW4yMDAwIG9yIFdpbm5OVA0KPiANCg0KVGhlIHNj
cmlwdCBiZWxvdyBwcm92aWRlcyB0d28gZnVuY3Rpb25zIGZvciByZWJvb3QgYW5kIHNodXRkb3du
IGFuZCBzaG91bGQgd29yayBmb3IgbnQgdG8geHAuIA0KDQpUaG9tYXMNCg0KKioqIGJlZ2luIHNj
cmlwdCAqKioNCg0KdXNlIHN0cmljdDsNCnVzZSB3YXJuaW5nczsNCg0KdXNlIFdpbjMyOjpBUEk7
DQoNCnVzZSBjb25zdGFudCBFV1hfTE9HT0ZGICAgICAgICAgICAgICAgID0+IDA7DQp1c2UgY29u
c3RhbnQgRVdYX1NIVVRET1dOICAgICAgICAgICAgICA9PiAweDAxOw0KdXNlIGNvbnN0YW50IEVX
WF9SRUJPT1QgICAgICAgICAgICAgICAgPT4gMHgwMjsNCnVzZSBjb25zdGFudCBFV1hfRk9SQ0Ug
ICAgICAgICAg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W5ndGgoJHB0a3ApfTsNCiAgIG15KCRi
dWZmKSA9IHBhY2soJ0wnLCAwKTsNCiAgIG15KCRkaXNhYmxlKSA9IHBhY2soJ0wnLCAwKTsNCg0K
ICAgcHJpbnQgImNhbGxpbmcgQWRqdXN0VG9rZW5Qcml2aWxlZ2VzKClcbiI7DQogICAkcmMgPSAk
QWRqdXN0VG9rZW5Qcml2aWxlZ2VzLT5DYWxsKA0KICAgICAgJHRva2VuLCAkZGlzYWJsZSwgJHRr
cCwgJHB0a3Bfc2l6ZSwgJHB0a3AsICRidWZmDQogICApOw0KDQogICByZXR1cm4gdW5sZXNzICRy
YzsNCg0KICAgcmV0dXJuKDEpOw0KfQ0KDQpzdWIgUmVib290IHsNCiAgIHJldHVybigkRXhpdFdp
bmRvd3NFeC0+Q2FsbChFV1hfUkVCT09ULCAwKSk7DQp9DQoNCnN1YiBQb3dlcmRvd24gew0KICAg
cmV0dXJuKCRFeGl0V2luZG93c0V4LT5DYWxsKEVXWF9TSFVURE9XTiB8IEVXWF9QT1dFUk9GRiwg
MCkpOw0KfQ0KDQoqKiogZW5kIHNjcmlwdCAqKioNCg0K



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

Date: Mon, 15 Sep 2003 21:22:06 +0900
From: ko <kuujinbo@hotmail.com>
Subject: Re: shutdown or reboot computer
Message-Id: <bk4b00$dnd$1@pin3.tky.plala.or.jp>

Jochen Friedmann wrote:

> Hello,
> 
> how can I reboot, shutdown(PowerOff) or change the user with a Perl Script ?
> 
> 

Please read the posting guidelines under what you 'Really Really Should' 
do before posting - you may find your answer quicker that way:

http://mail.augustmail.com/~tadmc/clpmisc.shtml

Google search in comp.lang.perl.misc for 'windows shutdown' group (2nd 
match) turns up the following (may be wrapped):

http://groups.google.com/groups?q=windows+shutdown+group:comp.lang.perl.misc&hl=en&lr=&ie=UTF-8&group=comp.lang.perl.misc&selm=E16x2.3175%24lx.1210%40news2.giganews.com&rnum=2

Or you could have tried 'perldoc win32' and found the Win32 
InitiateSystemShutdown() function.

HTH - keith



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

Date: Mon, 15 Sep 2003 14:33:42 +0200
From: "Thomas Kratz" <ThomasKratz@REMOVEwebCAPS.de>
Subject: Re: shutdown or reboot computer
Message-Id: <3f65b21a.0@juno.wiesbaden.netsurf.de>

DQoiVGhvbWFzIEtyYXR6IiA8VGhvbWFzS3JhdHpAUkVNT1ZFd2ViQ0FQUy5kZT4gd3JvdGUgaW4g
IG5ld3M6M2Y2NWIwZGIuMEBqdW5vLndpZXNiYWRlbi5uZXRzdXJmLmRlLi4uDQo+IA0KPiAiSm9j
aGVuIEZyaWVkbWFubiIgPGpvY2hlbi5mcmllZG1hbm4yQGRlLmJvc2NoLmNvbT4gd3JvdGUgaW4g
bmV3czpiazQ4ZWYkZTBrJDFAbnMyLmZlLmludGVybmV0LmJvc2NoLmNvbS4uLg0KPiA+IE9oLCBz
b3JyeQ0KPiA+IA0KPiA+IHRoZSBPUyBpcyBXaW4yMDAwIG9yIFdpbm5OVA0KPiA+IA0KPiANCj4g
VGhlIHNjcmlwdCBiZWxvdyBwcm92aWRlcyB0d28gZnVuY3Rpb25zIGZvciByZWJvb3QgYW5kIHNo
dXRkb3duIGFuZCBzaG91bGQgd29yayBmb3IgbnQgdG8geHAuIA0KPiANCj4gVGhvbWFzDQoNCkkg
Zm9yZ290IHRvIG1lbnRpb24sIHRoYXQgcHJpb3IgdG8gY2FsbGluZyBSZWJvb3Qgb3IgUG93ZXJk
b3duLCB5b3UnbGwgaGF2ZSB0byBjYWxsIEFkanVzdFRva2VuKCkgZmlyc3QgYW5kIGNoZWNrIGZv
ciBzdWNjZXNzLiBBbmQgdGhlIHByaW50IHN0YXRlbWVudHMgc2hvdWxkIGJlIHJlbW92ZWQgZm9y
IHByb2R1Y3Rpb24gOi0pDQoNClRob21hcw==



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

Date: Mon, 15 Sep 2003 13:45:08 +0200
From: "Jochen Friedmann" <jochen.friedmann2@de.bosch.com>
Subject: Subroutine as a new Task
Message-Id: <bk48o4$ea4$1@ns2.fe.internet.bosch.com>

Hello,

how can I start a soubroutine as a new task.
The main script should run on until the end is reached.
But the subroutine should run in another task where I can work with it.
OS: Win200,WinNT




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

Date: Mon, 15 Sep 2003 10:06:15
From: "NOMORE" <zxvsdgs@freeuk.com>
Subject: THOSE ANNOYING POP UP MESSAGES.
Message-Id: <bif9b.1019$fX1.160103@newsfep2-gui.server.ntli.net>

Want to stop those annoying pop up messages
Without spending $30+ on software.
I will show you how http://savea4tune.net/nomorepopups.htm



























































































































































































































 ............................................................................................................


---
MAF Anti-Spam ID: 20030907125819Y7x6RvG8




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

Date: 15 Sep 2003 09:05:42 GMT
From: Heinrich.Mislik@univie.ac.at (Heinrich Mislik)
Subject: Re: Tring to kill my kids, but they are stuborn little bastards!
Message-Id: <3f6580e1$0$12398$3b214f66@usenet.univie.ac.at>

In article <3F64B2EB.3E7E39CA@dmcontact.com>, eric@dmcontact.com says...

I didn' test this, but please consider the following:

[code snipped]

>while (my $connection = $listen_socket->accept()) {
>
>    my $pid;
>        if (!defined($pid = fork)) {
>            logmsg "cannot fork: $!";
>
>        }elsif ($pid) {
>            logmsg "begat $pid";
>        }else{
>            # else i'm the child -- go spawn
>           print $connection "Command?";
>        while ( <$connection> ){
>
>                if    (/quit|exit/i)    {
>last;                            }

This gets the child out of the 'while ( <$connection> )' loop, but leaves it in the 'while (my $connection = $listen_socket->accept())' loop. So the child never dies, but listens for new connections.
Entering the command dieT at your prompt should really kill the child.


>                elsif (/closeme/i )    
>{$connection->close();             }
>                elsif (/date|time/i)    { printf $connection "%s\n",
>scalar localtime;  }
>                elsif (/who/i )         { print  $connection `who
>2>&1`;   }
>                elsif (/dienow/i )      { alarm
>2;                         }
>                elsif (/dieT/i )        {
>die;                             }

dieT is a typo, isn't it.

hth.

-- 
Heinrich Mislik
Zentraler Informatikdienst der Universitaet Wien
A-1010 Wien, Universitaetsstrasse 7
Tel.: (+43 1) 4277-14056, Fax: (+43 1) 4277-9140



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

Date: 15 Sep 2003 00:25:19 -0700
From: fumail@freeuk.com (qanda)
Subject: variable file glob into grep without glob()
Message-Id: <62b4710f.0309142325.22b341c@posting.google.com>

Hope I don't get shot for posting again, but I really need help with
this ...

I want to process lots (thousands) of files.  I want to take a file
glob from the command line and pass it into a grep.  If I could write
the file glob (file*.ext for example) directly I would do ...

    local @ARGV = grep /file.*\.ext/, readir CURDIR;

However I need to take the glob from the command line.  I can't use
the Perl glob as I am restricted to Perl 5.005 which dosen't work with
large argument strings and the only overhead I want for the user is to
possibly quote the glob, maybe myscript "file*.ext"; I do not want
them using find and/or xargs.

Thanks.


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

Date: 15 Sep 2003 08:27:55 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: variable file glob into grep without glob()
Message-Id: <bk3t6b$dk0$1@nets3.rz.RWTH-Aachen.DE>

Also sprach qanda:

> Hope I don't get shot for posting again, but I really need help with
> this ...
> 
> I want to process lots (thousands) of files.  I want to take a file
> glob from the command line and pass it into a grep.  If I could write
> the file glob (file*.ext for example) directly I would do ...
> 
>     local @ARGV = grep /file.*\.ext/, readir CURDIR;
> 
> However I need to take the glob from the command line.  I can't use
> the Perl glob as I am restricted to Perl 5.005 which dosen't work with
> large argument strings and the only overhead I want for the user is to
> possibly quote the glob, maybe myscript "file*.ext"; I do not want
> them using find and/or xargs.

In this case translate the glob pattern into a regular expression. You
don't have to do that yourself but let Text::Glob from the CPAN do this
work for you:

    use Text::Glob qw(glob_to_regex);
    ...
    my $pat = glob_to_regex(shift);
    local @ARGV = grep /$pat/, readir CURDIR;

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


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

Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: 
Message-Id: <3F18A600.3040306@rochester.rr.com>

Ron wrote:

> Tried this code get a server 500 error.
> 
> Anyone know what's wrong with it?
> 
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {

(---^


>     dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
 ...
> Ron

 ...
-- 
Bob Walton



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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 5505
***************************************


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