[22805] in Perl-Users-Digest
Perl-Users Digest, Issue: 5026 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 22 14:10:50 2003
Date: Thu, 22 May 2003 11:10:19 -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, 22 May 2003 Volume: 10 Number: 5026
Today's topics:
How do i use styles in perl? (Mattias)
Re: How do i use styles in perl? <abigail@abigail.nl>
Re: How do i use styles in perl? (Tad McClellan)
how to obtain the result from File::Find ? (niudou)
Re: how to obtain the result from File::Find ? <nobull@mail.com>
HP Perl build issue <k@k.com>
Re: html2txt <sten.malmlund@pp.htv.fi>
Re: Minimal Linux Perl setup (Richard Williams)
Net::AIM help! <rm.mymail@NOSPAMHEREntlworld.com>
ora_login with SYSDBA privileges (Pam Bantis)
Re: Regexp Multiple Matching Problem (Big Brother)
Re: Regexp Multiple Matching Problem <glex_nospam@qwest.net>
skipping lines based on a condition (david)
Re: skipping lines based on a condition <thomas.nagel@planb.de>
Re: skipping lines based on a condition (Tad McClellan)
split and whitespaces <Rene.Scheibe@gmx.net>
Re: split and whitespaces <w.koenig@acm.org>
Re: split and whitespaces <Rene.Scheibe@gmx.net>
Re: split and whitespaces <w.koenig@acm.org>
Re: split and whitespaces <nobull@mail.com>
Re: split and whitespaces <krahnj@acm.org>
splitting a very large file based on characters in a re (Billy)
Re: splitting a very large file based on characters in <stephan@wanderinghorse.net>
Re: trying to create spaces <usenet@dwall.fastmail.fm>
Re: wierd behaviour in writing out a file <TruthXayer@yahoo.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 22 May 2003 09:16:51 -0700
From: mattias@mail.nu (Mattias)
Subject: How do i use styles in perl?
Message-Id: <cd848ce5.0305220816.430538e8@posting.google.com>
Hi i´m so tot new at this but how do i use styles in a perl cgi
document?
In a htm page i write like this in the head:
---------------------
<style type="text/css">
body {
scrollbar-arrow-color: white;
scrollbar-base-color: #D8DDE1;
scrollbar-dark-shadow-color: #D8DDE1;
scrollbar-track-color: #D8DDE1;
scrollbar-face-color: #6699CC;
scrollbar-shadow-color: white;
scrollbar-highlight-color: silver;
scrollbar-3d-light-color: black;
}
</style>
-------------------------
to get my scrollbar looking like i want. Now I want to put it in my
guestbook cgi document made in perl looking like this:
--------------------------
#!/usr/bin/perl
@months = ('Jan','Feb','Mar','Apr','Maj','Juni','Juli','Aug','Sept','Okt','Nov','Dec');
@days = ('Söndag','Måndag','Tisdag','Onsdag','Torsdag','Fredag','Lördag');
($sec,$min,$hour,$mday,$mon,$year,$wday) =
(localtime(time))[0,1,2,3,4,5,6];
$year=$year+1900;
if (length($sec) eq 1){
$sec = "0$sec";
}
if (length($min) eq 1){
$min = "0$min";
}
if (length($hour) eq 1){
$hour = "0$hour";
}
$date = " $hour:$min:$sec $days[$wday] den $mday $months[$mon] -
$year";
require './cgi-lib.cgi';
&ReadParse(*input);
$datafile = "gbook.txt";
if ($input{"gb"} eq "nytt"){
while (($key, $value) = each %input){
if (($input{"name"} eq "")||($input{"message"} eq "")){
print &PrintHeader;
print "<html><header></header><body><center><h1>Information
sakas!</h1>";
print "Fälten \"Namn\" & \"Mitt meddelande\" måste fyllas i
!!!</center></body></html>";
exit;
}
}
open(FILE,"$datafile") || die "cannot open file: $!";
@mydata = <FILE>;
close(FILE);
open(FILE,">$datafile") || die "cannot open file: $!";
$message = $input{"message"};
#OBS byt ut enter mot <br> för message
$input{"message"} =~ s/\n/<br>/g;
$input{"message"} =~ s/\r//g;
$test = $input{"message"};
print FILE "$input{\"name\"};;$input{\"email\"};;$input{\"homepage\"};;$input{\"hometown\"};;$date;;$input{\"message\"}\n";
foreach $i (0 .. $#mydata){
print FILE "@mydata[$i]";
}
close(FILE);
$mailprog = '/usr/sbin/sendmail';
# $to = 'webmaster@lulebeachvolley.nu';
$to = 'webmaster@lulebeachvolley.nu,info@lulebeachvolley.nu';
# $to = 'hakan.lindgren@mobilaris.se';
# $from = 'lindgren.hakan@telia.com';
$rname = 'Guestbook';
$subject = 'Nytt meddelande i gästboken';
# Open The Mail Program
open(MAIL,"|$mailprog -t");
print MAIL "To: $to\n";
print MAIL "From: ($rname)\n";
print MAIL "Subject: $subject\n\n";
print MAIL "NAMN: $input{\"name\"}\n";
print MAIL "E-MAIL: $input{\"email\"}\n";
print MAIL "HEMSIDA: $input{\"homepage\"}\n";
print MAIL "STAD: $input{\"hometown\"}\n";
print MAIL "DATUM: $date\n\n";
print MAIL "$message\n";
close (MAIL);
}
open(FILE,"$datafile") || die "cannot open file: $!";
@mydata = <FILE>;
close(FILE);
print &PrintHeader;
print "<html><head><title>LBVs gästbok</title></head>\n";
print "<body bgcolor=\"1B4A7A\" text=\"ffffff\" link=\"#FFFF00\"
vlink=\"#FFFF00\" alink=\"ff0000\">\n";
print "<center><img src=\"..\/lbv\/images/guestbook.gif\"alt=\"Lule
Beachvolley\"></center><p><hr>";
print "<font face=\"geneva, arial\" size=\"2\">";
if ($#mydata > 9){
if ($input{"page"} eq ""){
$start = 0;
$stop = 9;
}else{
$start = $input{"page"} * 10;
if (10 < ($#mydata - $start)){
$stop = $start + 9;
}else{
$stop = $#mydata;
}
}
}else{
$start = 0;
$stop = $#mydata;
}
foreach $i ($start .. $stop) {
($name,$email,$homepage,$hometown,$odate,$message) =
split(/;;/,$mydata[$i],6);
if ($email eq ""){
print "<b>Namn: </b>$name<br>";
}else{
print "<b>Namn: </b><a href=\"mailto:$email\">$name</a><br>";
}
if ($homepage ne ""){
print "<b>Hemsida: </b><a href=\"$homepage\"
target=\"_new\">$homepage</a><br>";
}
if ($hometown ne ""){
print "<b>Hemort: </b>$hometown<br>";
}
print "<b>Sänt: </b>$odate<br>";
#OBS byt ut teckensmileys mot smileybilder
$message =~ s/:\)/<img src="..\/lbv\/images\/smileys\/glad.gif"
alt=":\)">/g;
$message =~ s/:-\)/<img src="..\/lbv\/images\/smileys\/glad.gif"
alt=":-\)">/g;
$message =~ s/;\)/<img src="..\/lbv\/images\/smileys\/flirt.gif"
alt=";\)">/g;
$message =~ s/;-\)/<img src="..\/lbv\/images\/smileys\/flirt.gif"
alt=";-\)">/g;
$message =~ s/:\(/<img src="..\/lbv\/images\/smileys\/sad.gif"
alt=":\(">/g;
$message =~ s/:-\(/<img src="..\/lbv\/images\/smileys\/sad.gif"
alt=":-\(">/g;
$message =~ s/\?\?\?/<img src="..\/lbv\/images\/smileys\/icon12.gif"
alt=":-\(">/g;
$message =~ s/B-\)/<img src="..\/lbv\/images\/smileys\/sunglas.gif"
alt="B-\)">/g;
$message =~ s/:-D/<img src="..\/lbv\/images\/smileys\/bigsmile.gif"
alt=":-D)">/g;
$message =~ s/:-O/<img src="..\/lbv\/images\/smileys\/eek.gif"
alt=":-O">/g;
$message =~ s/:-P/<img src="..\/lbv\/images\/smileys\/tunga.gif"
alt=":-P">/g;
$message =~ s/:-\#/<img src="..\/lbv\/images\/smileys\/censored.gif"
alt=":-\#">/g;
$message =~ s/:-\&/<img src="..\/lbv\/images\/smileys\/yell.gif"
alt=":-\&">/g;
$message =~ s/;-\(/<img src="..\/lbv\/images\/smileys\/sad2.gif"
alt=";-\(">/g;
$message =~ s/:-\</<img src="..\/lbv\/images\/smileys\/bluejump.gif"
alt=";-\(">/g;
$message =~ s/:-\>/<img src="..\/lbv\/images\/smileys\/burn.gif"
alt=";-\(">/g;
$message =~ s/O-\)>/<img src="..\/lbv\/images\/smileys\/cyclops.gif"
alt="O-\)">/g;
$message =~ s/:-T/<img src="..\/lbv\/images\/smileys\/ebert.gif"
alt=";-\(">/g;
$message =~ s/\!\!\!/<img src="..\/lbv\/images\/smileys\/idea.gif"
alt="\!\!\!">/g;
#$message =~ s/:-/a/g;
print "$message<hr>\n";
}
$total = $#mydata + 1;
print "<font size=1><b>Antal meddelanden:</b> $total<br>";
print "[ Sida: ";
$pages = $#mydata/10;
foreach $i (0 .. $pages){
if ($i > 0){
print ", ";
}
$p = $i+1;
print "<a href=\"guestbook.cgi?page=$i\">$p</a>";
}
print " ]</font><p>";
print "</font>";
print "<center><table cellspacing=1 cellpadding=1 border=0>\n";
print "<form name=\"myForm\" action=\"guestbook.cgi\"
method=\"post\">\n";
print "<tr><td colspan=2>\n";
print "<style>body{overflow-x:hidden;overflow-y:scroll;}</style>\n";
print "<script language=\"JavaScript1.2\">\n";
print "var goleftimage='..\/lbv\/images\/pointer2.gif'\n";
print "var gorightimage='..\/lbv\/images\/pointer.gif'\n";
print "var menuwidth=300\n";
print "var scrollspeed=6\n";
print "var menucontents='<nobr><a href=\"#myForm\"
onClick=\\'addText\(\":-\)\"\)\\'><img
src=\"..\/lbv\/images\/smileys\/glad.gif\" alt=\":-\)\"
border=0></a>\\\n";
print " <a href=\"#myForm\"
onClick=\\'addText\(\";-\)\"\)\\'><img
src=\"..\/lbv\/images\/smileys\/flirt.gif\" alt=\";-\)\"
border=0></a>\\\n";
print " <a href=\"#myForm\"
onClick=\\'addText\(\";-\(\"\)\\'><img
src=\"..\/lbv\/images\/smileys\/sad2.gif\" alt=\";-\)\"
border=0></a>\\\n";
print " <a href=\"#myForm\"
onClick=\\'addText\(\"B-\)\"\)\\'><img
src=\"..\/lbv\/images\/smileys\/sunglas.gif\" alt=\";-\)\"
border=0></a>\\\n";
print " <a href=\"#myForm\"
onClick=\\'addText\(\":-D\"\)\\'><img
src=\"..\/lbv\/images\/smileys\/bigsmile.gif\" alt=\":-D\"
border=0></a>\\\n";
print " <a href=\"#myForm\"
onClick=\\'addText\(\":-O\"\)\\'><img
src=\"..\/lbv\/images\/smileys\/eek.gif\" alt=\":-O\"
border=0></a>\\\n";
print " <a href=\"#myForm\"
onClick=\\'addText\(\":-P\"\)\\'><img
src=\"..\/lbv\/images\/smileys\/tunga.gif\" alt=\":-P\"
border=0></a>\\\n";
print " <a href=\"#myForm\"
onClick=\\'addText\(\":-\#\"\)\\'><img
src=\"..\/lbv\/images\/smileys\/censored.gif\" alt=\":-\#\"
border=0></a>\\\n";
print " <a href=\"#myForm\"
onClick=\\'addText\(\":-\&\"\)\\'><img
src=\"..\/lbv\/images\/smileys\/yell.gif\" alt=\":-\&\"
border=0></a>\\\n";
print " <a href=\"#myForm\"
onClick=\\'addText\(\"\?\?\?\"\)\\'><img
src=\"..\/lbv\/images\/smileys\/icon12.gif\" alt=\"\?\?\?\"
border=0></a>\\\n";
print " <a href=\"#myForm\"
onClick=\\'addText\(\":-\<\"\)\\'><img
src=\"..\/lbv\/images\/smileys\/bluejump.gif\" alt=\":-\<\"
border=0></a>\\\n";
print " <a href=\"#myForm\"
onClick=\\'addText\(\":-\>\"\)\\'><img
src=\"..\/lbv\/images\/smileys\/burn.gif\" alt=\":-\>\"
border=0></a>\\\n";
print " <a href=\"#myForm\"
onClick=\\'addText\(\"O-\)\"\)\\'><img
src=\"..\/lbv\/images\/smileys\/cyclops.gif\" alt=\"O-\)\"
border=0></a>\\\n";
print " <a href=\"#myForm\"
onClick=\\'addText\(\":-\T\"\)\\'><img
src=\"..\/lbv\/images\/smileys\/ebert.gif\" alt=\":-\T\"
border=0></a>\\\n";
print " <a href=\"#myForm\"
onClick=\\'addText\(\"\!\!\!\"\)\\'><img
src=\"..\/lbv\/images\/smileys\/idea.gif\" alt=\"\!\!\!\"
border=0></a>\\\n";
print " <a href=\"#myForm\"
onClick=\\'addText\(\":-\(\"\)\\'><img
src=\"..\/lbv\/images\/smileys\/sad.gif\" alt=\":-\(\"
border=0></a></nobr>'\n";
print "var actualwidth=''\n";
print "var ns_scroll\n";
print "function fillup\(\){\n";
print "if \(document.all\){\n";
print "test2.innerHTML=menucontents\n";
print "actualwidth=test2.offsetWidth\n";
print "}\n";
print "else if \(document.layers\){\n";
print "ns_scroll=document.ns_scrollmenu.document.ns_scrollmenu2\n";
print "ns_scroll.document.write\(menucontents\)\n";
print "ns_scroll.document.close\(\)\n";
print "actualwidth=ns_scroll.document.width\n";
print "}\n";
print "}\n";
print "window.onload=fillup\n";
print "function addText\(t\){\n";
print "myForm.message.value+=t;\n";
print "}\n";
print "function moveleft\(\){\n";
print "if \(document.all&&test2.style.pixelLeft>\(menuwidth-actualwidth\)\)\n";
print "test2.style.pixelLeft-=scrollspeed\n";
print "else if \(document.layers&&ns_scroll.left>\(menuwidth-actualwidth\)\)\n";
print "ns_scroll.left-=scrollspeed\n";
print "lefttime=setTimeout\(\"moveleft\(\)\",50\)\n";
print "}\n";
print "function moveright\(\){\n";
print "if \(document.all&&test2.style.pixelLeft<0\)\n";
print "test2.style.pixelLeft+=scrollspeed\n";
print "else if \(document.layers&&ns_scroll.left<0\)\n";
print "ns_scroll.left+=scrollspeed\n";
print "righttime=setTimeout\(\"moveright\(\)\",50\)\n";
print "}\n";
print "if \(document.all||document.layers\){\n";
print "with \(document\){\n";
print "write\('<table border=0 cellspacing=0 cellpadding=0>'\)\n";
print "write\('<td valign=\"middle\"><a href=\"#myForm\"
onMouseover=\"moveright\(\)\"
onMouseout=\"clearTimeout\(righttime\)\"><img src=\"'+goleftimage+'\"
border=0></a> </td>'\)\n";
print "write\('<td valign=\"top\">'\)\n";
print "if \(document.all\){\n";
print "write\('<span
style=\"position:relative;width:'+menuwidth+';\">'\)\n";
print "write\('<span
style=\"position:absolute;width:'+menuwidth+';clip:rect\(0
'+menuwidth+' auto 0\)\">'\)\n";
print "write\('<span id=\"test2\"
style=\"position:absolute;left:0;top:0\">'\)\n";
print "write\('</span></span></span>'\)\n";
print "}\n";
print "else if \(document.layers\){\n";
print "write\('<ilayer width='+menuwidth+'
name=\"ns_scrollmenu\">'\)\n";
print "write\('<layer name=\"ns_scrollmenu2\" left=0
top=0></layer></ilayer>'\)\n";
print "}\n";
print "write\('</td>'\)\n";
print "write\('<td valign=\"middle\"> <a href=\"#myForm\"
onMouseover=\"moveleft\(\)\"
onMouseout=\"clearTimeout\(lefttime\)\">'\)\n";
print "write\('<img src=\"'+gorightimage+'\" border=0></a>'\)\n";
print "write\('</td></table>'\)\n";
print "}\n";
print "}\n";
print "</script>\n";
print "</td></tr><tr>\n";
print "<td align=left><font face=\"geneva, arial\"
size=\"2\">Namn:</font><br><input name=\"name\" type=text size=\"30\"
maxlength=\"99\"></td>\n";
print "<td align=left width=*><font face=\"geneva, arial\"
size=\"2\">E-post adress:</font><br><input name=\"email\" type=text
size=\"30\" maxlength=\"99\"></td></tr>\n";
print "<tr><td align=left><font face=\"geneva, arial\"
size=\"2\">Hemsida:</font><br><input name=\"homepage\" type=text
size=\"30\" maxlength=\"99\"></td>\n";
print "<td align=left><font face=\"geneva, arial\"
size=\"2\">Hemort:</font><br><input name=\"hometown\" type=text
size=\"30\" maxlength=\"99\"></td></tr>\n";
print "<tr><td align=left></td><td align=left></td></tr>\n";
print "<tr><td align=left></td><td align=left></td></tr>\n";
print "<tr><td colspan=2><font face=\"geneva, arial\" size=\"2\">Mitt
meddelande:</font><br><textarea name=\"message\" rows=5 cols=60
wrap=virtual></textarea></td></tr>\n";
print "<tr><td><input name=\"gb\" type=hidden value=\"nytt\"><input
name=\"submit\" type=submit value=\"Skicka mitt
meddelande!\"></td>\n";
print "<td align=right> </form></td></tr></table></center></body></html>";
-----------------
Please help me out/ Mattias
------------------------------
Date: 22 May 2003 16:24:31 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: How do i use styles in perl?
Message-Id: <slrnbcpudv.kuj.abigail@alexandra.abigail.nl>
Mattias (mattias@mail.nu) wrote on MMMDLI September MCMXCIII in
<URL:news:cd848ce5.0305220816.430538e8@posting.google.com>:
)) Hi i´m so tot new at this but how do i use styles in a perl cgi
)) document?
))
)) In a htm page i write like this in the head:
A browser neither care, nor knows whether an HTML page was created
by a CGI program or by an editor. As long as you output valid
HTTP/HTML/CSS, it should work.
Abigail
--
$"=$,;*{;qq{@{[(A..Z)[qq[0020191411140003]=~m[..]g]]}}}=*_;
sub _ {push @_ => /::(.*)/s and goto &{ shift}}
sub shift {print shift; @_ and goto &{+shift}}
Hack ("Just", "Perl ", " ano", "er\n", "ther "); # 20030522
------------------------------
Date: Thu, 22 May 2003 12:33:11 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: How do i use styles in perl?
Message-Id: <slrnbcq2en.31g.tadmc@magna.augustmail.com>
Mattias <mattias@mail.nu> wrote:
> Hi i´m so tot new at this but how do i use styles in a perl cgi
> document?
The same way you'd use them in a Python or Java CGI document.
Please ask HTML questions in an HTML newsgroup.
> In a htm page i write like this in the head:
> ---------------------
><style type="text/css">
> body {
> scrollbar-arrow-color: white;
> scrollbar-base-color: #D8DDE1;
> scrollbar-dark-shadow-color: #D8DDE1;
> scrollbar-track-color: #D8DDE1;
> scrollbar-face-color: #6699CC;
> scrollbar-shadow-color: white;
> scrollbar-highlight-color: silver;
> scrollbar-3d-light-color: black;
> }
></style>
> -------------------------
> to get my scrollbar looking like i want. Now I want to put it in my
> guestbook cgi document
print <<ENDHTML;
<style type="text/css">
body {
scrollbar-arrow-color: white;
scrollbar-base-color: #D8DDE1;
scrollbar-dark-shadow-color: #D8DDE1;
scrollbar-track-color: #D8DDE1;
scrollbar-face-color: #6699CC;
scrollbar-shadow-color: white;
scrollbar-highlight-color: silver;
scrollbar-3d-light-color: black;
}
/style>
ENDHTML
> --------------------------
> #!/usr/bin/perl
use warnings;
use strict;
> if (length($sec) eq 1){
> $sec = "0$sec";
> }
$sec = sprintf "%02d", $sec;
> require './cgi-lib.cgi';
> &ReadParse(*input);
That is (still) Dinosaur code.
The modern way to do it is to use the CGI.pm module.
If you persist in ignoring the advice given you, folks will
eventually stop giving you advice...
[snip a few hundred lines of code]
> Please help me out/ Mattias
Please do not post hundreds of lines of code.
Please see the Posting Guidelines that are posted here frequently.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 22 May 2003 09:07:23 -0700
From: niudou@hotmail.com (niudou)
Subject: how to obtain the result from File::Find ?
Message-Id: <324590c7.0305220807.47d08515@posting.google.com>
use File::Find;
use strict;
my $target_dir;
if ( defined $target_dir ) {
find( \&wanted, $target_dir );
}
sub wanted {
my @list;
......; #after doing sth, creates @list including files what i
need
}
So the question is:
how to use the value of @list in my main program?
If i write "my @filelist = find( \&wanted, $target_dir );", @filelist
still include nothing.
Thanks a lot!!!
------------------------------
Date: 22 May 2003 17:46:23 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: how to obtain the result from File::Find ?
Message-Id: <u9k7cj0w0w.fsf@wcl-l.bham.ac.uk>
niudou@hotmail.com (niudou) writes:
> use File::Find;
> use strict;
>
> my $target_dir;
> if ( defined $target_dir ) {
> find( \&wanted, $target_dir );
> }
>
> sub wanted {
> my @list;
> ......; #after doing sth, creates @list including files what i
> need
> }
>
> So the question is:
> how to use the value of @list in my main program?
>
> If i write "my @filelist = find( \&wanted, $target_dir );", @filelist
> still include nothing.
You need to make @list not be declared inside wanted.
You could use a global variable (by which I mean either a
package-scoped variable or a file-scoped lexical). However global
variables are messy. Better to use a little closure as an
intermediary.
sub wanted {
my $list = shift;
#after doing sth, creates @$list including files what i need
}
my @filelist;
find( sub { wanted \@filelist }, $target_dir );
Alternatively do awaway with &wanted and put the whole thing in the
anonymous sub.
my @filelist;
my $wanted = sub {
#after doing sth, creates @filelist including files what i need
};
find( $wanted, $target_dir );
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 22 May 2003 10:34:29 -0400
From: "k" <k@k.com>
Subject: HP Perl build issue
Message-Id: <bain43$o0b$1@rockyflats.ardentsoftware.com>
I've been struggling with a particular problem building Perl on HP. I need
to use DBD-Oracle and DBD-ODBC (with a driver that requires -lpthread).
I found several references to solving this problem by rebuilding Perl
with -lcl and -lpthread. However, when I use this solution, other problems
occur (without -lpthread, make test is 100% successful). When I 'make test'
with a -lpthread -built Perl, I get lots of problems, but they fall into two
categories:
1)
op/taint...........getpwent: Invalid argument
FAILED at test 142
(This occurs only once)
2)
lib/anydbm.........Can't load '../lib/auto/Fcntl/Fcntl.sl' for module Fcntl:
Inv
alid argument at ../lib/DynaLoader.pm line 169.
at lib/anydbm.t line 11
BEGIN failed--compilation aborted at lib/anydbm.t line 11.
FAILED at test 0
(This type of "Can't load" error occurs many times with many .sl's).
I imagine that using -lpthread has somehow changed the dynamic loader
characteristics of the executable, but I'm not sure how to fix this.
I'm using this compiler (what /usr/bin/cc):
/usr/bin/cc:
LINT B.11.11.02 CXREF B.11.11.02
HP92453-01 B.11.11.02 HP C Compiler
$ Sep 8 2000 23:13:51 $
And the problem occurs when building at least Perl 5.003 and 5.8.0.
Any help would be greatly appreciated.
Thanks.
------------------------------
Date: Thu, 22 May 2003 17:37:37 +0200
From: "Sten Malmlund" <sten.malmlund@pp.htv.fi>
Subject: Re: html2txt
Message-Id: <bain4r$i6t$1@nyytiset.pp.htv.fi>
Thanks for the advices, just what I needed.
sten
------------------------------
Date: Thu, 22 May 2003 16:14:24 +0000 (UTC)
From: rdwillia@hgmp.mrc.ac.uk (Richard Williams)
Subject: Re: Minimal Linux Perl setup
Message-Id: <bait10$pdo$1@niobium.hgmp.mrc.ac.uk>
In article <EtPya.7609$mU6.13590@newsb.telia.net>,
Lars Olsson <lasseolsson@myrealbox.com> wrote:
>So I need a minimal Perl installation so that my initrd root file system
>doesn't become to big.
>If anyone has any hints regarding perhaps a small ready made Perl package
>or how to trim down the standards package, I would be thankful.
Maybe the PAR module would help?:
http://search.cpan.org/~autrijus/PAR/
Richard.
------------------------------
Date: Thu, 22 May 2003 16:43:49 +0100
From: "Richard Mahoney" <rm.mymail@NOSPAMHEREntlworld.com>
Subject: Net::AIM help!
Message-Id: <Re6za.10403$Mu3.200136@newsfep4-glfd.server.ntli.net>
Hi!
I'm having trouble sending an instant message with the Perl module Net::AIM.
I can connect to the service but it will not send a message???
===============
use Net::AIM;
$aim = new Net::AIM;
$conn = $aim->newconn(Screenname => 'AIMScreenname',
Password => 'Password');
$aim->start; // Connects fine
$aim->send_im('AnotherScreenname', 'Message'); // Doesn't work??
===============
Can anyone tell me what I'm doing wrong?
Many thanks, it's appreciated.
Rich.
------------------------------
Date: 22 May 2003 08:25:57 -0700
From: pambantis@yahoo.com (Pam Bantis)
Subject: ora_login with SYSDBA privileges
Message-Id: <238f3a9e.0305220725.6072c54c@posting.google.com>
Is it possible to connect to a database with SYSDBA privileges using
Oraperl ora_login?
+++ Perl snippet
my $db_connect = "sys/sysPassword@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=myHost)(PORT=1521))
(CONNECT_DATA=(SID=mySid))) as SYSDBA";
my $lda = &ora_login ('', $db_connect, '') || die
"em_error=$ora_errstr\n";
--- Perl snippet
I receive the following error:
ORA-12154: TNS:could not resolve service name (DBD ERROR:
OCIServerAttach)
------------------------------
Date: 22 May 2003 06:54:23 -0700
From: jonasb@alum.rpi.edu (Big Brother)
Subject: Re: Regexp Multiple Matching Problem
Message-Id: <79c1dbe1.0305220554.78d40285@posting.google.com>
Daniel -
Thanks for your response! I appreciate the help. Now, having read the
docs before posting to the newsgroup, I already tried that, and that's
where it seems to loop infinitely, thus my posting. I apologize for
not making it clear that I had tried while(/regexp/g). Any other
suggestions? When I do that, the browser just sits there forever.....
Daniel Cutter <dcutter@gmx.de> wrote in message news:<bagk99$734$1@news.eusc.inter.net>...
> while(/IPmatchingregexp/g)
> {
> # do stuff
> }
>
> You'd help yourself quite a lot by reading the documentation that comes
> with perl.
>
> Daniel
>
>
> > Hi -
> >
> > I am writing a script that parses through a file line by line to
> > search for IP addresses (it's to make syslog files available in HTML
> > with the IPs highlighted). I've got the code working for the first IP
> > on each line, but it never goes on to match if there is a second IP on
> > the line. So I have...
> > if($_=~/IPmatchingregexp/)
> > {
> > do stuff
> > }
> >
> > I tried replacing the if with a while, but it seems to go into an
> > infinite loop. Can anyone help me on how do basically do a:
> > foreach(matched regexp)? I want to run the "do stuff" code for each IP
> > on the line, not just the first.
> >
> > Thanks!
> > B
------------------------------
Date: Thu, 22 May 2003 11:24:40 -0500
From: "J. Gleixner" <glex_nospam@qwest.net>
Subject: Re: Regexp Multiple Matching Problem
Message-Id: <8N6za.372$v12.24597@news.uswest.net>
>>>I tried replacing the if with a while, but it seems to go into an
>>>infinite loop. Can anyone help me on how do basically do a:
>>>foreach(matched regexp)? I want to run the "do stuff" code for each IP
>>>on the line, not just the first.
while(<>)
{
# maybe it's your regexp??. so here's a verbose
# one for IP addresses that should work
foreach my $ip ( m/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/g)
{
#do_stuff with $ip
}
}
perldoc perlretut
------------------------------
Date: 22 May 2003 09:41:42 -0700
From: dwlepage@yahoo.com (david)
Subject: skipping lines based on a condition
Message-Id: <b09a22ae.0305220841.40a55079@posting.google.com>
I have a data file that has alternating lines in a comma seperated
format like this:
8,00000000,xxxx,yyyyy etc etc. (There are 37 fields in records
starting with '8')
37,0000000,bbbbb,ccccc,12345
8,00000000,ddddd,eeeeee, etcetc
37,0000000,fffff,gggggg,45678
I want to parse only records starting with 8, and leave the 37's
alone. I can't seem to find a way to do this. Here is what I have so
far. (which removes the 37 lines from the output file entirely. I want
to rewrite the file in the exact format that it is in now, without
touching '37' records:
use strict;
my @out;
if (@ARGV ne 1) {
print "Not enough ARGVS\n";
exit 0
}
open (IN, "<$ARGV[0]") || die "Cannot open input file\!\n";
open (OUT, ">Import52.txt") || die "Cannot open output file\!\n";
while ( <IN> ) {
if (/^8\,00000000.*?/) {
# Split fields by ;
my @comments = split (/,/);
if ($comments[8] =~ m/(.*)?/) {
my $new = $1;
$new =~ s/\//\-/g;
( $comments[8], $new ) = ( $new, $comments[8]
);
push (@out, join(",", @comments));
}
}
}
print OUT @out;
close(IN);
close(OUT);
------------------------------
Date: Thu, 22 May 2003 19:41:57 +0200
From: Thomas Nagel <thomas.nagel@planb.de>
To: david <dwlepage@yahoo.com>
Subject: Re: skipping lines based on a condition
Message-Id: <3ECD0BE5.5040402@planb.de>
Hi,
> I want to parse only records starting with 8, and leave the 37's
> alone. I can't seem to find a way to do this. Here is what I have so
> far. (which removes the 37 lines from the output file entirely. I want
> to rewrite the file in the exact format that it is in now, without
> touching '37' records:
Something like
while(<IN>){
next if /^37/; # skips lines starting with 37
# now process stuff starting with 8
...
}
should do the trick.
Thomas
------------------------------
Date: Thu, 22 May 2003 12:43:57 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: skipping lines based on a condition
Message-Id: <slrnbcq32t.31g.tadmc@magna.augustmail.com>
david <dwlepage@yahoo.com> wrote:
> format like this:
> 8,00000000,xxxx,yyyyy etc etc. (There are 37 fields in records
> starting with '8')
> 37,0000000,bbbbb,ccccc,12345
> I want to parse only records starting with 8, and leave the 37's
> alone.
> I want
> to rewrite the file in the exact format that it is in now, without
> touching '37' records:
>
> use strict;
> my @out;
>
> if (@ARGV ne 1) {
You are using the wrong operator.
ne compares _strings_, you want to compare _numbers_:
if (@ARGV != 1) {
> print "Not enough ARGVS\n";
If your program is called with 100 arguments, you will tell the
user that there are not enough arguments?
> exit 0
You should exit with a NON-zero value when an error is detected.
> }
You can replace the whole if-block with:
die "Must be called with exactly one argument\n" unless @ARGV == 1;
> open (IN, "<$ARGV[0]") || die "Cannot open input file\!\n";
You should include the $! variable in your diagnostic message.
> if (/^8\,00000000.*?/) {
> # Split fields by ;
> my @comments = split (/,/);
> if ($comments[8] =~ m/(.*)?/) {
> my $new = $1;
> $new =~ s/\//\-/g;
> ( $comments[8], $new ) = ( $new, $comments[8]
> );
> push (@out, join(",", @comments));
> }
> }
else {
push @out, $_;
}
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 22 May 2003 16:02:53 +0200
From: "Rene Scheibe" <Rene.Scheibe@gmx.net>
Subject: split and whitespaces
Message-Id: <bailad$5gu7$1@ID-65612.news.dfncis.de>
i have logfile like this:
0 0.99 ( 5, 45) ( 3, 33)
1 0 ( 34, 34) (40, 5)
1 0.884 ( 1, 0) (40, 4)
now i want to put all of the values in
an array. i do this now by:
my @array = split /[\s,()]+/, $_;
but the problem is that with \s the leading
whitespaces also are used to build the
first element of the array - how to avoid this?
and how to make a big array and access it?
its elements are the little arrays containing one
line each.
many thanks
rene
------------------------------
Date: Thu, 22 May 2003 16:40:19 +0200
From: Winfried Koenig <w.koenig@acm.org>
Subject: Re: split and whitespaces
Message-Id: <3ECCE153.6050002@acm.org>
Rene Scheibe wrote:
> i have logfile like this:
>
> 0 0.99 ( 5, 45) ( 3, 33)
> 1 0 ( 34, 34) (40, 5)
> 1 0.884 ( 1, 0) (40, 4)
>
> now i want to put all of the values in
> an array. i do this now by:
>
> my @array = split /[\s,()]+/, $_;
>
> but the problem is that with \s the leading
> whitespaces also are used to build the
> first element of the array - how to avoid this?
>
> and how to make a big array and access it?
> its elements are the little arrays containing one
> line each.
try this:
my @array;
while (<DATA>) {
my(undef, @line) = split /[\s,()]+/, $_;
push @array, [@line] if @line;
}
__DATA__
0 0.99 ( 5, 45) ( 3, 33)
1 0 ( 34, 34) (40, 5)
1 0.884 ( 1, 0) (40, 4)
Winfried Koenig
------------------------------
Date: Thu, 22 May 2003 17:29:45 +0200
From: "Rene Scheibe" <Rene.Scheibe@gmx.net>
Subject: Re: split and whitespaces
Message-Id: <baiqd3$8fhc$1@ID-65612.news.dfncis.de>
> push @array, [@line] if @line;
...can you explain this shortly?
'if @line' is just do get sure that only correctly
by 'split' filed lines are pushed to the array - right?
and do i need brackets and do not only:
push @array, @line if @line?
rene
------------------------------
Date: Thu, 22 May 2003 18:00:06 +0200
From: Winfried Koenig <w.koenig@acm.org>
Subject: Re: split and whitespaces
Message-Id: <3ECCF406.30804@acm.org>
Rene Scheibe wrote:
>> push @array, [@line] if @line;
>
>
> ...can you explain this shortly?
>
> 'if @line' is just do get sure that only correctly
> by 'split' filed lines are pushed to the array - right?
yes, depending on your logfile you may also use:
if (@line == 6) {
push @array, [@line];
} else {
warn "wrong number of fields in line: $.\n";
}
> and do i need brackets and do not only:
> push @array, @line if @line?
in your first article you write:
>> and how to make a big array and access it?
>> its elements are the little arrays containing one
>> line each.
Without the brackets you get one big array of all fields.
With bracket you get an array of little arrays.
Winfried Koenig
------------------------------
Date: 22 May 2003 17:36:48 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: split and whitespaces
Message-Id: <u9of1v0wgv.fsf@wcl-l.bham.ac.uk>
Winfried Koenig <w.koenig@acm.org> writes:
> Rene Scheibe wrote:
> >> push @array, [@line] if @line;
> > ...can you explain this shortly?
>
> > and do i need brackets and do not only:
> > push @array, @line if @line?
>
> in your first article you write:
>
> >> and how to make a big array and access it?
> >> its elements are the little arrays containing one
> >> line each.
>
> Without the brackets you get one big array of all fields.
> With bracket you get an array of little arrays.
Actually there's no need to make a copy of @line.
push @array, \@line if @line;
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 22 May 2003 18:03:46 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: split and whitespaces
Message-Id: <3ECD10F1.95B48D2D@acm.org>
Rene Scheibe wrote:
>
> i have logfile like this:
>
> 0 0.99 ( 5, 45) ( 3, 33)
> 1 0 ( 34, 34) (40, 5)
> 1 0.884 ( 1, 0) (40, 4)
>
> now i want to put all of the values in
> an array. i do this now by:
>
> my @array = split /[\s,()]+/, $_;
>
> but the problem is that with \s the leading
> whitespaces also are used to build the
> first element of the array - how to avoid this?
Instead of removing the stuff you don't need you can capture the stuff
you do need:
my @array = /[\d.]+/g;
> and how to make a big array and access it?
> its elements are the little arrays containing one
> line each.
Use an array of arrays:
my @data;
while ( <LOGFILE> ) {
push @data, [ /[\d.]+/g ];
}
__END__
perldoc perldsc
perldoc perllol
John
--
use Perl;
program
fulfillment
------------------------------
Date: 22 May 2003 07:55:58 -0700
From: puremeteor@yahoo.com (Billy)
Subject: splitting a very large file based on characters in a record (performance)
Message-Id: <a8eb837.0305220655.5dc41f71@posting.google.com>
I have a file with a large number of records (from 0.5 million to 1
million records). Each record is of length 250 characters and does not
have delimiters. I have to split each record into 2 separate records
(each of 125 characters), and further I have to split the 125
characters into different fields and based on the value of a field I
have to write it to 2 different output fields.
I would like to know if :
1. For a file of such huge size, should I split each record first into
2 and then work on it OR should I treat the whole 250 char record as
one and split it into fields as it is?? Performance is important here
2. Is it preferable to use ksh/awk over perl here?
3. Is it ok to use the "cut" command here?
Regards,
Billy
------------------------------
Date: Thu, 22 May 2003 17:11:13 +0200
From: stephan beal <stephan@wanderinghorse.net>
Subject: Re: splitting a very large file based on characters in a record (performance)
Message-Id: <baip7p$hm3$1@ork.noris.net>
Billy wrote:
> I would like to know if :
> 1. For a file of such huge size, should I split each record first into
> 2 and then work on it OR should I treat the whole 250 char record as
> one and split it into fields as it is?? Performance is important here
i honestly don't think you'll see a performance difference unless your
machine is so slow as to make everything noticably slow (e.g., my laptop,
where the HDD has no cache).
> 2. Is it preferable to use ksh/awk over perl here?
Eeeeeekkkk!! ;)
My reasoning: Perl can do everything awk can do, plus everything ksh can
non-interactively do, so my choice would be perl.
> 3. Is it ok to use the "cut" command here?
Should be no reason not to, but if you decide to use awk or perl you
probably don't need cut.
--
----- stephan beal
Registered Linux User #71917 http://counter.li.org
I speak for myself, not my employer. Contents may
be hot. Slippery when wet. Reading disclaimers makes
you go blind. Writing them is worse. You have been Warned.
------------------------------
Date: Thu, 22 May 2003 13:48:04 -0000
From: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: trying to create spaces
Message-Id: <Xns938363B416631dkwwashere@216.168.3.30>
Jürgen Exner <jurgenex@hotmail.com> wrote:
> Would be great if you could provide a working code sample that
> explains how to use nl~~nl
It's water between two parts of the Netherlands, so you drain() it.
my ($Waddenzee, $IJsselmeer, $reclaimed_land) = drain(nl~~nl);
------------------------------
Date: Thu, 22 May 2003 09:57:24 -0700
From: TruthXayer <TruthXayer@yahoo.com>
Subject: Re: wierd behaviour in writing out a file
Message-Id: <3ECD0174.39D1855B@yahoo.com>
"Eric J. Roode" wrote:
>
> -----BEGIN xxx SIGNED MESSAGE-----
> Hash: SHA1
>
> TruthXayer <TruthXayer@yahoo.com> wrote in news:3ECC1C92.E67BB860
> @yahoo.com:
>
> > o What is the cause of this wierd behaviour?
>
> A bug.
>
> > How can I
> > prevent it in the perl script?
>
> Find and fix the bug. The people in this newsgroup aren't going to be a
> whole lot of help without seeing the code. Is the section of the program
> that writes the file very big? If not, post it.
>
Yes, Its using write from a large hash...Again I think its a
file system issue
rather than a script thingy. I just leanred that the disk
was full and someone was
deleting files while the script was running. Will this cause
the behavious observed?
## Script uses use strict; use warnings; and no errors under
normal circumstances
## Relevant code from the script
##
my $x;
my $y;
format FILE =
@<<<< @<<<<<<
$x, $y
.
$x = $hash->{Key1} if (exists $$hash{Key1});
$y = $hash->{Key2} if (exists $$hash{Key2});
write FILE;
Original Reference Posting (Reattached for reference)
-----------------------------------------------------
Recently a relatively stable program experienced the
following problem.It writes out a relatively large file
x.out(few megs)
without any repetitive entries, just writes out
keys/values from a hash.
Now last night, it worte out the file with
repetitive
entries and filled up the entire disk space. I suspect this
is due to
some server/file system/permissions issue since I can't
replicate the problem and it behaves fine as usual.
o What is the cause of this wierd behaviour? How can
I
prevent it in the perl script?
> - --
> Eric
> print scalar reverse sort qw p ekca lre reh
> ts uJ p, $/.r, map $_.$", qw e p h tona e;
>
------------------------------
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 5026
***************************************