[26211] in Perl-Users-Digest
Perl-Users Digest, Issue: 8397 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 8 14:05:31 2005
Date: Thu, 8 Sep 2005 11:05:04 -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 Thu, 8 Sep 2005 Volume: 10 Number: 8397
Today's topics:
Re: <> and filehandles in hashes <BZ@caradhras.net>
Re: application question <jgibson@mail.arc.nasa.gov>
How do I run a perl command on my web host? <no@email.com>
Re: Launching And Detaching <hal@thresholddigital.com>
scalar variable in system command function <everythingelse@bobotheclown.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 8 Sep 2005 13:20:21 GMT
From: BZ <BZ@caradhras.net>
Subject: Re: <> and filehandles in hashes
Message-Id: <slrndi0ekl.n56.BZ@kalypso.caradhras.net>
Dave Weaver wrote in comp.lang.perl.misc:
> Taken from `perldoc perlop`:
> If what the angle brackets contain is a simple scalar variable
> (e.g., <$foo>), then that variable contains the name of the
> filehandle to input from, or its typeglob, or a reference to the
> same. For example:
> $fh = \*STDIN;
> $line = <$fh>;
> If what's within the angle brackets is neither a filehandle nor a
> simple scalar variable containing a filehandle name, typeglob,
> or typeglob reference, it is interpreted as a filename pattern to
> be globbed, and either a list of filenames or the next filename
> in the list is returned, depending on context.
ahh, thanks. Must have overlooked that.
--
BZ
------------------------------
Date: Thu, 08 Sep 2005 07:20:12 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: application question
Message-Id: <080920050720121737%jgibson@mail.arc.nasa.gov>
In article <431fb6a5$0$769$3a628fcd@reader10.nntp.hccnet.nl>, Huub
wrote:
> Hi,
>
> I have to do a project that will combine computergraphics, AI and
> scripting. I know perl can be used for AI and scripting, but how about
> graphics (e.g. OpenGL)? I read the faq, but couldn't find an answer on that.
Look at the CPAN website http://www.cpan.org for Perl graphics modules.
In particular, check out the GD module and its brethren for Perl access
to the powerful GD Graphics Library. See http://search.cpan.org and
click on the "Graphics" category.
There is also a book "Perl Graphics Programming", S. Wallace, O'Reilly,
2002, that might be on topic. Maybe you can find it in your school
library.
Good luck!
------------------------------
Date: Thu, 08 Sep 2005 15:44:10 GMT
From: vbMark <no@email.com>
Subject: How do I run a perl command on my web host?
Message-Id: <Xns96CB776294E7Bvbmark@199.45.49.11>
Hello,
I am running my web site on a web host that I don't own or have access to
the server itself other than FTP and my control panel.
I need to run a perl script from the command line. How do I do this? Do I
do something like Telnet in or what?
Thanks!
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Get freeware
http://www.vbmark.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
------------------------------
Date: Thu, 08 Sep 2005 11:36:03 -0400
From: Hal Vaughan <hal@thresholddigital.com>
Subject: Re: Launching And Detaching
Message-Id: <7M2dndebKpT-x73eRVn-sw@comcast.com>
axel@white-eagle.invalid.uk wrote:
> Hal Vaughan <hal@thresholddigital.com> wrote:
>> I'm using one simple program to launch some daemons. When I launch a
>> program, I use backticks. (This is all on Linux, in bash, btw.) I've
>> added "2>&1 >/dev/null &" to the command line, so it's like this:
>>
>> `/path/to/program 2>&1 >/dev/null &`;
>>
>> I've noticed that if I include the '&' so the program detaches from the
>> shell, if I kill the launching program, the child process survives. I've
>> also tried this by forking first:
>>
>> if (!fork()) {
>> `/path/to/program 2>&1 >/dev/null &`;
>> exit;
>> }
>>
>> I had the hope that if I forked and launched like this, once all the
>> programs were launched, the launching program would exit. It doesn't.
>> Is there a way I can launch a program, then have the first program exit,
>> so it's no longer using that bash instance (without killing it)?
>
> You should not been using backticks for this purpose - they
> are designed to collect data from the external program
> and will wait for that program.
>
> Have a look at: perldoc -f exec
>
> Axel
A good idea. I was just reading up on it and didn't even know about that
function. Thanks!
Hal
------------------------------
Date: Thu, 08 Sep 2005 16:22:34 GMT
From: Rocky Allen <everythingelse@bobotheclown.org>
Subject: scalar variable in system command function
Message-Id: <pan.2005.09.08.16.23.19.410271@bobotheclown.org>
I have an odd problem with the $file variable listed in the loop below
the syntax of unix split command is as follows:
Usage: split [OPTION] [INPUT [PREFIX]] and split will default to "x" as a
prefix
here is the output of this script (i ^c it)
found file rallen.tar.gz
error splitting file rallen.tar.gz
:2 at ./perl-ATSDailyback line 49.
it remembers the $file variable before and after the system command runs,
but it doesnt add "$file." as a prefix
any thoughts?
thanks in advance
#!/usr/bin/perl
use strict;
use warnings;
use Sys::Hostname;
use POSIX qw/strftime/;
my $error ;
my @errors;
my @filestobackup;
# Variables. This section will need to be modified for each Cooperative.
my $host = hostname;
my $jobstart = localtime();
my $fileformat = strftime('contents-%Y-%m-%d_%H:%M:%S', localtime);
my $contentsfile = "/etc/backup/$fileformat";
my $errorfile = '/tmp/cpioerrors';
my @dirs = ('/working');
my $finderrors = '/tmp/finderrors';
my @largefiles;
#my @tapestat = `mt -f /dev/st0 status`;
#if (scalar(@tapestat) == 0) {
# print "No tape in drive or no tape device on server\n";
# exit 0;
#}
foreach my $backupdir (@dirs) {
chdir($backupdir);
@largefiles = `find . -follow -size +2147483648c -print 2>/tmp/largefilerr`;
foreach my $file (@largefiles) {
$file =~ s/\.\///;
print "found file $file";
system("split -d --bytes=2000000000 $file $file.") == 0 or die "error splitting file $file:$?";
}
@filestobackup = `find $backupdir -follow -print 2> $finderrors`;
}
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 8397
***************************************