[23476] in Perl-Users-Digest
Perl-Users Digest, Issue: 5690 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 21 11:05:53 2003
Date: Tue, 21 Oct 2003 08:05: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 Tue, 21 Oct 2003 Volume: 10 Number: 5690
Today's topics:
Re: Arguments to CORE::pipe? <newspost@coppit.org>
Re: Arguments to CORE::pipe? <newspost@coppit.org>
Re: Arguments to CORE::pipe? <grazz@pobox.com>
chmod 666 not working from perl script <dingdongy2k@hotmail.com>
Re: chmod 666 not working from perl script <noreply@gunnar.cc>
Re: chmod 666 not working from perl script <dingdongy2k@hotmail.com>
Re: chmod 666 not working from perl script <noreply@gunnar.cc>
Re: chmod 666 not working from perl script (Villy Kruse)
Re: chmod 666 not working from perl script <noreply@gunnar.cc>
commands, which is better <robertw@nospam.acm.org>
Re: commands, which is better <some@one.com>
Re: converting date/time to timestamp <newspost@coppit.org>
Re: DBI & primary keys <tore@aursand.no>
Re: escape email quotes (Sam Holden)
Re: Get the current line and next 5 lines (Michael Wang)
Re: IO::Socket::INET - Listen on exactly two IPs the sa (Kai Bleek)
performance arrays vs hashes (Thomas)
Re: performance arrays vs hashes <bernard.el-haginDODGE_THIS@lido-tech.net>
Perl and IIS - script runs but 'The page cannot be disp (stew dean)
Re: rsh & perl -Directory creation not possible <me@privacy.net>
Re: Setting config file using constant (Tad McClellan)
Re: some help (Hernan)
Use in if..elsif <smario@rol.ru>
Re: Use in if..elsif <andy@shitov.ru>
Re: Use in if..elsif <kuujinbo@hotmail.com>
Re: Use in if..elsif <smario@rol.ru>
Re: Use in if..elsif <andy@shitov.ru>
Re: Use in if..elsif <andy@shitov.ru>
Re: Use in if..elsif <andy@shitov.ru>
Re: Use in if..elsif <andy@shitov.ru>
Re: Use in if..elsif <andy@shitov.ru>
Re: Use in if..elsif <andy@shitov.ru>
Re: Use in if..elsif <andy@shitov.ru>
Re: using perl on the command line, like sed or awk <me@privacy.net>
Re: using perl on the command line, like sed or awk <raisin@delete-this-trash.mts.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 21 Oct 2003 12:18:21 GMT
From: David Coppit <newspost@coppit.org>
Subject: Re: Arguments to CORE::pipe?
Message-Id: <Pine.BSF.4.56.0310210808330.78726@www.provisio.net>
[courtesy copy sent to author]
On Tue, 21 Oct 2003, Steve Grazzini wrote:
> David Coppit <newspost@coppit.org> wrote:
> > What are the arguments to CORE::pipe? Does it check that the arguments are
> > either filehandle globs or UNIVERSAL::isa('IO::Handle')?
>
> The arguments have to be globs -- but you can pass barewords, normal strings,
> glob references, undefined scalars, or the *FOO{IO} references and perl will
> find the glob automatically.
Okay, if I understand you correctly, the problem is that Perl doesn't know how
to find my glob via "tied(*$r)->{'fh'}". Is the correct solution to export a
custom pipe() that overrides CORE::pipe, and hope that no one tries to do the
same thing?
I want this to be a drop-in replacement for FileHandle, so I don't want to
require clients to rewrite all their calls to pipe() to use the hidden
filehandle. Here's what I'm thinking of:
sub pipe
{
# Called like CORE::pipe ($fh1, $fh2)
if(@_)
{
my ($fh1, $fh2);
if (UNIVERSAL::isa($_[0],__PACKAGE__))
{
$fh1 = ${*{$_[0]}}->{'fh'};
}
else
{
$fh1 = $_[0];
}
if (UNIVERSAL::isa($_[1],__PACKAGE__))
{
$fh2 = ${*{$_[1]}}->{'fh'};
}
else
{
$fh2 = $_[1];
}
CORE::pipe($fh1, $fh2) or return undef;
return ($_[0], $_[1]);
}
# Called like ($r,$w) = FileHandle::pipe()
else
{
my $rfh = new FileHandle;
my $wfh = new FileHandle;
my $r = new FileHandle::Unget($rfh);
my $w = new FileHandle::Unget($wfh);
CORE::pipe($rfh, $wfh) or return undef;
return ($r, $w);
}
}
This seems to work okay, but I'd rather not override the definition of
CORE::pipe.
------
> > The reason I ask is that I've written a wrapper class for FileHandle, and
> > CORE::pipe doesn't seem to be working even though I believe I've tied what I
> > need to and proxied every method in FileHandle to the wrapped filehandle.
>
> Okay, when you do
>
> my $r = FileHandle::Unget->new;
>
> Then $r is a blessed glob reference, and the glob is tied to a hash reference
> like this:
>
> tied(*$r) ---> { fh => FileHandle->new, buffer => '' }
>
> And then I think you borrow the scalar slot of the glob to hold the hashref.
>
> ${*$r} = tied(*$r);
>
> And then some/all of the methods are delegated to ${*$r}->{fh}.
>
> Right?
Right. All methods are delegated but a couple.
> Now, so far, you haven't opened ${*$r}->{fh}, and you seem to expect
>
> pipe($r,$w)
>
> to initialize it -- but pipe() will just use *$r instead. You pass it a
> glob reference and it will use that glob reference for the filehandle.
No... The filehandle is initialized in TIEHANDLE during object construction
via new().
Thanks,
David
------------------------------
Date: Tue, 21 Oct 2003 12:56:42 GMT
From: David Coppit <newspost@coppit.org>
Subject: Re: Arguments to CORE::pipe?
Message-Id: <Pine.BSF.4.56.0310210854180.92972@www.provisio.net>
On Tue, 21 Oct 2003, David Coppit wrote:
> Okay, if I understand you correctly, the problem is that Perl doesn't know how
> to find my glob via "tied(*$r)->{'fh'}". Is the correct solution to export a
> custom pipe() that overrides CORE::pipe, and hope that no one tries to do the
> same thing?
Is there some sort of "automatic cast to glob" that I can define? I just
realized I also do -t, -S, and -p on the FileHandle wrapper object--I'm
guessing those operators are also trying to get to the glob.
Thanks,
David
------------------------------
Date: Tue, 21 Oct 2003 14:56:18 GMT
From: Steve Grazzini <grazz@pobox.com>
Subject: Re: Arguments to CORE::pipe?
Message-Id: <mOblb.9450$PZ1.2338@nwrdny03.gnilink.net>
David Coppit <newspost@coppit.org> wrote:
> On Tue, 21 Oct 2003, David Coppit wrote:
>
>> Okay, if I understand you correctly, the problem is that Perl doesn't
>> know how to find my glob via "tied(*$r)->{'fh'}".
Right.
>> Is the correct solution to export a
>> custom pipe() that overrides CORE::pipe, and hope that no one tries to
>> do the same thing?
I would have tried (not sure if it's practical) to use *$r as the
real glob/filehandle instead of tied(*$r)->{fh}. The problem with
overriding CORE::pipe is that you can't get the same semantics as
the builtin. All the stuff perl does to turn strings, barewords,
etc into globs doesn't work with "sub pipe (**)" the way it works
with CORE::pipe.
> Is there some sort of "automatic cast to glob" that I can define? I just
> realized I also do -t, -S, and -p on the FileHandle wrapper object--I'm
> guessing those operators are also trying to get to the glob.
This might work too -- instead of using TIEHANDLE, you could bless a
non-glob reference and overload '*{}'.
--
Steve
------------------------------
Date: Tue, 21 Oct 2003 12:16:02 GMT
From: "Travis" <dingdongy2k@hotmail.com>
Subject: chmod 666 not working from perl script
Message-Id: <6s9lb.8255$W16.3189@newsread2.news.atl.earthlink.net>
chmod(0666, $actfileback);
use File::Copy;
$status = copy( $actfile, $actfileback );
This works fine if I first create the file in $actfileback
BUT I have to set chmod 666 from my ftp program.
When I create the file but try to set the chmod 666 as I have shown
above it apparently does not set the 666 since the copy does not work.
Any ideas what I did wrong?
Also, is there any way to do the copy without first creating the file?
Thanks
Travis
------------------------------
Date: Tue, 21 Oct 2003 14:43:41 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: chmod 666 not working from perl script
Message-Id: <bn39pc$t2a9v$1@ID-184292.news.uni-berlin.de>
Travis wrote:
> chmod(0666, $actfileback);
> use File::Copy;
> $status = copy( $actfile, $actfileback );
>
> This works fine if I first create the file in $actfileback BUT I
> have to set chmod 666 from my ftp program.
>
> When I create the file but try to set the chmod 666 as I have shown
> above it apparently does not set the 666 since the copy does not
> work.
>
> Any ideas what I did wrong?
It seems like it might be a user ID and file ownership problem.
Are you running the Perl program as a CGI script? In that case, you
may be running it as some other user (for instance 'nobody'). In that
case, if you first create a file by uploading it via FTP from your
hard disk, the file owner is not the same as the user that the script
is run as. Consequently you cannot chmod the file. That is not a Perl
problem, but a *nix thing.
> Also, is there any way to do the copy without first creating the
> file?
Yes. But you must ensure that the Perl program (possibly the CGI
script) has write access to the directory where the backup file is
saved. That may require that you chmod the directory 777 in advance.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Tue, 21 Oct 2003 13:13:08 GMT
From: "Travis" <dingdongy2k@hotmail.com>
Subject: Re: chmod 666 not working from perl script
Message-Id: <Ehalb.8321$W16.5580@newsread2.news.atl.earthlink.net>
It is being run as a .cgi script.
What is a *nix thing?
If I create the file from the .cgi script should that
eliminate the owner problem?
In the second case where I create the file at the time of the copy, since
the file
is obviously not there, then I assume there is no chmod needed?
"Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote in message
news:bn39pc$t2a9v$1@ID-184292.news.uni-berlin.de...
> Travis wrote:
> > chmod(0666, $actfileback);
> > use File::Copy;
> > $status = copy( $actfile, $actfileback );
> >
> > This works fine if I first create the file in $actfileback BUT I
> > have to set chmod 666 from my ftp program.
> >
> > When I create the file but try to set the chmod 666 as I have shown
> > above it apparently does not set the 666 since the copy does not
> > work.
> >
> > Any ideas what I did wrong?
>
> It seems like it might be a user ID and file ownership problem.
>
> Are you running the Perl program as a CGI script? In that case, you
> may be running it as some other user (for instance 'nobody'). In that
> case, if you first create a file by uploading it via FTP from your
> hard disk, the file owner is not the same as the user that the script
> is run as. Consequently you cannot chmod the file. That is not a Perl
> problem, but a *nix thing.
>
> > Also, is there any way to do the copy without first creating the
> > file?
>
> Yes. But you must ensure that the Perl program (possibly the CGI
> script) has write access to the directory where the backup file is
> saved. That may require that you chmod the directory 777 in advance.
>
> --
> Gunnar Hjalmarsson
> Email: http://www.gunnar.cc/cgi-bin/contact.pl
>
------------------------------
Date: Tue, 21 Oct 2003 15:30:02 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: chmod 666 not working from perl script
Message-Id: <bn3cga$spte9$1@ID-184292.news.uni-berlin.de>
Travis wrote:
> It is being run as a .cgi script.
>
> What is a *nix thing?
I'm talking about permissions etc. on Unix and Linux file systems.
> If I create the file from the .cgi script should that eliminate the
> owner problem?
Yes. It would make the user ID that the CGI script is run as the file
owner, which would give the CGI script write access 'automatically'.
> In the second case where I create the file at the time of the copy,
> since the file is obviously not there, then I assume there is no
> chmod needed?
Right.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 21 Oct 2003 14:13:57 GMT
From: vek@station02.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: chmod 666 not working from perl script
Message-Id: <slrnbpafp5.70l.vek@station02.ohout.pharmapartners.nl>
On Tue, 21 Oct 2003 15:30:02 +0200,
Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
>Travis wrote:
>> It is being run as a .cgi script.
>>
>> What is a *nix thing?
>
>I'm talking about permissions etc. on Unix and Linux file systems.
>
>> If I create the file from the .cgi script should that eliminate the
>> owner problem?
>
>Yes. It would make the user ID that the CGI script is run as the file
>owner, which would give the CGI script write access 'automatically'.
>
>> In the second case where I create the file at the time of the copy,
>> since the file is obviously not there, then I assume there is no
>> chmod needed?
>
>Right.
>
And if the file is not owned by the user which runs the program chmod
will return a permission error, which would have been revealed of the OP
had checked for errors.
Villy
------------------------------
Date: Tue, 21 Oct 2003 16:33:23 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: chmod 666 not working from perl script
Message-Id: <bn3g73$t0hpa$1@ID-184292.news.uni-berlin.de>
Villy Kruse wrote:
> And if the file is not owned by the user which runs the program
> chmod will return a permission error, which would have been
> revealed of the OP had checked for errors.
True, i.e. it would have returned "Operation not permitted". I'm not
sure, though, that it would have been enough to resolve the problem.
Nevertheless, it would have been a slightly better starting point than
"does not set the 666". ;-)
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Tue, 21 Oct 2003 10:44:42 -0400
From: Robert Wallace <robertw@nospam.acm.org>
Subject: commands, which is better
Message-Id: <3F95465A.1C912A48@nospam.acm.org>
i'm trying to run a system command like ls,dir,ping,uptime, etc...
I tried the following two methods. both works. both produce the same
output.
is there a difference? is there a situation where I would use one over
the other?
I guess the open allows me to do more on-the-fly stuff.
what else?
# this one ##########################################################
open (SYS, "/temp/uptime.exe |");
while($the_sys = <SYS>){
$the_sys =~ s/\015\012/<br>\015\012/g;
print $the_sys . "<br>\n";
}
close (SYS);
# and this one
##########################################################
$sys=`/temp/uptime.exe`;
$sys=~s/\015\012/<br>\015\012/g;
print $sys;
------------------------------
Date: Tue, 21 Oct 2003 15:01:32 GMT
From: Anand <some@one.com>
Subject: Re: commands, which is better
Message-Id: <gTblb.5457$8x2.2866022@newssrv26.news.prodigy.com>
second one will fork new process as you are using *NIX thing. If you do
not want to create new process (which will take some or more system
resources) you are better off using PURE perl as in case of first example.
--Anand
Robert Wallace wrote:
> i'm trying to run a system command like ls,dir,ping,uptime, etc...
>
> I tried the following two methods. both works. both produce the same
> output.
> is there a difference? is there a situation where I would use one over
> the other?
> I guess the open allows me to do more on-the-fly stuff.
> what else?
>
>
>
> # this one ##########################################################
> open (SYS, "/temp/uptime.exe |");
> while($the_sys = <SYS>){
> $the_sys =~ s/\015\012/<br>\015\012/g;
> print $the_sys . "<br>\n";
> }
> close (SYS);
>
>
> # and this one
> ##########################################################
> $sys=`/temp/uptime.exe`;
> $sys=~s/\015\012/<br>\015\012/g;
> print $sys;
------------------------------
Date: Tue, 21 Oct 2003 14:32:42 GMT
From: David Coppit <newspost@coppit.org>
Subject: Re: converting date/time to timestamp
Message-Id: <Pine.BSF.4.56.0310211032020.95470@www.provisio.net>
On Tue, 21 Oct 2003, David Oswald wrote:
> There is also a very convenient module on CPAN called Date::Manip.
Date::Parse may also be useful. It's faster than Date::Manip but less
featureful (including its parsing capabilities).
David
------------------------------
Date: Tue, 21 Oct 2003 13:17:14 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: DBI & primary keys
Message-Id: <pan.2003.10.21.10.48.34.573607@aursand.no>
On Tue, 21 Oct 2003 09:40:42 +0100, Bigus wrote:
> I'm inserting a new record into a MySQL table using Perl DBI. I need to
> retrieve the unique primary key that's created automatically by the db as
> the new record is inserted.
You could try this approach:
# do the insert
my $id = $stInsert->{'mysql_insertid'};
As you can see, this approach is very MySQL'ish. If you are 110% sure
that your application always will make use of MySQL, you could stick with
this one.
A better solution must be to use transactions, but I'm not quite updated
on the transaction support in MySQL. You could of course give PostgreSQL
a try, which is a fairly more "mature" RDBMS.
In the early days I created an application which would run on a set of
different database systems. The solution was to use an extra field in
every table as a lookup field (see above). Surely not a clever way to do
it, but it worked very well.
my $using_mysql = ( $Config->{'DB_TYPE'} eq 'mysql' ) ? 1 : 0;
my $temp_id = ( $using_mysql ) ? $Misc->random_number() : 0;
my $insert_id = 0;
my $stInsert = $dbh->prepare('INSERT INTO user (..., temp_id)
VALUES (..., ?)' );
$stInsert->execute( $temp_id );
$stInsert->finish();
if ( $using_mysql ) {
$insert_id = $stInsert->{'mysql_insertid'};
}
else {
my $stLookup = $dbh->prepare('SELECT user_id
FROM user
WHERE temp_id = ?');
$stLookup->execute( $temp_id );
( $insert_id ) = $stLookup->fetchrow();
$stLookup->finish();
my $stRemoveTempID = $dbh->prepare('UPDATE user
SET temp_id = 0
WHERE user_id = ?');
$stRemoveTempID->execute( $insert_id );
$stRemoveTempID->finish();
}
Quite hairy, huh? :-)
--
Tore Aursand <tore@aursand.no>
------------------------------
Date: 21 Oct 2003 10:22:25 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: escape email quotes
Message-Id: <slrnbpa271.l2.sholden@flexal.cs.usyd.edu.au>
On Tue, 21 Oct 2003 10:59:01 +0100,
news@roaima.freeserve.co.uk <news@roaima.freeserve.co.uk> wrote:
> Kimberly Baderhoefen <kim@foo.com> wrote:
>> My script is getting an email address passed to it as one of the
>> arguments through getopt. [...] When I send email to the variable that
>> the email addess is stored in, it bounces because perl does not escape
>> the "@" symbol in the variable.
>
> Why do you think perl should need to escape the @ symbol?
[snip]
> print MAIL "From: whoever@wherever\n";
Why don't you try that and see what actually happens. Turning on
warnings will make the problem blindingly obvious.
That's completely different from the OP's question, since his @ symbol
isn't in a double quoted perl string according to his description.
But you just answered your own question in a different context...
--
Sam Holden
------------------------------
Date: Tue, 21 Oct 2003 10:52:22 GMT
From: mwang@unixlabplus.com (Michael Wang)
Subject: Re: Get the current line and next 5 lines
Message-Id: <Gd8lb.1066$Yp5.2595@news.uswest.net>
In article <700e6ff4.0310210226.704da808@posting.google.com>,
Larry Doan <doan_larry@hotmail.com> wrote:
>In a shell script or Perl, how do I open a file, find what I'm looking then
>
>Case 1: grab that line + the next 2 lines
>Case 2: grab that line + the previous 2 lines?
1 set --
2 while IFS= read -r LINE; do
3 set -- "$@" "a$LINE"
4 [[ -n $4 ]] && shift
5 [[ $LINE == *"that line"* ]] && {
6 [[ -n $1 ]] && printf "%s\n" "${1#a}"
7 [[ -n $2 ]] && printf "%s\n" "${2#a}"
8 printf "%s\n" "$LINE"
9 IFS= read -r LINE && printf "%s\n" "$LINE"
10 IFS= read -r LINE && printf "%s\n" "$LINE"
11 set --
12 }
13 done
for case 1, comment out line 6 and 7.
for case 2, comment out line 8 and 9.
for first occurance of "that line" instead of every occurance,
replace line 11 with "break".
Thanks.
--
Michael Wang * http://www.unixlabplus.com/ * mwang@unixlabplus.com
------------------------------
Date: 21 Oct 2003 03:45:40 -0700
From: public@spellweaver.de (Kai Bleek)
Subject: Re: IO::Socket::INET - Listen on exactly two IPs the same time?
Message-Id: <4b1ad64e.0310210245.594e1815@posting.google.com>
> the socket system only allows binding to one IP/port pair or wildcarding
> any IP with a single port.
Hm, well, that's a pity.
> the easiest way would be to listen on each desired IP with the same port
> and use an event loop or io::select to handle the multiple listen
> sockets. once you get a connected socket you can treat them all the same
> if needed or differently based on the listen IP. you can get the listen
> IP from the socket with the getsockaddr call
I took a look at the IO::Select module and with a little
code-rewriting it does the job. Had some problems with forking first,
but that's solved now, too!
Many thanks for the help!
Best regards,
Kai
If it was of any interest, this is how I'm using the select:
# defining two objects
my $server_remote = IO::Socket::INET->new(LocalAddr => '192.168.0.60',
...);
my $server_local = IO::Socket::INET->new(LocalAddr => '127.0.0.1',
...);
# Adding to select:
my $read_set = new IO::Select();
$read_set->add($server_remote);
$read_set->add($server_local);
# entering loop
while (1) {
my @select_set = $read_set->can_read;
foreach my $server (@select_set) {
# distinguish between socket-IPs
if ($server == $server_remote) {
my $connect = $server->accept();
$read_set->add($connect);
# some Code...
$read_set->remove($connect);
$connect->close;
} elsif ($server == $server_local) {
my $connect = $server->accept();
$read_set->add($connect);
# some different code
$read_set->remove($connect);
$connect->close;
}
}
}
------------------------------
Date: 21 Oct 2003 07:08:38 -0700
From: sctommi@gmx.net (Thomas)
Subject: performance arrays vs hashes
Message-Id: <5a1109df.0310210608.4d46b69d@posting.google.com>
hi,
i dont know enough of perl to describe,
using hashes is better than using arrays...(or isnt so ?)
i dont know how to ask some 'google' machine for this kind of question,
but i hope we have some "perl guru's" here, whose like to answer
best regards
Thomas
------------------------------
Date: Tue, 21 Oct 2003 14:23:57 +0000 (UTC)
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: performance arrays vs hashes
Message-Id: <Xns941BA69EB1E9Felhber1lidotechnet@62.89.127.66>
sctommi@gmx.net (Thomas) wrote in
news:5a1109df.0310210608.4d46b69d@posting.google.com:
> hi,
>
> i dont know enough of perl to describe,
> using hashes is better than using arrays...(or isnt so ?)
You can't really say that using hashes is better than using arrays. It
depends on what you want to do. What *do* you want to do?
Basically, using hashes is better when a hash is what you need. Using an
array is better when an array is what you need. That's all there's to it.
Read about both in
perldoc perlvar
And tell us what you're trying to accomplish and maybe we can help you
decide what to use.
Cheers,
Bernard
------------------------------
Date: 21 Oct 2003 03:53:24 -0700
From: stewart@webslave.dircon.co.uk (stew dean)
Subject: Perl and IIS - script runs but 'The page cannot be displayed'
Message-Id: <2b68957a.0310210253.38464359@posting.google.com>
This is not a pure Perl problem but is to do with the running of Perl
on IIS.
I now have two scripts that run without errors (I'm using strict) but,
for some reason, will not display the simple 'Done!' page built into
the script. Instead the server gives me 'The page cannot be
displayed'.
I have run it on a local IIS set up with no problems but on the main
server I continue to get this error. As I have no error messages other
than page not displayed I'm not sure what I can tweak to get it to
work. Maybe there's an error log I could look at?
I need to get a HTML page displayed at the end so I can then do futher
steps but so far cannot.
I'm running ActiveState Perl 5.8 with IIS 5 on a Windows 2000 box.
Any help appreciated.
Stew Dean
------------------------------
Date: Tue, 21 Oct 2003 23:52:30 +1300
From: "Tintin" <me@privacy.net>
Subject: Re: rsh & perl -Directory creation not possible
Message-Id: <bn336u$r9k3k$1@ID-172104.news.uni-berlin.de>
"qazmlp" <qazmlp1209@rediffmail.com> wrote in message
news:db9bbf31.0310210142.1b5acfed@posting.google.com...
> I have a perl script which creates a directory in the local machine.
> But, if I call this script from the remote machine using rsh, the
> directory is not created. And there is no error message reported. Why
> is that so ?
>
> What is the remedy for this ?
Does your script have something like?
mkdir '/path/to/dir' or die "Can not mkdir /path/to/dir $!\n";
If not, why not?
------------------------------
Date: Tue, 21 Oct 2003 08:00:14 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Setting config file using constant
Message-Id: <slrnbpabeu.m5o.tadmc@magna.augustmail.com>
Tony <tony@spamme.com> wrote:
> print "Admin Name: " . $Package::Config::ADMIN_NAME . "\n";
^
^ why is the dollar sign there?
> Why this doesn't work?
Because you put the dollar sign there. :-)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 21 Oct 2003 07:37:40 -0700
From: harteta@teleandina.net (Hernan)
Subject: Re: some help
Message-Id: <895432a7.0310210637.23ec43c8@posting.google.com>
"James E Keenan" <nospam_for_jkeen@concentric.net> wrote in message news:<bn1sgn$39r@dispatch.concentric.net>...
> "Hernan" <harteta@teleandina.net> wrote in message
> news:895432a7.0310201325.5f2c7b34@posting.google.com...
> [snip]
> > This formats repeat in every call, my problem comes when I try to fit
> > all this 3 lines in one line (I can parse 1 string), the data in line
> > 2 and 3 starts after "&".
>
> Please explain the problem better. In data sample you submitted, there's
> nothing after the '&'.
Sorry, when I post this the format change
this are 3 lines (first start whit N the second and third with " &")
N 074 00 3534 A006028 10/16 09:19:36 00:07:24.0 A95214897
& 000 000
& 000
------------------------------
Date: Tue, 21 Oct 2003 17:42:16 +0700
From: "Andrey" <smario@rol.ru>
Subject: Use in if..elsif
Message-Id: <bn32i8$51s$1@news.rol.ru>
Hello!
I have a problem and can't get it how to solve it.
When I'm using 'use Module;' in if..elsif statement I've got situation when
all modules is included.
For example (from code snippets bellow) if I call edit_info it makes
My::Info and My::Setting to be used and I can't use global variables in
edit_info, only in last elsif statement (change_settings).
Use of global variables is critical for this code.
I've read modperl, modperlib, Exporter but didn't find any solution.
Can anyone suggest me someting?
main.cgi
=======================================================
#!/usr/bin/perl -w
package main;
use strict;
use CGI::Apache qw/:standard/;
use CGI::Cookie;
use Apache::DBI;
use lib qw (.);
use Rc::Config();
use vars qw(%cfg);
*cfg = \%Rc::Config::cfg;
use vars qw($dbh $q);
$q = new CGI;
if ($q->param('action') eq 'login')
{
&login();
}
elsif ($q->param('action') eq 'edit_info')
{
use My::Info;
&edit_info();
}
elsif ($q->param('action') eq 'change_settings')
{
use My::Settings;
&change_settings();
}
========================================================
My::Info.pm
========================================================
package My::Info;
use strict;
use lib qw(../);
use Rc::Config();
use vars qw(%cfg);
*cfg = \%Rc::Config::cfg;
use Exporter;
use vars qw(@ISA @EXPORT @EXPORT_OK);
@ISA = qw(Exporter);
@EXPORT = qw(edit_info $dbh $q);
@EXPORT_OK = qw();
use vars qw($dbh $q);
sub edit_info
{
..............................
}
1;
========================================================
My::Settings.pm
========================================================
package My::Settings;
use strict;
use lib qw(../);
use Rc::Config();
use vars qw(%cfg);
*cfg = \%Rc::Config::cfg;
use Exporter;
use vars qw(@ISA @EXPORT @EXPORT_OK);
@ISA = qw(Exporter);
@EXPORT = qw(change_settings $dbh $q);
@EXPORT_OK = qw();
use vars qw($dbh $q);
sub change_settings
{
..............................
}
1;
========================================================
------------------------------
Date: Tue, 21 Oct 2003 14:58:49 +0400
From: Andrew Shitov <andy@shitov.ru>
Subject: Re: Use in if..elsif
Message-Id: <bn33h8$2n4t$1@gavrilo.mtu.ru>
Perl loads module if it sees any 'use' directive within main code before
(!) starting the programme. Try either call subs from if/else (perl will
not load module untill the sub will be called) or change 'use' to 'require'.
------------------------------
Date: Tue, 21 Oct 2003 20:25:08 +0900
From: ko <kuujinbo@hotmail.com>
Subject: Re: Use in if..elsif
Message-Id: <bn3574$f4h$1@pin3.tky.plala.or.jp>
Andrey wrote:
> Hello!
> I have a problem and can't get it how to solve it.
> When I'm using 'use Module;' in if..elsif statement I've got situation when
> all modules is included.
> For example (from code snippets bellow) if I call edit_info it makes
> My::Info and My::Setting to be used and I can't use global variables in
> edit_info, only in last elsif statement (change_settings).
> Use of global variables is critical for this code.
> I've read modperl, modperlib, Exporter but didn't find any solution.
> Can anyone suggest me someting?
perldoc autouse
Read the warnings though!
[snip code]
HTH - keith
------------------------------
Date: Tue, 21 Oct 2003 18:52:06 +0700
From: "Andrey" <smario@rol.ru>
Subject: Re: Use in if..elsif
Message-Id: <bn36l5$6j5$1@news.rol.ru>
Hello!
> Perl loads module if it sees any 'use' directive within main code before
> (!) starting the programme. Try either call subs from if/else (perl will
it didn't change anything, the same problem.
> not load module untill the sub will be called) or change 'use' to
'require'.
I need only 'use' because script is intended for run under mod_perl
------------------------------
Date: Tue, 21 Oct 2003 16:18:21 +0400
From: Andrew Shitov <andy@shitov.ru>
Subject: Re: Use in if..elsif
Message-Id: <bn386g$2rdq$1@gavrilo.mtu.ru>
> it didn't change anything, the same problem.
Really... Was a stupid idea ;-)
------------------------------
Date: Tue, 21 Oct 2003 16:19:03 +0400
From: Andrew Shitov <andy@shitov.ru>
Subject: Re: Use in if..elsif
Message-Id: <bn387l$2rdq$3@gavrilo.mtu.ru>
> it didn't change anything, the same problem.
really, was a stupid idea ;-)
------------------------------
Date: Tue, 21 Oct 2003 16:24:41 +0400
From: Andrew Shitov <andy@shitov.ru>
Subject: Re: Use in if..elsif
Message-Id: <bn38i7$2rdq$5@gavrilo.mtu.ru>
> it didn't change anything, the same problem.
really... was a stupid idea ;-)
------------------------------
Date: Tue, 21 Oct 2003 16:28:39 +0400
From: Andrew Shitov <andy@shitov.ru>
Subject: Re: Use in if..elsif
Message-Id: <bn38pl$2roa$1@gavrilo.mtu.ru>
if (0){
print "if\n";
}
else{
print "else\n";
my $use = "use Inc";
eval $use;
}
------------------------------
Date: Tue, 21 Oct 2003 16:29:09 +0400
From: Andrew Shitov <andy@shitov.ru>
Subject: Re: Use in if..elsif
Message-Id: <bn38qj$2roa$3@gavrilo.mtu.ru>
if (0){
print "if\n";
}
else{
print "else\n";
my $use = "use Inc";
eval $use;
}
------------------------------
Date: Tue, 21 Oct 2003 16:29:49 +0400
From: Andrew Shitov <andy@shitov.ru>
Subject: Re: Use in if..elsif
Message-Id: <bn38rr$2rta$1@gavrilo.mtu.ru>
if (0){
print "if\n";
}
else{
print "else\n";
my $use = "use Inc";
eval $use;
}
------------------------------
Date: Tue, 21 Oct 2003 16:36:32 +0400
From: Andrew Shitov <andy@shitov.ru>
Subject: Re: Use in if..elsif
Message-Id: <bn398e$2sa3$1@gavrilo.mtu.ru>
if (0){
print "if\n";
}
else{
print "else\n";
eval "use Inc";
}
------------------------------
Date: Tue, 21 Oct 2003 23:49:27 +1300
From: "Tintin" <me@privacy.net>
Subject: Re: using perl on the command line, like sed or awk
Message-Id: <bn3317$rmtm6$1@ID-172104.news.uni-berlin.de>
"gorda" <smith4894@excite.com> wrote in message
news:87fbf9fb.0310201342.38bebd84@posting.google.com...
> Hello,
>
> Using sed or awk, I can quickly parse and perform operations on the
> command line itself as in:
>
> cat file | sed 's/cat/dog'
> cat file | awk ' /cat/ {print "found the cat"} '
Why the UUOC's?
sed 's/cat/dog/' file
grep -q cat file && echo "found the cat"
------------------------------
Date: Tue, 21 Oct 2003 08:50:24 -0500
From: Barry Kimelman <raisin@delete-this-trash.mts.net>
Subject: Re: using perl on the command line, like sed or awk
Message-Id: <MPG.19fef595b5f0fb5f9896ad@news.mts.net>
[This followup was posted to comp.lang.perl.misc]
In article <87fbf9fb.0310201342.38bebd84@posting.google.com>, smith4894
@excite.com says...
> Hello,
>
> Using sed or awk, I can quickly parse and perform operations on the
> command line itself as in:
>
> cat file | sed 's/cat/dog'
> cat file | awk ' /cat/ {print "found the cat"} '
>
> How can i do something like the above in perl on the command line
> without having to write a script in a seperate file?
>
> Thanks
> -s
>
perl -e "perl-command-line;"
------------------------------
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 5690
***************************************