[10713] in Perl-Users-Digest
Perl-Users Digest, Issue: 4312 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Nov 28 10:07:15 1998
Date: Sat, 28 Nov 98 07:00:26 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 28 Nov 1998 Volume: 8 Number: 4312
Today's topics:
Begging a simple perl script for my study.. wjeon@chollian.net
Re: Begging a simple perl script for my study.. (Matthew Bafford)
Crontab and "require" <dwc3q@mamba.cs.virginia.edu>
Re: Crontab and "require" Lee.Lindley@bigfoot.com
Easily searchable database format <tim.hicks@lineone.net>
getpwent <csqy65@postoffice.pacbell.net>
Re: getpwent (Clay Irving)
Globbing don't work (CHOU KEI HONG)
Help - $query->image_button <dales@enhanced-performance.com>
Re: Help - $query->image_button <Tony.Curtis+usenet@vcpc.univie.ac.at>
How to use relatives directory in MacPerl vx Unix? (Jean-Marc Piuze)
Re: html vs. cgi via perl <Tony.Curtis+usenet@vcpc.univie.ac.at>
Language Translation Module jbharvey@home.net
Re: locking files in Perl (Ataraxia)
Re: locking files in Perl (Larry Rosler)
Problem using fd on DB_Files <nunomota@ideiavisual.pt>
Re: Problem using fd on DB_Files (M.J.T. Guy)
Re: regexp on multiple lines, etc. <nospam@nospam.com>
Re: regexp on multiple lines, etc. (brian d foy)
Re: REGEXP stumper for intermediate perl user <r28629@email.sps.mot.com>
Re: Taint mode... (Marc Haber)
Using XS With C++ <perl_writer@hotmail.com>
Weird problem with tied hash of tied hashes (DBI proble (Maurice Aubrey)
Re: Y2K and Programmer Denial (I R A Aggie)
Re: Y2K work - need suggestions <no@spam.org>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 28 Nov 1998 05:11:28 GMT
From: wjeon@chollian.net
Subject: Begging a simple perl script for my study..
Message-Id: <73o0lp$cau$1@nnrp1.dejanews.com>
I'm a real beginner and trying to write simple script. What I wanner write is
a script which can make a text file on the server and the content of the text
file will be the parameter of the script. For example.. If I type
'http://www.myserver.com/cgi-bin/myscript.pl?par=ABCD' on any web browsers, a
text file should be made by the script and the content of the text file
should be 'ABCD'. It's really simple, huh? But it is difficult to me. It
would be very much appreciated if anyone write the script for my study..
Thanks.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sat, 28 Nov 1998 09:29:22 -0500
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: Begging a simple perl script for my study..
Message-Id: <MPG.10c9d2cb28295be989746@news.scescape.net>
In article <73o0lp$cau$1@nnrp1.dejanews.com>, wjeon@chollian.net says...
=> I'm a real beginner and trying to write simple script. What I wanner write is
=> a script which can make a text file on the server and the content of the text
=> file will be the parameter of the script. For example.. If I type
=> 'http://www.myserver.com/cgi-bin/myscript.pl?par=ABCD' on any web browsers, a
=> text file should be made by the script and the content of the text file
=> should be 'ABCD'. It's really simple, huh? But it is difficult to me. It
=> would be very much appreciated if anyone write the script for my study..
Which part are you having trouble with?
Ok, start each script with the following two lines:
(Modify the /usr/bin/perl to match your path)
#!/usr/bin/perl -w
use strict;
# Since this is a CGI script, and you are wanting to parse the query
# string, you can use CGI;
use CGI qw/:standard/;
# Next you want to get the query. (perldoc CGI)
my $param = param('par');
# Do some error checking to make sure param is valid (ie defined)
#...
# Print your header (perldoc -f print):
print "Content-type: text/plain\n\n";
# Open your file (perldoc -f open);
open OUTFILE, ">>path_to_my_file" or do {
print "Unable to open path_to_my_file!\nReason: $!\n";
exit;
};
# Lock the file (perldoc -f flock)
flock OUTFILE, 2 or do {
print "Unable to flock path_to_my_file!\nReason: $!\n";
exit;
};
# Print the text (perldoc -f print)
# You probably should error check here, as well
print OUTFILE "$param\n";
# Close OUTFILE (perldoc -f close)
close OUTFILE or do {
print "Unable to close path_to_my_file!\nReason: $!\n";
exit;
};
# Print the success message (perldoc -f print);
print "Text $param written!\n";
__END__
=> Thanks.
Hopefully you will read the Perl docs now... :(
--Matthew
------------------------------
Date: Sat, 28 Nov 1998 00:40:40 -0500
From: David Coppit <dwc3q@mamba.cs.virginia.edu>
Subject: Crontab and "require"
Message-Id: <Pine.GSO.4.05.9811280036050.4792-100000@mamba.cs.virginia.edu>
What's the best way to let a script know that it can find a "require"'d
file in the directory in which the script is run?
The script I have slurps in configuration information using require, but
it can't find the config file when I run it as a cron job. I don't want to
put the config file in my normal PERL5LIB directories, and I don't want to
have to hard-code the script's location within the script.
>From what I understand, $0 doesn't always give the full directory.
TIA,
David
_________________________________________________________________________
David Coppit - Graduate Student coppit@cs.virginia.edu
The University of Virginia http://www.cs.virginia.edu/~dwc3q
"For I am a Bear of Very Little Brain,
and long words Bother me" - Winnie the Pooh
------------------------------
Date: 28 Nov 1998 13:56:53 GMT
From: Lee.Lindley@bigfoot.com
Subject: Re: Crontab and "require"
Message-Id: <73ovf5$5t$1@rguxd.viasystems.com>
David Coppit <dwc3q@mamba.cs.virginia.edu> wrote:
:>What's the best way to let a script know that it can find a "require"'d
:>file in the directory in which the script is run?
:>The script I have slurps in configuration information using require, but
:>it can't find the config file when I run it as a cron job. I don't want to
:>put the config file in my normal PERL5LIB directories, and I don't want to
:>have to hard-code the script's location within the script.
>From "perldoc perlrun"
-Idirectory
Directories specified by -I are prepended to the search
path for modules (@INC), and also tells the C
preprocessor where to search for include files. The C
preprocessor is invoked with -P; by default it searches
/usr/include and /usr/lib/perl.
or you can use a "BEGIN" block to modify "@INC".
BEGIN { push "/full/path/your/directory", @_INC }
Cron does not necessarily provide you with an environment that you
would expect. Don't depend on anything in the environment being
available or on the current working directory being where you
expect. Use the full path of the directory when you specify it with
either the "-I" command line switch or the BEGIN block. Or use the
full path when you require the file. If you want to be able to
move the whole kit around, then the "-I" switch would seem to be
best.
:>From what I understand, $0 doesn't always give the full directory.
You have some control over what goes into $0, but I don't know that
it is portable. I don't think it would be a very good method for
specifying the location of include files.
rgsun40{ltl}ksh: cat x.pl
#!/usr/lib/lprgs/perl -w
print "0th arg was $0\n";
rgsun40{ltl}ksh: ./x.pl
0th arg was ./x.pl
rgsun40{ltl}ksh: pwd
/home/is/ltl
rgsun40{ltl}ksh: /home/is/ltl/x.pl
0th arg was ./x.pl
rgsun40{ltl}ksh: perl x.pl
0th arg was x.pl
rgsun40{ltl}ksh: perl /home/is/ltl/x.pl
0th arg was /home/is/ltl/x.pl
:>The University of Virginia http://www.cs.virginia.edu/~dwc3q
Go Hokies!
--
// Lee.Lindley | There was a time when I thought that "being right"
// @bigfoot.com | was everything. Then I realized that getting along
// | was more important. Still, being right is more fun!
// | And if I'm wrong, somebody will get some joy out of telling me!
------------------------------
Date: Sat, 28 Nov 1998 13:49:22 -0000
From: "Tim Hicks" <tim.hicks@lineone.net>
Subject: Easily searchable database format
Message-Id: <WcT72.263$dh3.125@news-reader.bt.net>
I am quite new to perl (so go easy on me), but have read through 'Learning
Perl' (once). I would like to setup a simple database file that is then
searchable with a perl script. I hope that the end result will work from a
web page, but that is a way off at the moment.
My real question at the moment is, what format should I create my db in? I
am sure that the file will be some sort of simple text file, but how should
I separate the entries? The entire database shouldn't contain more than
about 200 or so entries, if this makes any difference to your response.
I hope their are some people who can help me out there.
Thanks
Tim
p.s. I'm not looking for help with the search script.... yet!!
------------------------------
Date: Fri, 27 Nov 1998 22:09:34 -0800
From: Jane Vermont <csqy65@postoffice.pacbell.net>
Subject: getpwent
Message-Id: <365F939E.CA23470A@postoffice.pacbell.net>
--------------491E8041BEAC0B894DD0215D
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hello
How to use getpwent to get my uid and gid.I tried different ways
and still can't get it. If someone know PLEASE HELP
Thank
--------------491E8041BEAC0B894DD0215D
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<HTML>
Hello
<BR> How to use <FONT COLOR="#FF6666"><FONT SIZE=+1>getpwent</FONT>
</FONT>to get my uid and gid.I tried different ways and still can't
get it. If someone know PLEASE HELP
<BR>
Thank
<BR> </HTML>
--------------491E8041BEAC0B894DD0215D--
------------------------------
Date: 28 Nov 1998 09:19:06 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: getpwent
Message-Id: <73p0oq$mrj@panix.com>
In <365F939E.CA23470A@postoffice.pacbell.net> Jane Vermont <csqy65@postoffice.pacbell.net> writes:
> How to use getpwent to get my uid and gid.I tried different ways
>and still can't get it. If someone know PLEASE HELP
This program:
#!/usr/local/bin/perl5 -w
$name = "clay";
while (($login, $uid, $gid) = (getpwent)[0,2,3]) {
if ($name eq $login) {
print "My uid is $uid and my gid is $gid\n";
}
}
prints:
My uid is 619 and my gid is 99
--
Clay Irving
clay@panix.com
------------------------------
Date: 28 Nov 1998 07:18:27 GMT
From: kelvinee@net1.hkbu.edu.hk (CHOU KEI HONG)
Subject: Globbing don't work
Message-Id: <73o843$978$1@power42t.hkbu.edu.hk>
hi all,
I have tried writing a script to count the no. of files with extension .pic
with a directory.
It works fine when invoke locally from a dos prompt (perl test.pl).
But when I invoke this script as a CGI, it was found that the script can't
report the no. of files and always is zero.
Does anybody has any idea ? Below is the code I write.
print "Content-Type: text/html\n\n";
@list = <d:/pic/*.pic>;
$list_len = $#list +1;
foreach $element (@list) {
print "$element<br>";
}
print #list_len<br>";
Or I guess there may have a better way to do this.
Many thanks.
Kelvin
------------------------------
Date: Fri, 27 Nov 1998 22:31:05 -0800
From: Dale Sutcliffe <dales@enhanced-performance.com>
Subject: Help - $query->image_button
Message-Id: <365F98A8.A96B7CB9@enhanced-performance.com>
How can I use:
$query->image_button
without producing a border around the image, ie border=0
Thanks
------------------------------
Date: 28 Nov 1998 10:18:21 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Help - $query->image_button
Message-Id: <83u2zktbtu.fsf@vcpc.univie.ac.at>
Re: Help - $query->image_button, Dale
<dales@enhanced-performance.com> said:
Dale> How can I use: $query->image_button without producing
Dale> a border around the image, ie border=0
Well, presumably you control the border attribute the same
way as all the others.
print image_button(-name => 'banana',
-src => 'http://www.wibble.com/path/to/image.jpg',
-alt => 'blah blah',
-border => 0);
However, whether an image gets a border or not depends on
how the user-agent/browser wants to display it (if at all):
http://www.w3.org/TR/REC-html40/interact/forms.html#edef-INPUT
hth
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds! | private email:
Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: Sat, 21 Nov 1998 09:59:02 -0500
From: jmp@mlink.net (Jean-Marc Piuze)
Subject: How to use relatives directory in MacPerl vx Unix?
Message-Id: <jmp-ya02408000R2111980959020001@nntp.mlink.net>
I want to relative directory like "../" in Unix. I want my perl script run
on Unix platform as well as a Mac platform.
Can you help me.. Any answer? What to read? Where to look?
Thanks!
jmarc...
------------------------------
Date: 28 Nov 1998 10:12:02 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: html vs. cgi via perl
Message-Id: <83vhk0tc4d.fsf@vcpc.univie.ac.at>
Re: html vs. cgi via perl, Mike <mike@lovetalk.de> said:
Mike> Does anyone have any idea on how to ping a cgi-script
Mike> ?? (not just the ip)
You can't "ping" a CGI-script.
Mike> I would like to write a script that compares html
Mike> vs. cgi response times on a server.....
Ah, right, you want to compare response times.
perldoc LWP
but bear in mind if you're doing the timings from the client
side then you're also timing the (variable) connectivity
between the client and the server. To properly time the
response of the server's handlers you'll need to insert a
timer into the server itself.
hth
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds! | private email:
Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: Sat, 28 Nov 1998 06:13:59 GMT
From: jbharvey@home.net
Subject: Language Translation Module
Message-Id: <HwM72.1773$_g.9281110@news.rdc1.sfba.home.com>
Hi,
Following instructions to submit a new module, I'm throwing this out.
I've built a module that uses LWP to translate strings into Italian,
German, French, Italian and Portugeuse and back to English using Alta
Vista's Translation service. Should I release this? It works pretty
well...
j
--
Justin B. Harvey
http://www.auspex.net/jbharvey
------------------------------
Date: Sat, 28 Nov 1998 04:54:28 GMT
From: ataraxia@psu.edu (Ataraxia)
Subject: Re: locking files in Perl
Message-Id: <365f81a6.50276912@news.sgi.net>
Andre Kopostynski distracted me from absolute tranquility:
:I'm trying to lock my counter file in anticipating multiple users submitting
:their results simultaneously on my online questionnaire form. Here's what I
:have. it's working fine, but how do I lock the file until the submission is
:completed and how do I unlock for next submission?
:
:Your expertise is greatly appreciated.
:
:
:# Beginning of writefile function
:
:sub writetofile {
:# Creating a variable the value of which is the name of the counter file
:$counter_file = "counter.file";
:
:# Opening the counter file and reading the next number from this file
:open (FILE, "<" . $counter_file);
flock(FILE, $LOCK_EX);
:$next_numb = <FILE>;
:close (FILE);
:
:# Opening the counter file again and rewriting the next number to this file
:$next_numb++;
:open (FILE, ">" . "counter.file");
:print FILE $next_numb;
:close (FILE);
flock(FILE, $LOCK_UN);
--
Ataraxia <ataraxia@psu.edu>
Champion of the Misunderstood
ICQ# 12869841
------------------------------
Date: Fri, 27 Nov 1998 22:39:39 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: locking files in Perl
Message-Id: <MPG.10c93a826a9af88e98992c@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and copy mailed.]
In article <365f81a6.50276912@news.sgi.net> on Sat, 28 Nov 1998 04:54:28
GMT, Ataraxia <ataraxia@psu.edu> says...
...
> :sub writetofile {
> :# Creating a variable the value of which is the name of the counter file
> :$counter_file = "counter.file";
> :
> :# Opening the counter file and reading the next number from this file
> :open (FILE, "<" . $counter_file);
> flock(FILE, $LOCK_EX);
> :$next_numb = <FILE>;
> :close (FILE);
You misunderstand. Once the file is closed, the lock is gone.
> :# Opening the counter file again and rewriting the next number to this file
> :$next_numb++;
> :open (FILE, ">" . "counter.file");
> :print FILE $next_numb;
> :close (FILE);
> flock(FILE, $LOCK_UN);
Three things are wrong here:
1. The file was not locked after being opened.
2. Even if it were, the close would unlock it.
3. So 'flock(FILE, $LOCK_UN)' is on a closed filehandle and is
unnecessary in any case.
The right way to do this is detailed in perlfaq5: "I still don't get
locking. I just want to increment the number in the file. How can I do
this?"
> --
> Ataraxia <ataraxia@psu.edu>
> Champion of the Misunderstood
> ICQ# 12869841
...and of the Misunderstanding
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 27 Nov 1998 11:24:39 +0000
From: Nuno Mota <nunomota@ideiavisual.pt>
Subject: Problem using fd on DB_Files
Message-Id: <365E8BF7.A603EBC6@ideiavisual.pt>
This is a multi-part message in MIME format.
--------------33F7A560C2E37E715D642BB0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I'm writing a CGI for a website, in wich I am using DB_Files to save the
information, the perl and despite the CGI works great if I run it as
stand alone, is that when I call the fd method in the CGI, running it on
Apache, the following error happens
Can't call method "fd" without a package or object reference at
/home/httpd/cgi-bin/carrinho.cgi line 62.
The code that I am using is the following:
$carrinhos=tie (%carrinhos, 'DB_File', 'carrinhos.db', O_CREAT|O_RDWR,
0666);
$fd = $carrinhos->fd;
print "\n$fd\n";
open(CARRINHO, "+<&=$fd");
flock (CARRINHO, LOCK_EX | LOCK_NB);
flock (CARRINHO, LOCK_EX );
$carrinhos{$numero}="Vazio";
$carrinhos->sync;
print "Teste:$carrinhos{$numero}\n";
undef $carrinhos;
untie %carrinhos;
close (CARRINHO);
tie(%carrinhos, "DB_File", "carrinhos.db", O_CREAT|O_RDWR, 0666);
print "Teste:$carrinhos{$numero}\n";
untie %carrinhos;
can anyone help me out here, please ??
Thanks Carlos Nuno Mota
--------------33F7A560C2E37E715D642BB0
Content-Type: text/x-vcard; charset=us-ascii;
name="nunomota.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Nuno Mota
Content-Disposition: attachment;
filename="nunomota.vcf"
begin:vcard
n:Mota;Nuno
x-mozilla-html:FALSE
org:Ideia Visual
adr:;;;;;;
version:2.1
email;internet:nunomota@ideiavisual.pt
title:Tecnico de Web
x-mozilla-cpt:;-2816
fn:Nuno Mota
end:vcard
--------------33F7A560C2E37E715D642BB0--
------------------------------
Date: 28 Nov 1998 13:56:41 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Problem using fd on DB_Files
Message-Id: <73ovep$h2f$1@pegasus.csx.cam.ac.uk>
Nuno Mota <nunomota@ideiavisual.pt> wrote:
>This is a multi-part message in MIME format.
>--------------33F7A560C2E37E715D642BB0
Please fix your newsreader not to do that. USENET is a plain text
medium.
>I'm writing a CGI for a website, in wich I am using DB_Files to save the
>information, the perl and despite the CGI works great if I run it as
>stand alone, is that when I call the fd method in the CGI, running it on
>Apache, the following error happens
>
>Can't call method "fd" without a package or object reference at
>/home/httpd/cgi-bin/carrinho.cgi line 62.
>
>$carrinhos=tie (%carrinhos, 'DB_File', 'carrinhos.db', O_CREAT|O_RDWR,
>0666);
>$fd = $carrinhos->fd;
You are making two mistakes:
i) You aren't using -w.
ii) You aren't checking that the tie() succeeded, and in particular you
aren't printing the value of $! after an error.
I'd guess that the tie() is failing, probably because either the current
directory or permissions are wrong. So it returns "undef", which
you can't apply the fd method to.
Mike Guy
------------------------------
Date: Sat, 28 Nov 1998 05:21:57 +0000
From: Jim Rhodes <nospam@nospam.com>
Subject: Re: regexp on multiple lines, etc.
Message-Id: <zU+y30C1h4X2Ew+m@deadlock.com>
In article <73ercg$1g5$1@newsmonger.rutgers.edu>, John
Joergensen <jjoerg@crab.rutgers.edu> writes:
>I have the regexp set to global (ie. m/regexp/g)
I may not have grasped your question properly (I'm a newbie
myself), but have you tried:
/regexp/sg
The /s lets you span multiple lines.
------------------------------
Date: Sat, 28 Nov 1998 02:51:44 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: regexp on multiple lines, etc.
Message-Id: <comdog-ya02408000R2811980251440001@news.panix.com>
In article <zU+y30C1h4X2Ew+m@deadlock.com>, Jim Rhodes <nospam@nospam.com> posted:
> /regexp/sg
>
> The /s lets you span multiple lines.
huh? the s option lets the . match newlines. otherwise, the regex
always affects the entire string.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Fri, 27 Nov 1998 22:24:58 -0500
From: Tk Soh <r28629@email.sps.mot.com>
To: Someone <dylan@leading.net>
Subject: Re: REGEXP stumper for intermediate perl user
Message-Id: <365F6CCA.B32EFDD6@email.sps.mot.com>
[posted to c.l.p.m and copy emailed]
Someone wrote:
>
> i have a text string inside $value that can consist of anything. i want to
> eliminate all whitespace, except when found inside single quotes (' ').
[...]
Here's my modified version of code from the faq (see, it's there ;-) :
=head2 How can I split a [character] delimited string except when inside
[character]? (Comma-separated files)
#------------------------
#!/usr/loca/bin/perl
$text = q{SAR001 '' 'Cimetrix \'s Inc' 'Bob Smith' 'CAM' N 8 1 0 7};
$new = "";
$new .= $+ while $text =~ m{
('[^\'\\]*(?:\\.[^\'\\]*)*')\ ? # groups the phrase inside the quotes
| ([^ ]+)\ ?
| [ ]
}gx;
print $new;
#------------------------
SAR001'''Cimetrix \'s Inc''Bob Smith''CAM'N8107.
As you can see, it also take care of the unpaired (slashed) quotes.
HTH.
-TK
------------------------------
Date: Sat, 28 Nov 1998 09:14:10 GMT
From: Marc.Haber-usenet@gmx.de (Marc Haber)
Subject: Re: Taint mode...
Message-Id: <73oet7$o55$2@news.rz.uni-karlsruhe.de>
"illfigah" <alcazar@netcomp.net> wrote:
>Why is it that when I include the taint mode flag (-T) that an external file
>that is "required" by the current script won't work?
>Here's a snippet of my code:
>
>#/usr/bin/perl -T
>...
>
>require "$client_dir/$username.cgi" || die "Can't open file!";
>
>When I replace $username with a definite string, it opens it fine... however
>when I try to use the variable. Nothing happens.
Where and how do you set $username if you don't use the definite
string?
You also might want to re-read perldoc perlsec.
Greetings
Marc
--
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber | " Questions are the | Mailadresse im Header
Karlsruhe, Germany | Beginning of Wisdom " | Fon: *49 721 966 32 15
Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29
------------------------------
Date: Sat, 28 Nov 1998 15:59:25 +0800
From: "Perl Writer" <perl_writer@hotmail.com>
Subject: Using XS With C++
Message-Id: <73oacn$r6k$1@imsp009a.netvigator.com>
Hi there,
When I try to write a C++ function extension to be invoked in perl using the
example in perlxs's "Using XS with C++" section, I can successfully run make
but fail in running the test.script "test.pl". The error is as follows:
> make test
PERL_DL_NONLAZY=1
/bin/perl -I./blib/arch -I./blib/lib -I/usr/local/perl5/lib/su
n4-solaris/5.00404 -I/usr/local/perl5/lib test.pl
1..1
Can't load './blib/arch/auto/BOC/BOC.so' for module BOC: ld.so.1:
/bin/perl: fat
al: relocation error: symbol not found: __0OnwUi: referenced in
./blib/arch/auto
/BOC/BOC.so at /usr/local/perl5/lib/sun4-solaris/5.00404/DynaLoader.pm
line 166.
at test.pl line 11
BEGIN failed--compilation aborted at test.pl line 11.
not ok 1
make: *** [test_dynamic] Error 2
where line 11 is the "use BOC" statement.
I have already changed the Makefile to use CC instead of cc. Can anybody
help me out a bit here?
Thanks a lot in advance.
------------------------------
Date: Sat, 28 Nov 1998 12:05:54 GMT
From: maurice@hevanet.com (Maurice Aubrey)
Subject: Weird problem with tied hash of tied hashes (DBI problem?)
Message-Id: <slrn75vpp3.4kb.maurice@we-24-130-48-83.we.mediaone.net>
I've encountered a very strange error when attempting to
construct a tied hash of tied hashes. The following code
works:
package MyTie;
use strict;
use DBI;
sub TIEHASH {
my $class = shift;
bless my $self = { depth => shift() }, $class;
# my $dbh = DBI->connect('DBI:mysql:database=test') or die $DBI::errstr;
return $self;
}
sub FETCH {
my $self = shift;
my $key = shift;
print "FETCHED $self->{depth}!\n";
my $h = {};
tie %$h, 'MyTie', $self->{depth} + 1;
return $h;
}
1;
Here's the script I'm testing it with:
#!/usr/bin/perl -w
use strict;
use MyTie;
tie my %hash, 'MyTie', 0;
my $val = $hash{blort}{foo}{zort};
When this is run, it produces:
[maurice]$ ./try
FETCHED 0!
FETCHED 1!
FETCHED 2!
Which is exactly what I want. However, if the DBI->connect() call
is uncommented, I receive this:
[maurice]$ ./try
FETCHED 0!
Can't use an undefined value as a HASH reference at ./try line 6.
Can anyone see why that would happen? I'm running DBI 1.02 and
perl 5.004_04.
Any suggestions would be appreciated.
--
Maurice Aubrey <maurice@hevanet.com>
The programmer, like the poet, works only slightly removed from pure
thought-stuff. He builds his castles in the air, from air, creating
by exertion of the imagination.
- Frederick Brooks, Jr., The Mythical Man Month
------------------------------
Date: Sat, 28 Nov 1998 00:44:06 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Y2K and Programmer Denial
Message-Id: <fl_aggie-2811980044060001@aggie.coaps.fsu.edu>
In article <gleeson-ya02408000R2811981442310001@news.unimelb.edu.au>,
gleeson@unimelb.edu.au (Martin Gleeson) wrote:
+ You seem to be confusing criticism of your flawed analysis with denial
+ of the existence of a problem. And you have the arrogance to talk about
+ denial? Sheesh.
Hey, denial ain't just a river in Egypt... ;)
James
------------------------------
Date: 28 Nov 1998 08:14:41 GMT
From: Citizen Joe <no@spam.org>
Subject: Re: Y2K work - need suggestions
Message-Id: <73obdh$fb5$1@ns2.foothill.net>
In comp.unix.admin Balazs Rauznitz <prauz@sprynet.com> wrote:
> What about using fork to run the programs paralell ?
So how exactly would I run several commands in parallel using fork?
* * *
It has occured to me that maybe my program is slow because there is a lot
of reads and writes to a disk, not because of remsh. My directory tree is
organized this way:
~/web/sysinfo/machine_name/components.out
So for each machine I re-create components.out. If I probe Unix boxes for a
component, I read the file, find the record with the component I am looking
at currently, delete it, find the new info for the components, insert it
into the array and then save it to the file. So if I am looking at 150
components on 300 boxes, I read/write the file 45,000 times. That is what
slows me down. Once Perl gets the info into the memory, I have no complains
about lack of speed.
Maybe I need to redesign the program. The problem is that I don't want to
survey all of the components all of the time. Sometimes I want to look for
just a couple of components on all the systems. Then I want to delete just
the bad ones from the list and insert good ones. Maybe instead of having
one big components.out file I will have a separate file for each component,
named <component>.out.
Perl is the greatest tool.
By the way, I highly recommend "Perl Cookbook." It is an excellent piece,
very useful.
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 4312
**************************************