[22065] in Perl-Users-Digest
Perl-Users Digest, Issue: 4287 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 19 09:06:14 2002
Date: Thu, 19 Dec 2002 06:05:14 -0800 (PST)
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, 19 Dec 2002 Volume: 10 Number: 4287
Today's topics:
Re: Arguing about the advantage of Perl <me@privacy.net>
Re: Arguing about the advantage of Perl <pierre.rolin@soredi-group.com>
Configuration INC under Windows <ochampag@nortelnetworks.com>
Re: Configuration INC under Windows <nobull@mail.com>
Re: Configuration INC under Windows (Helgi Briem)
Re: Control-C trap <thepoet@nexgo.de>
csv file to mysql import (Arunav Mandal)
Re: DBD::DB2 installation problem : respost (Wonderinguy)
Extracting POST variables to a PHP page using Perl (Ben Williams)
Re: Extracting POST variables to a PHP page using Perl (Helgi Briem)
Re: foreach not working as I expected (Helgi Briem)
Re: FTPing without Net::FTP <me@privacy.net>
Hard Anodized 11665 (digital device)
Re: HELP on counter script <me@privacy.net>
Image creation/editing <daby55@NO23SPAM.com>
Imagemap with Chart::Composite and GD module <w-woerlinger@ti.com>
Re: Installing an event handler with use / require? <nobull@mail.com>
Re: List of perl error numbers?? <nobull@mail.com>
Re: perl regexp to extract table out of HTML <nospam@spamfrustrator.invalid.tla>
perl5.8 - 'my_perl' errors when compiling modules <zentara@highstream.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 19 Dec 2002 22:57:15 +1100
From: "Tintin" <me@privacy.net>
Subject: Re: Arguing about the advantage of Perl
Message-Id: <atsc6p$28djr$1@ID-172104.news.dfncis.de>
"news.dial.oleane.com" <pierre.rolin@soredi-group.com> wrote in message
news:atqldj$9ld$1@s1.read.news.oleane.net...
> As i must convert programs from JCL
> I have to argue about the avantage of using PERL instead of vb scripts.
>
> could anyone help me on that way.
> thanks a lot.
Please read http://www.cs.tut.fi/~jkorpela/usenet/xpost.html before you get
the urge to multi-post again.
------------------------------
Date: Thu, 19 Dec 2002 13:48:20 +0100
From: "Pierre.synergy.all" <pierre.rolin@soredi-group.com>
Subject: Re: Arguing about the advantage of Perl
Message-Id: <atsfbo$bu3$1@s1.read.news.oleane.net>
"Tintin" <me@privacy.net> a écrit dans le message de news:
atsc6p$28djr$1@ID-172104.news.dfncis.de...
>
> "news.dial.oleane.com" <pierre.rolin@soredi-group.com> wrote in message
> news:atqldj$9ld$1@s1.read.news.oleane.net...
> > As i must convert programs from JCL
> > I have to argue about the avantage of using PERL instead of vb scripts.
> >
> > could anyone help me on that way.
> > thanks a lot.
>
>
> Please read http://www.cs.tut.fi/~jkorpela/usenet/xpost.html before you
get
> the urge to multi-post again.
Dear Tintin,
This message is the only one on the net, as the one sent on
"comp.lang.perl.misc"
have been corrected ...
I gess that the urge of correcting one to another
and the willing to be the "wise guy" have
made you forget the reality of things.
yours.
Pierre
------------------------------
Date: Thu, 19 Dec 2002 13:20:28 +0100
From: "Olive" <ochampag@nortelnetworks.com>
Subject: Configuration INC under Windows
Message-Id: <atsdpa$63m$1@zcars0v6.ca.nortel.com>
Hi,
I got the follwing error "Can't locat toto.pl in @INC ...". As i try to
launch a perlscript (that is stored under Unix) via a NFS Partition mounted
on my PC (where i have installed perl), i need to add in the perlpath the
path where is my script ..
How to configure @INC under windows ... Is there a variable as PERLLIB or
something like that to set ???
Thanks,
Olivier
------------------------------
Date: 19 Dec 2002 12:43:09 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Configuration INC under Windows
Message-Id: <u9isxqyyaq.fsf@wcl-l.bham.ac.uk>
"Olive" <ochampag@nortelnetworks.com> writes:
> How to configure @INC under windows ... Is there a variable as PERLLIB or
> something like that to set ???
Yes, see "ENVIRONMENT" section of perlrun. This is no different on
Win32 or Unix.
See also the bit in perlwin32 where it talks about configuring @INC
with registry entries.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 19 Dec 2002 13:12:13 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Configuration INC under Windows
Message-Id: <3e01c57f.1271014462@news.cis.dfn.de>
On Thu, 19 Dec 2002 13:20:28 +0100, "Olive"
<ochampag@nortelnetworks.com> wrote:
>I got the follwing error "Can't locat toto.pl in @INC ...". As i try to
>launch a perlscript (that is stored under Unix) via a NFS Partition mounted
>on my PC (where i have installed perl), i need to add in the perlpath the
>path where is my script ..
>How to configure @INC under windows ... Is there a variable as PERLLIB or
>something like that to set ???
# assuming toto.pl is in /usr/home/olive/lib
use lib '/usr/home/olive/lib';
require toto.pl;
--
Regards, Helgi Briem
helgi AT decode DOT is
A: Top posting
Q: What is the most irritating thing on Usenet?
- "Gordon" on apihna
------------------------------
Date: Thu, 19 Dec 2002 09:31:48 +0100
From: "Christian Winter" <thepoet@nexgo.de>
Subject: Re: Control-C trap
Message-Id: <ats05l$478$1@newsread1.arcor-online.net>
"William Hymen" <t18_pilot@hotmail.spam.com> wrote:
> I have ActiveState perl on Wintel.
> Can I trap control-C or control-Z in a loop
> and "last" out of it?
> Example would be great.
Hi,
you can use the "raw" mode of Term::ReadKey for
this, which turns off control char interpretation.
Here's a simple example that works on Win and Linux
for me (basics taken from 'perldoc Term::Readkey):
--------------------------------------------
#!C:\Perl\bin\perl -w
use Term::ReadKey;
use strict;
my $key;
ReadMode 4; # Turn off controls keys
while(1) {
while (not defined ($key = ReadKey(-1))) {
# No key yet
}
last if( ord($key) == 3 || ord($key) == 26 );
printf("Got char %03i\n",ord($key));
}
my $a=(ord($key)==3)?"C":"Z";
print "You pressed CTRL+$a\n";
ReadMode 0; # Reset tty mode before exiting
--------------------------------------------
HTH
-Christian
------------------------------
Date: 19 Dec 2002 05:55:33 -0800
From: dibun@hotmail.com (Arunav Mandal)
Subject: csv file to mysql import
Message-Id: <a75562ad.0212190555.47287674@posting.google.com>
I am trying to import the csv style address book in mysql database
with the following script but it always inserts a blank row everytime
I run the perl script. Can I anybody let me know where is the problem?
#!/usr/bin/perl
#use strict;
use CGI qw(param);
use DBI;
use vars qw(
$q
);
$q = CGI->new;
my @cols = qw/
user
Name
email
Subject
Body
FromName
FromAddress
FromType
ToName
ToAddress
ToType
CCName
CCAddress
CCType
BCCName
BCCAddress
BCCType
BillingInformation
Categories
Importance
Mileage
Sensitivity
/;
chdir '$file';
my %insert;
my $dbh = DBI->connect("DBI:mysql:database=address", "user", "pass");
my $csv = DBI->connect("DBI:CSV:") or die "connect" . $DBI::errstr;
my $count = 0;
for (<*>) {
my $sth = $csv->prepare("SELECT * FROM $_") or die $DBI::errstr;
$sth->execute() or die $DBI::errstr;
my $n;
while (my @ref = $sth->fetchrow_array) {
@insert{@cols} = @ref;
$n = InsertAndGetID($dbh, 'address', \%insert, 'ID');
}
$count = $n;
$sth->finish();
}
$dbh->disconnect();
$csv->disconnect();
sub
InsertAndGetID
{
#---------------------------------------------------------------
# inserts an entry into a db and gets the auto_increment ID
#---------------------------------------------------------------
my $dbh = shift;
my $table = shift;
my $Inserts = shift;
my $IDCol = shift;
$Inserts->{$IDCol} = 'NULL';
$dbh->do("LOCK TABLES $table WRITE") or die $dbh->errstr;
InsertMultipleValues($dbh,$table,$Inserts);
$sth = $dbh->prepare("SELECT LAST_INSERT_ID() FROM $table") or die
$dbh->errstr;
$sth->execute or die $dbh->errstr;
my @ary = $sth->fetchrow_array or die $dbh->errstr;
$dbh->do("UNLOCK TABLES") or die $dbh->errstr;
$sth->finish;
return $ary[0];
}
sub
InsertMultipleValues
{
#---------------------------------------------------------------
# Inserts contents of a hashref into the db table specified
#---------------------------------------------------------------
my $dbh = shift;
my $table = shift;
my $Inserts = shift;
my @cols = keys %$Inserts;
my @vals = @$Inserts{@cols};
my $cols = join ',', @cols;
my $places = '?,' x @vals;
chop $places;
my $sth = $dbh->prepare("INSERT INTO $table ($cols) VALUES
($places)") or die $dbh->errstr;
$sth->execute(@vals) or die "$dbh->errstr : $table";
}
------------------------------
Date: 19 Dec 2002 04:16:35 -0800
From: wonderinguy@hotmail.com (Wonderinguy)
Subject: Re: DBD::DB2 installation problem : respost
Message-Id: <6950e82.0212190416.299903df@posting.google.com>
Anybody....
I have installed DBI 1.32 on Suse linux on S390
> DB2 EE is running with out any problem
> When I try to install DBD::DB2 0.76 , i get error during make test
>
> Makefile.PL works fine so does make
> but when I type make test . I get the following error
>
> <<Snip>>
>
> t/base..............install_driver(DB2) failed: Can't locate auto/DBD/DB2/Consta
> nts/SQL_PARAM_I.al in @INC (@INC contains: blib/arch blib/lib /usr/lib/perl5/5.6
> .0/s390-linux /usr/lib/perl5/5.6.0/s390-linux /usr/lib/perl5/5.6.0/s390-linux /u
> sr/lib/perl5/5.6.0 /usr/lib/perl5/5.6.0/s390-linux /usr/lib/perl5/5.6.0/s390-lin
> ux /usr/lib/perl5/5.6.0 /usr/lib/perl5/site_perl/5.6.0/s390-linux /usr/lib/perl5
> /site_perl/5.6.0/s390-linux /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_p
> erl/5.6.0/s390-linux /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl . /
> usr/lib/perl5/5.6.0/s390-linux /usr/lib/perl5/5.6.0 /usr/lib/perl5/site_perl/5.6
> .0/s390-linux /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl .) at blib
> /lib/DBD/DB2.pm line 40
> Compilation failed in require at (eval 1) line 3.
> Perhaps a module that DBD::DB2 requires hasn't been fully installed
> at t/base.t line 16
> t/base..............dubious
> Test returned status 255 (wstat 65280, 0xff00)
> DIED. FAILED tests 4-5
> Failed 2/5 tests, 60.00% okay
> t/main..............ok
> Failed Test Status Wstat Total Fail Failed List of failed
> -------------------------------------------------------------------------------
> t/base.t 255 65280 5 2 40.00% 4-5
> Failed 1/2 test scripts, 50.00% okay. 2/6 subtests failed, 66.67% okay.
> make: *** [test_dynamic] Error 29
>
> <<snip>>
>
> any help will be great
>
> thanks
------------------------------
Date: 19 Dec 2002 03:00:55 -0800
From: ben.williams@ocado.com (Ben Williams)
Subject: Extracting POST variables to a PHP page using Perl
Message-Id: <ec75e27e.0212190300.297100a7@posting.google.com>
Hi
Am I attempting the impossible ? I am attempting to access a set of
PHP pages via perl, to send them specific values so that I can produce
a set of reports. Given that the PHP pages do a POST when the form is
submitted, is it possible to manipulate the HTTP call to the page to
have specific values, for example something like the cgi
?value1=X?value2=Y ? Is it possible to read in the $QUERY_STRING,
grab the data using regular expressions, and then use that ?
Many thanks
Ben Williams
------------------------------
Date: Thu, 19 Dec 2002 12:01:33 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Extracting POST variables to a PHP page using Perl
Message-Id: <3e01b4f3.1266778201@news.cis.dfn.de>
On 19 Dec 2002 03:00:55 -0800, ben.williams@ocado.com (Ben
Williams) wrote:
>Hi
>
>Am I attempting the impossible ? I am attempting to access a set of
>PHP pages via perl, to send them specific values so that I can produce
>a set of reports. Given that the PHP pages do a POST when the form is
>submitted, is it possible to manipulate the HTTP call to the page to
>have specific values, for example something like the cgi
>?value1=X?value2=Y ? Is it possible to read in the $QUERY_STRING,
>grab the data using regular expressions, and then use that ?
use LWP::UserAgent;
See http://www.perldoc.com/perl5.8.0/lib/LWP/UserAgent.html
for details.
--
Regards, Helgi Briem
helgi AT decode DOT is
A: Top posting
Q: What is the most irritating thing on Usenet?
- "Gordon" on apihna
------------------------------
Date: Thu, 19 Dec 2002 09:37:23 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: foreach not working as I expected
Message-Id: <3e01931c.1258114112@news.cis.dfn.de>
On Wed, 18 Dec 2002 11:03:29 -0600, tadmc@augustmail.com
(Tad McClellan) wrote:
>Helgi Briem <helgi@decode.is> wrote:
>> On Wed, 18 Dec 2002 11:14:18 -0500, Lou Moran
>><lou.moran@gellerandwind.com> wrote:
>
>> Perl does not understand (<*.txt>).
>
>Yes it does.
Sorry, I wrote without checking. As I
said, I never use glob.
>> For that you use the glob function.
>> my @files = glob (<$dir/*.txt>);
>
>That is a glob-of-globs...
--
Regards, Helgi Briem
helgi AT decode DOT is
A: Top posting
Q: What is the most irritating thing on Usenet?
- "Gordon" on apihna
------------------------------
Date: Thu, 19 Dec 2002 22:33:35 +1100
From: "Tintin" <me@privacy.net>
Subject: Re: FTPing without Net::FTP
Message-Id: <atsaqe$26bqn$1@ID-172104.news.dfncis.de>
"Kevin Brownhill" <BROWNHIK@Syntegra.Bt.Co.Uk> wrote in message
news:atpqbt$jcb$1@pheidippides.axion.bt.co.uk...
>
> "Tintin" <me@privacy.net> wrote in message
> news:atpnn2$1cv63$1@ID-172104.news.dfncis.de...
> >
> > "Kevin Brownhill" <BROWNHIK@Syntegra.Bt.Co.Uk> wrote in message
> > news:atpkai$g4l$1@pheidippides.axion.bt.co.uk...
> > > # This will work for Unix
> >
> > Might well do, but why write a shell script as a Perl script?
> >
>
> Because it answers the original question.
>
> It is not writing a shell script as Perl - it uses the shell for a small
> part of the program
It uses external commands for the vast majority of the script and thus
defeats the purpose of writing it in Perl. Just to prove a point, here's
the shell version:
cmd = "'open $HOSTNAME\\nuser $USER $PASSWORD\\nasc\\ncd $REMDIR\\nlcd
LOCALDIR\\nget $filename\\nquit\\n'"
res = `echo $cmd | /usr/bin/ftp -ivn`
Notice that there is only 4 bytes difference, two for the $ and two for the
;
------------------------------
Date: 19 Dec 2002 11:47:58 GMT
From: altec.thermal@msa.hinet.net(digital device)
Subject: Hard Anodized 11665
Message-Id: <atsble$3pf@netnews.hinet.net>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=big5">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Altec Heatsinks manufacturer</TITLE>
<META http-equiv=Content-Type content="text/html; charset=big5"><BASE
href=http://www.thermalweb.com/>
<META
content="heatsink ,heat sink ,heatsinks,heat sinks ,cpu heatsink ,chipset heatsink ,cooler , bga heatsink ,aluminum extrusion,extruding heatsink,amplifier heatsink,cpu cooler,chipset cooler,front panel,server case,hardcoat anodizes,aluminum plate,aluminum case,die casting,cnc process,aluminum products"
name=Keywords>
<META
content="Altec specializes in producing heatsink , bga heatsink ,aluminum extrusion, extruding heatsink,amplifier heatsink,cpu cooler,chipset cooler,front panel,server case,hardcoat anodizes,aluminum plate,aluminum case,die casting,cnc process,aluminum products."
name=Description>
<META content="MSHTML 5.50.4134.100" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY text=#000000 vLink=#333333 aLink=#ffcc66 link=#333333 bgColor=#ffffff>
<DIV> </DIV>
<TABLE cellSpacing=0 cellPadding=0 width=755 align=center bgColor=#e9e9e9
border=0>
<TBODY>
<TR>
<TD width=157 bgColor=#ffffff>
<DIV align=center><IMG height=36 src="image/logo3.gif" width=106></DIV></TD>
<TD width=598>
<TABLE cellSpacing=0 cellPadding=0 width=600 align=right bgColor=#ffffff
border=0>
<TBODY>
<TR>
<TD bgColor=#dddddd>
<DIV align=right>
<DIV align=right><FONT
face="Verdana, Arial, Helvetica, sans-serif"><I><FONT color=#666666
size=2>Altec Electromic inc,<FONT size=1>Aluminum Extrusion
Tech.,Heatsinks Solutions</FONT></FONT><FONT color=#333333
size=2><FONT size=1>.</FONT></FONT></I></FONT></DIV></DIV></TD></TR>
<TR>
<TD bgColor=#ffffff>
<TABLE borderColor=#dddddd cellSpacing=0 cellPadding=0 width=600
bgColor=#999999 border=1>
<TBODY>
<TR bgColor=#cccccc>
<TD borderColor=#999999 width=104>
<DIV align=center><A href="comp.htm"><FONT
color=#666666><B><FONT
face="Verdana, Arial, Helvetica, sans-serif"
size=2>Home</FONT></B></FONT></A></DIV></TD>
<TD borderColor=#999999 width=102>
<DIV align=center><A href="product.htm"><FONT
color=#666666><B><FONT
face="Verdana, Arial, Helvetica, sans-serif"
size=2>Products</FONT></B></FONT></A></DIV></TD>
<TD borderColor=#999999 width=103>
<DIV align=center><A href="mold.htm"><FONT
color=#666666><B><FONT
face="Verdana, Arial, Helvetica, sans-serif"
size=2>Molds</FONT></B></FONT></A></DIV></TD>
<TD borderColor=#999999 width=103>
<DIV align=center><A href="equips.htm"><FONT
color=#666666><B><FONT
face="Verdana, Arial, Helvetica, sans-serif"
size=2>Facilities</FONT></B></FONT></A></DIV></TD>
<TD borderColor=#999999 width=103>
<DIV align=center><A href="factory/fac.htm"><FONT
color=#666666><B><FONT
face="Verdana, Arial, Helvetica, sans-serif"
size=2>Factory</FONT></B></FONT></A></DIV></TD>
<TD borderColor=#999999 width=108>
<DIV align=center><A href="mailto:altec@thermalweb.com"><FONT
color=#666666><B><FONT
face="Verdana, Arial, Helvetica, sans-serif"
size=2>Contact</FONT></B></FONT></A></DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=755 align=center border=0>
<TBODY>
<TR>
<TD width=755 bgColor=#999999 height=12> </TD></TR>
<TR>
<TD width=755 height=30> </TD></TR></TBODY></TABLE>
<TABLE height=500 cellSpacing=0 cellPadding=0 width=755 align=center border=0>
<TBODY>
<TR>
<TD width=9> </TD>
<TD vAlign=top width=156>
<TABLE width=150 border=0>
<TBODY>
<TR>
<TD vAlign=top height=140>
<DIV align=center><A href="mold.htm"><IMG height=87
src="altechp/m7alextrude.jpg" width=113 border=0></A></DIV></TD></TR>
<TR>
<TD vAlign=top height=140>
<DIV align=center><A href="product.htm"><IMG height=90
src="altechp/m5alextrude.jpg" width=120 border=0></A></DIV></TD></TR>
<TR>
<TD vAlign=top height=140>
<DIV align=center><A href="products/hanodized/harda.htm"><IMG
height=80 src="altechp/m3hardcoat.jpg" width=120
border=0></A></DIV></TD></TR></TBODY></TABLE>
<P> </P>
<P> </P></TD>
<TD width=17> </TD>
<TD vAlign=top width=573>
<TABLE width=570 border=0>
<TBODY>
<TR>
<TD vAlign=top height=140>
<P><FONT face="Verdana, Arial, Helvetica, sans-serif" color=#333333
size=3><B><FONT color=#0000ff>Aluminum Extrusion<FONT
size=2>S</FONT></FONT></B></FONT><FONT
face="Verdana, Arial, Helvetica, sans-serif" color=#333333 size=2>
are the most cost-effective solution for the majority of electronic
cooling applications, and Altec have accumulated over 1,500 heat
sink extrusion profiles designed and tooled over the past 10
years.</FONT></P>
<P> </P></TD></TR>
<TR>
<TD vAlign=top height=140>
<P><FONT face="Verdana, Arial, Helvetica, sans-serif" color=#333333
size=3><B><FONT color=#0000ff>Heatsink thermal
solutions</FONT></B></FONT><FONT
face="Verdana, Arial, Helvetica, sans-serif" color=#333333 size=2>
cover a wide range of applications and devices, such as standard
electrical packages TO-220 TO-247..etc. , Microprocessors , DC to DC
Converter ,UPS and Power supply,and offers a wide range of cooling
solutions for motherboard ,Video Card , Networking
applications.</FONT></P>
<P></P></TD></TR>
<TR>
<TD vAlign=top height=140><FONT
face="Verdana, Arial, Helvetica, sans-serif" color=#333333
size=3><B><FONT color=#0000ff>Hardcoat
anodizing</FONT></B></FONT><FONT
face="Verdana, Arial, Helvetica, sans-serif" color=#333333 size=2>
provides for several desirable qualities such as: Corrosion
Resistance, High Durability ,Electrical Insulation ,High temperature
Resistance, Breakdown Voltage Resistance ,Low rub coefficient.
Altec's Hardcoat Anodizing have strictly quality control and achieve
MIL-A-8625E TYPE3 ,AMS 2469C and B.S.5599
standardization.<BR></FONT></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=755 align=center border=0>
<TBODY>
<TR>
<TD bgColor=#cccccc>
<DIV align=right><FONT face="Verdana, Arial, Helvetica, sans-serif"
size=1>Copyright(c) 2002 Altec Electronic
Inc.</FONT></DIV></TD></TR></TBODY></TABLE></BODY></HTML>
aNDSu
------------------------------
Date: Thu, 19 Dec 2002 22:48:50 +1100
From: "Tintin" <me@privacy.net>
Subject: Re: HELP on counter script
Message-Id: <atsbtr$23elf$1@ID-172104.news.dfncis.de>
"Brandon Holland" <branmh@cox-internet.com> wrote in message
news:v018pmc3c1vh20@corp.supernews.com...
> counter.cgi
> --------------------------------------------------------------------------
--
> #!/usr/bin/perl
>
> $directory = "/path/to/mydirectory/counter/data/";
> $count = "$ENV{'DOCUMENT_NAME'}";
>
> open (FILE, "$directory$count");
> flock(FILE, 2);
> ($number,$remote) = split(/:/, <FILE>);
>
> $number++ if $remote ne "$ENV{'REMOTE_ADDR'}";
>
> print "Content-type: text/html\n\n";
> print "$number";
>
> truncate(FILE, length("$number:$ENV{'REMOTE_ADDR'}"));
> seek(FILE, 0, 0);
> print FILE "$number:$ENV{'REMOTE_ADDR'}";
> close(FILE);
> exit();
>
> --------------------------------------------------------------------------
--
> the problem is the filename in line 6 when line 4 is using
> $ENV{'DOCUMENT_NAME'},
> but when changing to a real filename instead of $ENV{'DOCUMENT_NAME'} it
> works.
>
>
> I found this script on a web host's web site and added lines 3 and 4. and
> changed line 6
Congratulations.
------------------------------
Date: Thu, 19 Dec 2002 12:54:23 -0000
From: "DM" <daby55@NO23SPAM.com>
Subject: Image creation/editing
Message-Id: <atsfkf$ubc$1@news5.svr.pol.co.uk>
I`ve had a look through the perl packages and can`t find anything that looks
suitable. Basically I want to be able to create a new image (preferably a
.png) and then paste other images into it images into it, one after the
other (vertically). Any perl modules capable of doing this?
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.431 / Virus Database: 242 - Release Date: 17/12/2002
------------------------------
Date: Thu, 19 Dec 2002 12:31:21 +0100
From: "Willi Woerlinger" <w-woerlinger@ti.com>
Subject: Imagemap with Chart::Composite and GD module
Message-Id: <atsalk$l32$1@tilde.itg.ti.com>
I'm creating an png graph using the perl module CHART::xxx and I want
to use the function 'imagemap_dump' to get the graph item positions for
making a html file containing imagemap data display.
This works fine if I use a single chart type like 'Chart::Bars',
'Chart::Lines',..
But If I use 'Chart::Composite' it fails with the following error:
You need to set the imagemap option to true, and then call the png
method, before you can get the imagemap data at
C:\Perl\Willi\testgraph\graphcc_map.pl line 71
----- code snippet -----
use strict;
use Chart::Bars;
use Chart::Lines;
use Chart::Composite;
use Data::Dumper;
my @data = ( [ [ "Oct 01", "Nov 01", "Dec 01", "Jan 02", "Feb 02", "Mar
02" ],
[ 95.1, 94.4, 90.2, 94.4, 93.8, 95.5 ],
[ 93.0, 93.0, 94.0, 94.0, 94.0, 94.0 ] ] );
my $png_name = 'TestGraphl.png';
my @legend_keys = ( "Actual ","Goal" );
my $Graph = new Chart::Composite(600,400);
#my $Graph = new Chart::Bars(600,400);
#my $Graph = new Chart::Lines(600,400);
$Graph->set(
composite_info => [ [ 'Bars', [ 1 ] ],
[ 'Lines', [ 2 ] ] ],
colors => { dataset0 => 'green',
dataset1 => 'red' },
title_font => GD::Font->Giant,
label_font => GD::Font->Small,
legend_font => GD::Font->Small,
tick_label_font => GD::Font->Large,
brush_size => 2,
grid_lines => 'true',
graph_border => 0,
imagemap => 'true',
legend => 'none',
legend_labels => \@legend_keys,
max_val => 120,
min_val => 0,
png_border => 4,
pt_size => 15,
same_y_axes => 'true',
spaced_bars => 'true',
skip_x_ticks => 1,
skip_y_ticks => 1,
tick_len => 2,
title => "Yield 2002",
text_space => 5,
transparent => 'true',
x_label => '',
y_label => '', #Process Yield in %',
x_ticks => 'vertical',
y_ticks => 7 );
$Graph->png( "$png_name", @data );
my $imagemap_data = $Graph->imagemap_dump();
print Dumper($imagemap_data);
------- code snippet ----
My config:
NT 4.0 SP6a,
AS Perl 629,
GD 1.27.2,
Chart 0.99, (Chart 1.0.1 has the same problem)
I cannot find any precompiled version of a newer GD for Windows NT.
Maybe this would fix the problem. By I don't have a MS VC++ compiler to
create it on my own.
Can anybody help me to get this function working ??
I am also trying to setup AS Perl 5.8.0 (build 804) on another Windows
system.
Does anybody know a location where I can get a pretty new precompiled
version of the GD module for Windows ?
Any help is appreciated.
Many thanks,
Willi
------------------------------
Date: 19 Dec 2002 12:37:47 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Installing an event handler with use / require?
Message-Id: <u9r8ceyyjo.fsf@wcl-l.bham.ac.uk>
pcj-google@inxar.org (Paul Cody Johnston) writes:
> I would like to receive notification when a particular Module is fully
> loaded. This would look something like:
>
> my $sub = { print "My::Module loaded!\n; };
> add_loader_listener("My::Module", $sub);
>
> Later at some unpredictable time during program execution, if
> "My::Module" is dynamically loaded, $sub would be invoked.
>
> Any way to do this?
I can see how to do it but it's rather involved - can you explain why
you want to do this? Perhaps there's a better way.
If I had such a requirement here's how I'd go about it...
I would create a module and call it something like "Devel::OnLoad".
The exported function Devel::OnLoad::add_loader_listener() would push
stuff into a hash of arrays of coderefs in %Devel::OnLoad::handlers.
Devel::OnLoad would install a module load handler in @INC (so it would
need Perl 5.8). I've never done this so I'd have to RTFM to figure
out how.
The handler would see that there was a value in
$Devel::OnLoad::handlers{'My/Module.pm'} and return a dummy
My/Module.pm rather then the real My/Module.pm
The dummy My/Module.pm module would just be the single line:
Devel::OnLoad::chain('My/Module.pm')
This subroutine would be something like:
sub Devel::OnLoad::chain {
my $mod = shift;
my $handlers = delete $Devel::OnLoad::handlers{$mod};
delete $INC{$mod};
require $mod;
&$_ for @$handlers;
1;
}
The require above would again call the Devel::OnLoad module load
handler but this time $Devel::OnLoad::handlers{'My/Module.pm'} is
undefined so it would return undef.
Perl would then procede down @INC and load the real 'My/Module.pm'.
Having gone to all this effort I'd put Devel::OnLoad on CPAN.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 19 Dec 2002 12:39:48 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: List of perl error numbers??
Message-Id: <u9n0n2yygb.fsf@wcl-l.bham.ac.uk>
Brandon Hoppe <bhoppe@ti.com> writes:
> What are all the possible error numbers and error codes returned by
> perl?
1-255
> Is there a list of them all?
See "perldoc -f die". If Perl terminates abnornmally it is though it
has executed die(). The exit code is determined by the current
values of $! and $?.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 19 Dec 2002 09:27:44 +0000
From: Dave Pimlott <nospam@spamfrustrator.invalid.tla>
Subject: Re: perl regexp to extract table out of HTML
Message-Id: <3E019110.8C7FC39E@spamfrustrator.invalid.tla>
Tad McClellan wrote:
>
> So you realize that using a regex to "parse" HTML is Not So Good then?
consider that lesson well and truly learnt!!
> Once you get a regex that "works", try it with this:
>
> <TABLE>
> table one data
> <!--
> what the heck is a </TABLE> doing in this comment?
> -->
> </TABLE>
I see your point, but this a one off piece of code working on known HTML
(for those interested it's the output of the sys_check command on Tru-64)
so I /know/ that there aren't any comments, never the less I will use a
module next time round.
> > perl -0777 -pe 'print "$1\n" while /(\<TABLE.*?\<\/TABLE\>)/s'
> > somefile.htm > myOutputFile
> >
> > Any pointers for me to get this to work?
>
> You are print()ing *twice*, use -n instead of -p.
>
> You have a while but no m//g, so it is going to loop for
> a "long time" if the match succeeds once. :-)
I'd noticed that, it matched 9000+ times before I killed it...
> Angle brackets are not special in regexes, no need to backslash them.
that's what I thought, yet the interpreter was complaining about
"unterminated operator <>" and being the perl expert that I'm not, I wasn't
sure what that meant / how to fix it...
> If you use an alternate delimiter for your m// then you
> won't need to backslash the slash either.
>
> perl -0777 -ne 'print "$1\n" if m#(<TABLE.*?</TABLE>)#s'
I have (finally) seen the light... thank you very much for your
assistance!! rhetorical question:why does the answer seem so simple?
Dave Pimlott.
--
Politicians should be changed frequently, like nappies - and for
much the same reason. -- Lazarus Long (Time Enough for Love)
------------------------------
Date: Thu, 19 Dec 2002 08:18:29 -0500
From: zentara <zentara@highstream.net>
Subject: perl5.8 - 'my_perl' errors when compiling modules
Message-Id: <ieh30v4m69g6i065e2265bq2d0ge6d1hsk@4ax.com>
Hi,
I have been running into module compilation errors
under perl5.8 with the modules Net-RawIP-0.09d,
Audio-0.005, and Audio-SoundFile-0.15.
The errors all center arounf 'my_perl'.
For example:
--------------------------------------------------------------------------------------------------
zentara@zentara:~/perlmodules/Net-RawIP-0.09d> make
cc -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O3 --pipe
-DVERSION=\"0.09\" -DXS_VERSION=\"0.09\" -fPIC
"-I/usr/lib/perl5/5.8.0/i586-linux-thread-multi/CORE" -D_LINUX_ -D_ETH_
-D_IFLIST_ -D_GLIBC_ util.c
util.c: In function `host_to_ip':
util.c:121: `my_perl' undeclared (first use in this function)
util.c:121: (Each undeclared identifier is reported only once
util.c:121: for each function it appears in.)
make: *** [util.o] Error 1
--------------------------------------------------------------------------------------------------
Is there some option I need to add to my "make Makefile.pl"
to make these modules compile correctly?
I have Perl5.6 running under the same OS, and compiler, and
the modules compile correctly.
I'm using SuSe8.1, gcc3.2
------------------------------------------------------------------------------------------------
#gcc -V
Reading specs from /usr/lib/gcc-lib/i486-suse-linux/3.2/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr
--with-local-prefix=/usr/local --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib
--enable-languages=c,c++,f77,objc,java,ada --enable-libgcj
--with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib
--with-system-zlib --enable-shared --enable-__cxa_atexit i486-suse-linux
Thread model: posix
gcc version 3.2
----------------------------------------------------------------------------------------------------------
#perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
Platform:
osname=linux, osvers=2.4.19, archname=i586-linux-thread-multi
uname='linux bloembergen 2.4.19 #1 mon apr 15 08:57:26 gmt 2002 i686
unknown '
config_args='-ds -e -Dprefix=/usr -Dusethreads -Di_db -Di_dbm
-Di_ndbm -Di_gdbm -Duses
hrplib=true'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing
-D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64',
optimize='-O3 --pipe',
cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing'
ccversion='', gccversion='3.2', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags =''
libpth=/lib /usr/lib /usr/local/lib
libs=-lnsl -ldl -lm -lpthread -lc -lcrypt -lutil
perllibs=-lnsl -ldl -lm -lpthread -lc -lcrypt -lutil
libc=, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.2.5'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic
-Wl,-rpath,/usr/li
b/perl5/5.8.0/i586-linux-thread-multi/CORE'
cccdlflags='-fPIC', lddlflags='-shared'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES
PERL_IMPLICIT_CONTEXT
Built under linux
Compiled at Sep 9 2002 18:13:56
%ENV:
PERL5LIB="/home/zentara/perl5lib"
@INC:
/home/zentara/perl5lib
/usr/lib/perl5/5.8.0/i586-linux-thread-multi
/usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i586-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl
------------------------------
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 4287
***************************************