[17877] in Perl-Users-Digest
Perl-Users Digest, Issue: 37 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 11 09:05:38 2001
Date: Thu, 11 Jan 2001 06:05:12 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <979221912-v10-i37@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 11 Jan 2001 Volume: 10 Number: 37
Today's topics:
Contract Opportunity, Frankfurt 1700dm per day or £500 <robert.parkes@dpp.co.uk>
Re: counting lines in a file (Martien Verbruggen)
DBI and migrating a 'flat-file' script to use DBI <nospam@nospam.com>
Re: DBI and migrating a 'flat-file' script to use DBI <johnj@pathfind.demon.co.uk>
File::Find - how to follow links hedley_s@my-deja.com
Re: File::Find - how to follow links (Rafael Garcia-Suarez)
Re: File::Find - how to follow links (Martien Verbruggen)
Re: File::Find - how to follow links hedley_s@my-deja.com
Re: File::Find - how to follow links hedley_s@my-deja.com
Re: File::Find - how to follow links (Rafael Garcia-Suarez)
FORM generates wrong .cgi address? <raldanash@my-deja.com>
Re: FORM generates wrong .cgi address? <peb@bms.umist.ac.uk>
Re: How do I convert %40 to '@' ? <jbuff1856@my-deja.com>
how to use HTML::Parser <zhenghua_li@nj.trendmicro.com>
Re: how to use HTML::Parser <bart.lateur@skynet.be>
Re: how to use HTML::Parser <jbuff1856@my-deja.com>
left op of && and || only in scalar context ? <stephen@twocats.dont-spam.demon.co.uk>
Re: left op of && and || only in scalar context ? (Anno Siegel)
Re: left op of && and || only in scalar context ? <bart.lateur@skynet.be>
Re: Licensing a program written perl? (Mark Jason Dominus)
Re: Licensing a program written perl? <jbuff1856@my-deja.com>
Maybe more of a unix question. Translating file names (G.A.D.Miles)
net::telnet difficulty accessing an existing directory. <l.hagen@HumanInference.com>
Re: Perl & MS Exchange <pjdurai@my-deja.com>
Re: Problem... Src included... nobull@mail.com
RE: problems perl odbc SQL-Server 7.0: no records with <claudio.militello@infos.es>
Re: RegEx question (Helgi Briem)
Security <jeremy.hutchings@cw.com>
Re: Security (Rafael Garcia-Suarez)
Re: socket send to client problem (Anno Siegel)
Re: socket send to client problem (Garry Williams)
Strange ? <Waarddebon@chello.nl>
Re: Strange ? <nickco3@yahoo.co.uk>
Re: Strange ? <zhenghua_li@nj.trendmicro.com>
Re: Strange ? (Colin Watson)
WORK AROUND perl odbc SQL-Server 7.0: no records with t <claudio.militello@infos.es>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 11 Jan 2001 11:21:28 -0000
From: "Rob Parkes" <robert.parkes@dpp.co.uk>
Subject: Contract Opportunity, Frankfurt 1700dm per day or £500 per day.
Message-Id: <wJg76.11$5V3.25239@newsr1.u-net.net>
I'm in need of a Perl, Shell scripting and Unix programmer/developer to work
for a massive investment bank
in Frankfurt, on a derivatives trading system project. There will be a
chance to learn new skills.
If Interested please send me a Email.
Robert Parkes
robert.parkes@dpp.co.uk
------------------------------
Date: Thu, 11 Jan 2001 22:06:57 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: counting lines in a file
Message-Id: <slrn95r4uh.111.mgjv@martien.heliotrope.home>
On Wed, 10 Jan 2001 22:19:28 GMT,
John Galt <ssomneb@my-deja.com> wrote:
>>
>> > open FILENAME, $file or die "Cannot open $file for read: $!";
>>
>> The file name is in "$file" and the file handle is in "FILENAME"?
>
> Why not? Are you trying to say that they should be the same name, like
> $file and "FILE"?
I think the idea was to point out that FILENAME is actually a file
handle, and not a file name. It is generally good advice to choose
meaningful variable name. Even FILE is probably too general. if the file
is a file with data about solar flare incidences, maybe you should name
the variables $solar_file and SOLAR_FILE (or just SOLAR). But the main
thing is to not call things names that they aren't :)
>> > $count=0 #so that it will return "0" if there are no
>> > #relevant lines
>>
>> my $count = 0;
>
> I know that the "my" part makes it a local variable, but what's the
> consequence if you don't use it? Does making it a local variable
> confine it to just the subroutine, or the program, or what? I've done
> a bit of research about this one after your comment, but I haven't
> been able to figure that out.
It isn't really a 'local' variable. In Perl that's a different thing
(although it really is a local _value_ for the same variable). The
entries in the documentation for local and my explain what the
difference is, and the FAQ, section 7, has an entry with the title:
"What's the difference between dynamic and lexical (static) scoping?
Between local() and my()?" If you can't use man:
$ perldoc -f my
$ perldoc -f local
$ perldoc perlfaq7
>> > for ( <FILENAME> ) {
>>
>> You probably meant 'while ( <FILENAME> ) {'
>>
>> > chomp;
>> > if ($_) {
>>
> Why? Won't it have the same result?
Yes, and no. They will do the same thing, seen from the outside.
However, for() will build a list first, and iterate over each element
after it has built the list, while the while() loop with the diamond
operator will iterate over each line of the file separately, reading
them while going. This may not mean much for smal files, but check the
difference with a file of 100 MB or more.
while(<HANDLE>) was designed to be used for this, and should be used.
for() was designed to loop over arrays (or lists) in memory.
>> What it the line has the digit 0 on a line by itself or only contains
>> whitespace?
That is ok. "0\n" is not a false value in Perl, and neither is "\n".
Don't forget that each line still has a newline.
Check this out:
$ cat foo.pl
#!/usr/local/bin/perl -wT
print while(<DATA>);
__DATA__
0
foo
$ ./foo.pl
0
foo
$
Works the same on external files.
Martien
--
Martien Verbruggen |
Interactive Media Division | Can't say that it is, 'cause it
Commercial Dynamics Pty. Ltd. | ain't.
NSW, Australia |
------------------------------
Date: 11 Jan 2001 09:00:49 GMT
From: The WebDragon <nospam@nospam.com>
Subject: DBI and migrating a 'flat-file' script to use DBI
Message-Id: <93jso1$doi$0@216.155.33.72>
I have an existing Perl/CGI script and migrating it to DBI is proving a
task that while worth the effort in many many ways (including educating
mysefl further and just plain having fun), raises a number of questions
for me as to how to do similar things to what I'm doing at present.
To preface:
The Perl/CGI code currently reads in a list of info from a tab-separated
flat-file consisting of
$gametype, $filename, $title, $size, $review, $rating
this is read into a HOHOL of the form
$maplist{$gametype}{$coercename} = [$filename, $title, $size, $review,
$rating]
where $coercename is created on the fly during this segment
-=-
# coerce the rating value to a special format to aid in a sort transform
sub coerce2 { sprintf '%04.1f', int(shift()*2+.5)/2 }
#@data is slurped in from the flat-file earlier, although I could do
this just as easily in a while(<>) {#loop;}
foreach (@data) {
my($gametype, $filename, $title, $size, $review, $rating) = split
/\t/;
++$totalcount;
if ($rating == '-1') {++$unratedcount} else {++$ratedcount};
$filename =~ /(.*?).zip/o;
($title = $1) =~ tr/A-Z/a-z/;
(my $coercename = $filename) =~ tr/A-Z/a-z/;
# uses %replace hash here: *
$coercename =~ s/([a-z0-9])/$replace{$1}/g;
# * basically this does
# $coercename =~
tr/abcdefghijklmnopqrstuvwxyz0123456789/zyxwvutsrqponmlkjihgfedcba9876543
210/;
# but in a much neater fashion and without a major processor time
hit.
# thanks to Bart Lateur for the tip.
# by making the sort keys *both* use $coercename, I can use the same
sort down below and have it still work. :-)
# This has the added benefit of forcing mapnames that begin with
numerics and []-type characters to be sorted to the bottom in either
case.
# Serves the lamers right for trying to force their maps to the top
of the list.
if (param() && (param('sortby') eq 'rating') ) {
$master_maps_list{$gametype}{ &coerce2($rating) . $coercename }
= [$filename, $title, $size, $review, $rating];
} else {
$master_maps_list{$gametype}{ $coercename } = [$filename,
$title, $size, $review, $rating];
}
}
-=-
I also do some calculation of values of this HOHOL to produce things like
o Complete total # of maps not limited to $gametype
o number of maps in $gametype
o Total Rated/Unrated
if the user chooses to view rated-only or unrated-only, it's a simple
match on whether rating < 0 (in which case it's unrated.. -1) and the
script produces a count of how many you are currently viewing out of the
total # for that game type
i.e. 12/68 (you are seeing 12 maps out of 68 total for "utassault"
...
OK, now that I've prefaced this with some info and code, the real
question comes up:
I would very much like to duplicate this sort of thing using various SQL
statements. It isn't necessary to sort particulars until final output,
so buffer/cache space won't be too badly affected. However as near as I
can figure the only way to do this is to either generate multiple calls
to the SQL server for each single viewing, OR read the whole thing into
the hash table like I'm already doing (very RAM hungry) .. get the
values and delete/undefine what I don't need as soon as possible to free
up the RAM.
the biggest question I have is how to get the DBI to give me a count of
the returned rows from the executed statement handle for which I have no
desire to actually fetch any rows for before finishing it and moving
onwards.
things like
#to get a total count of all maps in the DB
$sth->prepare(" SELECT * FROM mapslist");
$sth->execute();
$totalcount = $sth->what?
$sth->finish();# necessary if I'm going to prepare a new $sth?
and also
#get a total count of rated maps only
$sth->prepare("SELECT * FROM mapslist WHERE rating >= 0");
$sth->execute();
... and similar cruft.
it almost seems like reading the whole thing into a hash makes more
sense if I want these things, however that could get ugly too.
I suppose I could shorten things a bit with a handle like
#get a MUCH smaller amount of info and take up less ram
$sth->prepare("SELECT gametype, filename, rating FROM mapslist");
$sth->execute();
# bind columns, and then,
# turn it into a arrayref/hashref and start counting...
foreach ($sth->fetchrow()) {
$hash{$gametype}{$filename} = $rating;
}
...
I notice there is a NUM_OF_FIELDS attribute returned by the statement
handle, but apparently no NUM_OF_ROWS (which would make returning a
quick count MUCH simpler and use far less RAM, but a bit more
server-time and CPU for multiple queries before I move on to the ACTUAL
SELECT I want to do to procure the final output and format it for html)
unless I'm missing something somewhere in the docs.
Suggestions? complications I should be aware of? possible alternate
approaches I haven't considered because I'm too new to DBI?
§
{
ASIDE: {
I trust that THIS TIME I've made enough clear reasoning in advance to
warrant some intelligent response, and that this isn't just deserving of
a FAQ or read the .pod docs' response. Hell, I have the pods and the
BOOK and still dunno, mostly because this is more of a 'usage' question
than anything else, AFAICT. I admit I've goofed in the past and I've
done my share of mea culpas in private rather than clutter up the
bandwidth any further with them. Hopefully I've done enough initial
homework on this one. it's 3:30AM and I'm outta wits and almost outta
coffee and cigs. mea culpa. :)
}
ASIDE2:{
If this simple honest admission inspires you to killfile me or lower my
rating, then I'll ask you to re-read ASIDE: with the understanding that
it's a simple honest admission and late-night-getting-punchy attempt at
humor. not 100% funny, per-se, but I'm too tired to give a fig. (:
}
}
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Thu, 11 Jan 2001 11:12:23 +0000
From: John Jones <johnj@pathfind.demon.co.uk>
Subject: Re: DBI and migrating a 'flat-file' script to use DBI
Message-Id: <+fYAMKAXUZX6Ew+S@pathfind.demon.co.uk>
In article <93jso1$doi$0@216.155.33.72>, The WebDragon
<nospam@nospam.com> writes
>the biggest question I have is how to get the DBI to give me a count of
>the returned rows from the executed statement handle for which I have no
>desire to actually fetch any rows for before finishing it and moving
>onwards.
I'm not sure if this helps...
>
"$rv = $sth->rows Returns the number of rows affected by the last row-
effecting command, or -1 if the number of rows is not known or not
available"
However, rows is only accurate after completing all the fetches from a
select or after a non-select operation. A recommended alternative
technique is to use SELECT COUNT (*) FROM <more sql> where the <more
sql> bit is the same as your query, and then use rows to get the row
count.
------------------------------------------------------------------
| John Jones Tel: +44 (0)161 406 7399 Fax:+44 (0)161 406 7410 |
| For Y2000 and Software Compliance Audit Tools |
| Visit The Barefoot Auditor at http://www.TheBarefootAuditor.com |
------------------------------------------------------------------
------------------------------
Date: Thu, 11 Jan 2001 10:45:40 GMT
From: hedley_s@my-deja.com
Subject: File::Find - how to follow links
Message-Id: <93k2sj$ob2$1@nnrp1.deja.com>
Hi,
Given the following bit of code:
___________________________________________
use File::Find ;
sub process {
/^.*\.ksh$/ && ! -d
print $File::Find::name . "\n"
}
find(\&process, '/mydir') ;
___________________________________________
How do I get this to follow links? I've tried using the notation
on the man page but couldn't get it to work.
thanks
Hedley
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 11 Jan 2001 11:06:08 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: File::Find - how to follow links
Message-Id: <slrn95r4tc.qsg.rgarciasuarez@rafael.kazibao.net>
hedley_s@my-deja.com wrote in comp.lang.perl.misc:
>
> Given the following bit of code:
> ___________________________________________
> use File::Find ;
> sub process {
> /^.*\.ksh$/ && ! -d
> print $File::Find::name . "\n"
> }
> find(\&process, '/mydir') ;
> ___________________________________________
>
>
> How do I get this to follow links? I've tried using the notation
> on the man page but couldn't get it to work.
The answer, in plain Perl code, will be given by the find2perl tool
(included with Perl):
find2perl -follow
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Thu, 11 Jan 2001 22:16:24 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: File::Find - how to follow links
Message-Id: <slrn95r5g8.111.mgjv@martien.heliotrope.home>
On Thu, 11 Jan 2001 10:45:40 GMT,
hedley_s@my-deja.com <hedley_s@my-deja.com> wrote:
> Hi,
>
> Given the following bit of code:
> ___________________________________________
> use File::Find ;
> sub process {
> /^.*\.ksh$/ && ! -d
> print $File::Find::name . "\n"
> }
> find(\&process, '/mydir') ;
> ___________________________________________
>
>
> How do I get this to follow links? I've tried using the notation
find({wanted => \&process, follow => 1}, '/mydir');
> on the man page but couldn't get it to work.
Why didn't you show us the code that contained 'the notation' from the
man page? The above is what the man page says, and it works perfectly
fine for me.
What is your code? What is the directory layout, and what exactly
happens?
Martien
--
Martien Verbruggen |
Interactive Media Division | Useful Statistic: 75% of the people
Commercial Dynamics Pty. Ltd. | make up 3/4 of the population.
NSW, Australia |
------------------------------
Date: Thu, 11 Jan 2001 12:16:54 GMT
From: hedley_s@my-deja.com
Subject: Re: File::Find - how to follow links
Message-Id: <93k87i$s6g$1@nnrp1.deja.com>
In article <slrn95r5g8.111.mgjv@martien.heliotrope.home>,
mgjv@tradingpost.com.au wrote:
> On Thu, 11 Jan 2001 10:45:40 GMT,
> hedley_s@my-deja.com <hedley_s@my-deja.com> wrote:
> > Hi,
> >
> > Given the following bit of code:
> > ___________________________________________
> > use File::Find ;
> > sub process {
> > /^.*\.ksh$/ && ! -d
> > print $File::Find::name . "\n"
> > }
> > find(\&process, '/mydir') ;
> > ___________________________________________
> >
> >
> > How do I get this to follow links? I've tried using the notation
>
> find({wanted => \&process, follow => 1}, '/mydir');
>
> > on the man page but couldn't get it to work.
>
> Why didn't you show us the code that contained 'the notation' from the
> man page? The above is what the man page says, and it works perfectly
> fine for me.
>
> What is your code? What is the directory layout, and what exactly
> happens?
Using the code that worked for you I get the message:
Not a CODE reference at /opt/perl-5.004/lib/File/Find.pm line 87
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 11 Jan 2001 12:27:58 GMT
From: hedley_s@my-deja.com
Subject: Re: File::Find - how to follow links
Message-Id: <93k8s9$sku$1@nnrp1.deja.com>
In article <slrn95r4tc.qsg.rgarciasuarez@rafael.kazibao.net>,
rgarciasuarez@free.fr (Rafael Garcia-Suarez) wrote:
> hedley_s@my-deja.com wrote in comp.lang.perl.misc:
> >
> > Given the following bit of code:
> > ___________________________________________
> > use File::Find ;
> > sub process {
> > /^.*\.ksh$/ && ! -d
> > print $File::Find::name . "\n"
> > }
> > find(\&process, '/mydir') ;
> > ___________________________________________
> >
> >
> > How do I get this to follow links? I've tried using the notation
> > on the man page but couldn't get it to work.
>
> The answer, in plain Perl code, will be given by the find2perl tool
> (included with Perl):
>
> find2perl -follow
>
> --
> # Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
>
Seems to work now, before I was using perl5.004 and now I'm using 5.6.0
it seems to be ok.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 11 Jan 2001 12:47:34 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: File::Find - how to follow links
Message-Id: <slrn95rarj.rf7.rgarciasuarez@rafael.kazibao.net>
hedley_s@my-deja.com wrote in comp.lang.perl.misc:
> In article <slrn95r4tc.qsg.rgarciasuarez@rafael.kazibao.net>,
> rgarciasuarez@free.fr (Rafael Garcia-Suarez) wrote:
> > hedley_s@my-deja.com wrote in comp.lang.perl.misc:
> > >
> > > Given the following bit of code:
> > > ___________________________________________
> > > use File::Find ;
> > > sub process {
> > > /^.*\.ksh$/ && ! -d
> > > print $File::Find::name . "\n"
> > > }
> > > find(\&process, '/mydir') ;
> > > ___________________________________________
> > >
> > >
> > > How do I get this to follow links? I've tried using the notation
> > > on the man page but couldn't get it to work.
> >
> > The answer, in plain Perl code, will be given by the find2perl tool
> > (included with Perl):
> >
> > find2perl -follow
>
> Seems to work now, before I was using perl5.004 and now I'm using 5.6.0
> it seems to be ok.
Yes, there was improvements in Perl 5.6.0.
Output of 'find2perl -follow' for Perl 5.6.0 :
#! /usr/local/bin/perl -w
eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}'
if 0; #$running_under_some_shell
use strict;
use File::Find ();
# Set the variable $File::Find::dont_use_nlink if you're using AFS,
# since AFS cheats.
# for the convenience of &wanted calls, including -eval statements:
use vars qw/*name *dir *prune/;
*name = *File::Find::name;
*dir = *File::Find::dir;
*prune = *File::Find::prune;
# Traverse desired filesystems
File::Find::find( {wanted => \&wanted, follow => 1}, '.');
exit;
sub wanted {
;
}
Output of 'find2perl -follow' for Perl 5.005_03 :
#!/usr/bin/perl
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
if $running_under_some_shell;
require "find.pl";
# Traverse desired filesystems
%already_seen = ();
&find('.');
exit;
sub wanted {
(($dev,$ino,$mode,$nlink,$uid,$gid) = stat($_)) &&
(not $already_seen{"$dev,$ino"}) &&
(($already_seen{"$dev,$ino"} = !(-d _)) || 1);
}
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Thu, 11 Jan 2001 12:35:36 GMT
From: Razib <raldanash@my-deja.com>
Subject: FORM generates wrong .cgi address?
Message-Id: <93k9ao$t23$1@nnrp1.deja.com>
i'm doing a form that generates search results from a .db file and
prints the output into a pop-up window.
recently, i've been trying to insert some JAVAscript up at the top to
manipulate the pop-up window, and every now and then when i hit
the "submit" button on the drop-down selections to execute my search
script it acts as if my xitami server isn't up and the "file download"
icon pops up and repeats over and over.
instead of:
127.0.0.1/cgi-bin/search.cgi
the location is:
C:\Xitami\cgin-bin\search.cgi
now, this isn't a constant problem, and i'll at least get around in the
short term by including the whole local host address...but i'd like to
know what's going on!
the problem isn't in the CGIs, as long as i type in the address right
in the location bar they work, the problem is with the fucked up
address that i showed above.
anyone know why that's happening?
thanks ahead of time
-razib
--
________________________________
Razib Khan
http://geocities.com/raldanash/alternatehistory
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 11 Jan 2001 13:09:21 +0000
From: Paul Boardman <peb@bms.umist.ac.uk>
Subject: Re: FORM generates wrong .cgi address?
Message-Id: <3A5DB081.17440F48@bms.umist.ac.uk>
Razib wrote:
>
> i'm doing a form that generates search results from a .db file and
> prints the output into a pop-up window.
>
> recently, i've been trying to insert some JAVAscript up at the top to
> manipulate the pop-up window, and every now and then when i hit
> the "submit" button on the drop-down selections to execute my search
> script it acts as if my xitami server isn't up and the "file download"
> icon pops up and repeats over and over.
> instead of:
> 127.0.0.1/cgi-bin/search.cgi
> the location is:
> C:\Xitami\cgin-bin\search.cgi
this really doesn't sound like something you should be posting to a perl
forum. Why not try a javascript forum or the cgi forum instead?
Paul
------------------------------
Date: Thu, 11 Jan 2001 11:06:43 GMT
From: jbuff <jbuff1856@my-deja.com>
Subject: Re: How do I convert %40 to '@' ?
Message-Id: <93k440$p7h$1@nnrp1.deja.com>
In article <vUb76.84$QS5.14361@nsw.nnrp.telstra.net>,
"Merlin" <robert@chalmers.com.au> wrote:
> Thanks all, it does work.
> I thought there must be some way of escaping (unescaping?) the data
that
> comes in from the web page form though, rather than having to convert
each
> item.
>
> Doesn't really matter here though, as ther is onnly the one item.
>
perldoc URI::Escape
--jbuff
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 11 Jan 2001 17:05:48 +0800
From: "james roads" <zhenghua_li@nj.trendmicro.com>
Subject: how to use HTML::Parser
Message-Id: <93jt12$1gqv$1@news.cz.js.cn>
can you tell me about how to use the modules HTML::Parser?
the example:
use HTML::Parser;
$p = HTML::Parser->new;
$p->parse_file("foo.html");
but
"In order to make the parser do anything interesting, you must make a
subclass where you override one or more of the following methods as
appropriate:
$self->start($tag, $attr, $attrseq, $origtext)
"
and now I don't know how to define the "subclass" to get the result of file
parsing.
can anyone help me, thank you very much.
------------------------------
Date: Thu, 11 Jan 2001 10:14:46 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: how to use HTML::Parser
Message-Id: <3g1r5torer65qq9u2jjjrctlulf629nh4k@4ax.com>
james roads wrote:
>"In order to make the parser do anything interesting, you must make a
>subclass where you override one or more of the following methods as
>appropriate:
>
>$self->start($tag, $attr, $attrseq, $origtext)
>"
>
>and now I don't know how to define the "subclass" to get the result of file
>parsing.
First of all, if you're new to this, perhaps first you should check out
HTML::TokeParser. That is a no-OOP variation on HTML::Parser, but
doesnt' require subclassing. All you need to do is "get the next token"
from the HTML stream (file), which can be an opening tag, aclosing tag,
a part of plain text, or a comment. (Er... there could be one more, a
processing instruction.) It's just like reading lines from a text file.
Now, back to your original question: You make a new package, in it,
require (or use) HTML::Parser, put 'HTML::Parser', the string, in @ISA,
and then simply define the subs for your standard methods, and maybe
some more of your own.
For an example, open the source of HTML::LinkExtor.
--
Bart.
------------------------------
Date: Thu, 11 Jan 2001 10:55:36 GMT
From: jbuff <jbuff1856@my-deja.com>
Subject: Re: how to use HTML::Parser
Message-Id: <93k3f6$oou$1@nnrp1.deja.com>
In article <93jt12$1gqv$1@news.cz.js.cn>,
"james roads" <zhenghua_li@nj.trendmicro.com> wrote:
> can you tell me about how to use the modules HTML::Parser?
>
> the example:
>
> use HTML::Parser;
> $p = HTML::Parser->new;
> $p->parse_file("foo.html");
>
> but
> "In order to make the parser do anything interesting, you must make a
> subclass where you override one or more of the following methods as
> appropriate:
>
> $self->start($tag, $attr, $attrseq, $origtext)
> "
>
> and now I don't know how to define the "subclass" to get the result
of file
> parsing.
>
> can anyone help me, thank you very much.
>
>
I was in the middle of composing a fairly detailed response to your
question when W98 froze up on me. Not an unusual occurance, but
annoying.
By the time I had rebooted, Bart had come back with bottom line answer
that I will endorse. Check out HTML::TokeParser. It will do the same
thing, but in a metaphor easier for you to understand.
Once you've mastered HTML::TokeParser, understanding how HTML::Parser
works will be much easier.
--jbuff
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 11 Jan 2001 13:35:22 -0000
From: "Stephen Collyer" <stephen@twocats.dont-spam.demon.co.uk>
Subject: left op of && and || only in scalar context ?
Message-Id: <979220248.17055.0.nnrp-10.9e98901a@news.demon.co.uk>
In an expression like:
EXPR1 || EXPR2
or:
EXPR1 && EXPR2
EXPR1 only is evaluated in scalar context.
It's not clear to me why EXPR2 isn't evaluated in
scalar context too - anyone know why ?
Steve Collyer
------------------------------
Date: 11 Jan 2001 13:53:24 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: left op of && and || only in scalar context ?
Message-Id: <93kdsk$jb3$1@mamenchi.zrz.TU-Berlin.DE>
Stephen Collyer <stephen@twocats.dont-spam.demon.co.uk> wrote in comp.lang.perl.misc:
>In an expression like:
>
>EXPR1 || EXPR2
>
>or:
>
>EXPR1 && EXPR2
>
>EXPR1 only is evaluated in scalar context.
>It's not clear to me why EXPR2 isn't evaluated in
>scalar context too - anyone know why ?
What makes you think EXPR2 isn't in scalar context?
Watch this:
sub tell_context {
print wantarray ? "list\n" : "scalar\n";
0; # change to 1 if testing with &&
}
tell_context() || tell_context();
This prints "scalar" twice, so both operands are in scalar context.
More precisely, the expressions are called in boolean context, which
is a special case of scalar context.
Anno
------------------------------
Date: Thu, 11 Jan 2001 13:59:47 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: left op of && and || only in scalar context ?
Message-Id: <l1fr5tga6ngir349v4vf6v7fn23fq65136@4ax.com>
Stephen Collyer wrote:
>In an expression like:
>
>EXPR1 || EXPR2
>
>or:
>
>EXPR1 && EXPR2
>
>EXPR1 only is evaluated in scalar context.
>It's not clear to me why EXPR2 isn't evaluated in
>scalar context too - anyone know why ?
@a = 0 || localtime;
print "@a\n";
-->
10 59 14 11 0 101 4 10 0
Eek! You're right. This doesn't make any sense.
Besides:
@a ||= localtime;
won't compile.
--
Bart.
------------------------------
Date: Thu, 11 Jan 2001 08:33:34 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Licensing a program written perl?
Message-Id: <3a5d6fdd.2508$2a1@news.op.net>
In article <93ilu1$jee$1@nnrp1.deja.com>, <bababozorg@aol.com> wrote:
>if your advice is SO commercial... that you bother sharing
>your experiences to people..
It appears that you are saying that because gungeek has shared his
advice with people for free, his advice is therefore excessively
commercial. I'm tempted to ask you to explain how that can be, but I
don't think I would understand the explanation.
This is an example of a common rhetorical pattern, in which the
writer, criticized on some grounds or other, accuses his accuser of
doing the same thing he is accused of himself. People usually carry
this off a little more cleverly than you have, and come up with a
counter-accusation that is confusing enough to make the readers
wonder. (A common example is "X accuses Y of bigotry, but in doing so
he is guilty of bigotry against bigots.") Your use of this technique
is unusually obtuse.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Thu, 11 Jan 2001 11:14:25 GMT
From: jbuff <jbuff1856@my-deja.com>
Subject: Re: Licensing a program written perl?
Message-Id: <93k4id$piv$1@nnrp1.deja.com>
In article <93ie16$brj$1@nnrp1.deja.com>,
bababozorg@aol.com wrote:
> Hi
>
> I was wondering if there is a way to actually implement licencing in a
> perl program... what i mean is simply... if a customer buys this
> program written in perl, under one user license... is there anyway to
> stop him if he gives a copy of the program to his friend to use or
> something?
>
> i was thinking to insert an image like 1x1 pixle in the admin page of
> the program... somewhere hidden, so that would send a request to a
> program in our server... so users can be traced down... BUT thats not
> such a good idea since the code can always be removed...
>
> do u guys have any ideas to implement this under perl? have you came
> across a same problem before? or...
>
>
Give the program away. Sell the support.
--jbuff
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 11 Jan 2001 12:52:57 GMT
From: usad1@gadnet.com (G.A.D.Miles)
Subject: Maybe more of a unix question. Translating file names
Message-Id: <3a5da0d6.57662247@news.newsguy.com>
I am trying to write a little web traffic tracker in Perl. The way it
works at the moment the script takes the host name and the document
name / path and sticks them together with a bit of dummy text in
between. Then it changes all /s to .s to create a file name. Like
this:
Host name: www.domain.com
File path: /personal/me.html
End result: www.domain.comDUMMYTEXT.personal.me.html
Later on, when it needs to convert all that back into a URL, it strips
out the dummy text leaving everything before it untouched. Then it
converts all the .s except the last one to /s giving:
www.domain.com/personal/me.html
It's a little bit moer complicated than that to take care of the cases
such as:
www.domain.com/personal
where no page name is specified.
I feel there must be a MUCH easier way of doing this, and if you could
all stop laughing for a moment, maybe you could point me in the right
direction.
One current problem with my approach is that it can't cope with
directory name which contain .s. Eg:
www.domain.com/personal.pages/me.html
This would end up as
www.domain.com/personal/pages/me.html
Any ideas? Ideally I would like it to work on any platform including
NT, although I am testing it on unix FreeBSD.
------------------------------
Date: Thu, 11 Jan 2001 09:47:09 +0100
From: Lex Hagen <l.hagen@HumanInference.com>
Subject: net::telnet difficulty accessing an existing directory...
Message-Id: <04932F2B7E20D211856C00A0C9A060952CFAF1@HIS03>
Hi everyone,
Does anyone know why i'm having trouble getting to a specific
directory on a Sun UNIX-machine, even though the directory does
exist. (I'm using the Net::Telnet module)
Is anyone experienced in using this module?
Thanks in advance, Lex
code:
#! Perl -w
use strict;
use Net::Telnet ();
my ($t, @lines);
my ($rem_host, $username, $passwd);
$t = new Net::Telnet (Timeout => 10, Prompt => '/[?\$] $/');
$rem_host = "sun251";
$username = "XXXX"; # correct
$passwd = "XXXX"; # correct
$t->open($rem_host);
$t->login($username, $passwd);
@lines = $t->cmd("cd IRNameIT"); # Can't access this directory
print @lines;
@lines = $t->cmd("mkdir Elizarova");
print @lines;
@lines = $t->cmd("cd Elizarova");
print @lines;
(...)
------------------------------
Date: Thu, 11 Jan 2001 11:53:34 GMT
From: pjd <pjdurai@my-deja.com>
Subject: Re: Perl & MS Exchange
Message-Id: <93k6rt$r1f$1@nnrp1.deja.com>
You are on the right track.
CDO too is an OLE automation server. So you dont need any special perl
modules to access exchange with CDO other than Win32::OLE.
You need to find out the CDO typelib info before you can use it. I
guess you can do it from MSDN site.
Here is a VB code to do something trivial. Shouldnt be too hard to
figure out Perl equivalent.
Function QuickStart()
Dim objSession As MAPI.Session ' use early binding for more efficient
Dim objMessage As Message ' code and type checking
Dim objOneRecip As Recipient
On Error GoTo error_olemsg
' create a session and log on -- username and password in profile
Set objSession = CreateObject("MAPI.Session")
' change the parameters to valid values for your configuration
objSession.Logon profileName:="Sender Name"
' create a message and fill in its properties
Set objMessage = objSession.Outbox.Messages.Add
objMessage.Subject = "Sample Message"
objMessage.Text = "This is sample message text."
' create the recipient
Set objOneRecip = objMessage.Recipients.Add
objOneRecip.Name = "Recipient Name"
objOneRecip.Type = CdoTo
objOneRecip.Resolve ' get MAPI to determine complete e-mail address
' send the message and log off
objMessage.Send showDialog:=False
MsgBox "The message has been sent"
objSession.Logoff
Exit Function
error_olemsg:
MsgBox "Error " & Str(Err) & ": " & Error$(Err)
Exit Function
End Function
Hope that helps.
cheers
pj
In article <rIc76.39$F75.1835092@news.xtra.co.nz>,
"Simon Taylor" <simon.taylor@tegel.co.nz> wrote:
> Has anyone had any luck writing a perl script to create new items in
a MS
> Exchange public folder? I've tried using Win32::OLE to automate
Outlook but
> the new items end up in my personal folders(!) I've read where
> Collaboration Data Objects (CDO) are recommended for this type of
thing, but
> I can't find any Perl CDO modules or anything on this topic.
>
> Any clues?
>
> Thanks in advance.
>
> Simon.
>
>
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 11 Jan 2001 08:38:28 +0000
From: nobull@mail.com
Subject: Re: Problem... Src included...
Message-Id: <u94rz6l96m.fsf@wcl-l.bham.ac.uk>
cputek1@my-deja.com writes:
> I keep getting the error Can't stat Foo/Bar: No such file or directory.
>
> I don't see what is wrong with it. the line that I think is the
> problem is line # 11 (find (\&Extention_Check,"Foo/Bar");)
Your &Extention_Check contains a chdir(). File::Find::find assumes that
the callback function will not a change the CWD.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 11 Jan 2001 10:19:15 +0100
From: "claudio militello" <claudio.militello@infos.es>
Subject: RE: problems perl odbc SQL-Server 7.0: no records with tinyint
Message-Id: <93jtsg$k23$1@lola.ctv.es>
Jeff Helman <jhelman@wsb.com> escribió en el mensaje de noticias
qe9q5tgvi97ithr1516nt31rjluhc7psn1@4ax.com...
> On Wed, 10 Jan 2001 16:25:17 +0100, "claudio militello"
> <claudio.militello@infos.es> wrote:
>
> >Jeff Helman <jhelman@wsb.com> escribió en el mensaje de noticias
> >> if ($SGC->Sql($sql)) {
> >> my $error = $SGC->Error();
> >> print "Error executing query: $error\n";
> >> } else {
> >> ## PARSE YOUR DATA HERE
> >> }
> >>
> >> Change both of your queries to this format and see if your second
> >> query is returning an error.
> >>
> >> JH
> >
> >I changed the code to check for error: no error returns from the Sql call
>
> Okay, next question: Are you sure the loop is executing? Do something
> like this:
>
> # At top of script kill output buffering
> $| = 1;
>
> # Replace your while() loop that reads through the records as follows:
>
> while($SGC->FetchRow()) {
> print "Reading a row now\n";
> %telefonosHash = $SGC->DataHash;
> $teId = sakaIntFromOdbc($telefonosHash{"TE_ID"});
> print "tel: $teId \n";
> }
>
> By doing this, you'll know if the loop is executing. If it is, then
> the problem is with your sakaIntFromOdbc() function. If it isn't,
> then you have a SQL problem that is beyond the realm of this
> newsgroup.
>
> Incidentally, you haven't posted the code from the sakaIntFromOdbc
> function. That may be where your problem is. Code?
>
> JH
Hi Jeff, thank for your help. I modified the code as follows:
use Win32::ODBC;
$DSN = "DSN=SGC;UID=claudio;PWD=claudio";
$|=1;
$SGC = new Win32::ODBC($DSN);
if ($SGC) {
print "Conexion SGC OK.\n";
} else {
print " ERROR Abertura conexion: $DSN\n";
exit;
}
$sql = "SELECT TE_ID,TE_CMIN from TELEFONOS";
if ($SGC->Sql($sql)) {
my $error = $SGC->Error();
print "Error executing query: $error\n";
} else {
if ($SGC->FetchRow()) {
%telefonosHash = $SGC->DataHash;
print $telefonosHash{"TE_ID"};
print "\n";
} else {
($ErrNum, $ErrText, $ErrConn) = $SGC->Error();
print "Error: $ErrNum - $ErrText \n";
}
}
print "fin\n";
$SGC->Close();
As you can see I have changed the While with an If and now I get an error
code:
this is the output I get:
Conexion SGC OK.
Error: 911 - [Microsoft][ODBC SQL Server Driver]Datos tipo String, se
truncaron por la derecha
fin
The error in english is something like:
911 - [Microsoft][ODBC SQL Server Driver]String data types truncated at
the right
It make no sense to me !!!
I'm sure there is data in the table...
TE_ID is an int field
C_MIN is a tinyint field
Here the output of select TE_ID, TE_CMIN from TELEFONOS executed directly on
SQL-Server console:
te_id te_cmin
----------- -------
1000 25
1001 25
1002 25
1003 25
1004 25
1005 25
1006 25
1007 25
1008 25
1009 25
So, I'm sure there is an error in the win32::ODBC perl module
(could be a misconfiguration of the ODBC Driver, but I can get the same data
via ODBC with Visual Basic and C++, I can´t with Perl :-( )
Last comment:
if I change TE_CMIN field type from tinyint to int all get right...but I
can't do this, I have a lot of C++, Visual basic and perl code developed
with this DataBase...
------------------------------
Date: Thu, 11 Jan 2001 11:17:33 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: RegEx question
Message-Id: <3a5d960b.164873315@news.itn.is>
On Wed, 10 Jan 2001 16:26:21 GMT, ericr@yankthechain.com
wrote:
>How would I make a RegExp to eliminate all space on either side of
>letters in a string, but preserve any spaces within (ie turn " Blah
>blah " into "Blah blah")?
>
>
perldoc -q "How do I strip blank space from the
beginning/end of a string?"
Regards,
Helgi Briem
------------------------------
Date: Thu, 11 Jan 2001 10:00:41 -0800
From: "Jerry" <jeremy.hutchings@cw.com>
Subject: Security
Message-Id: <dwf76.2270$eA2.14756@news1-hme0>
Hello everyone,
I'm trying to understand how to secure a server on which there are many
users. I understand that being able to link static binaries is a bad thing
and need to know how we can stop this.
"We must prevent users from calling their own binaries from a perl script
executed by the web server as a .pl CGI script. This is necessary to prevent
the use of statically linked binaries, that will circumvent disk quota
control and networking restrictions that prevent hacking, sniffing and
general buggering around."
I've been through ;
http://www.perl.com/pub/doc/FAQs/cgi/www-security-faq.html
but cant seem to find any thing on it.
Thanks,
Jerry.
------------------------------
Date: Thu, 11 Jan 2001 10:24:27 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Security
Message-Id: <slrn95r2f7.qer.rgarciasuarez@rafael.kazibao.net>
Jerry wrote in comp.lang.perl.misc:
>
> "We must prevent users from calling their own binaries from a perl script
> executed by the web server as a .pl CGI script. This is necessary to prevent
> the use of statically linked binaries, that will circumvent disk quota
> control and networking restrictions that prevent hacking, sniffing and
> general buggering around."
Your question is not related to perl. It applies also to CGI programs
written in another scripting language (e.g. shell), or to CGI programs
that are themselves binaries. You should post in a security newsgroup
for your OS.
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: 11 Jan 2001 09:52:19 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: socket send to client problem
Message-Id: <93jvoj$4i9$1@mamenchi.zrz.TU-Berlin.DE>
Anthony Carbone <anthonyc@mincom.com> wrote in comp.lang.perl.misc:
>I have a problem when I use a socket as a two way pipe. Using IO::Socket, I
[snip]
>However, if the client disappears before I get a chance to write back, the
>server program crashes out - Nasty. I've been trying to find a method that
>will test the client handle to see if it is still a valid connection before
>I do the write, but to no avail.
>
>I've tried methods/functions within IO::Socket, IO::Handle, socket etc. The
>closest I got was actually with function 'eof HANDLE', which fails if the
>client handle is not vaild but BLOCKS if it is thus hanging the server
>script.
Have you tried to check with select() (four-argument form)? It should
tell you if a handle is ready to accept data.
Anno
------------------------------
Date: Thu, 11 Jan 2001 13:28:31 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: socket send to client problem
Message-Id: <3yi76.23$vB3.1070@eagle.america.net>
On 11 Jan 2001 09:52:19 GMT, Anno Siegel
<anno4000@lublin.zrz.tu-berlin.de> wrote:
>Anthony Carbone <anthonyc@mincom.com> wrote in comp.lang.perl.misc:
>>I have a problem when I use a socket as a two way pipe. Using IO::Socket, I
>
>[snip]
>
>>However, if the client disappears before I get a chance to write back, the
>>server program crashes out - Nasty. I've been trying to find a method that
>>will test the client handle to see if it is still a valid connection before
>>I do the write, but to no avail.
>>
>>I've tried methods/functions within IO::Socket, IO::Handle, socket etc. The
>>closest I got was actually with function 'eof HANDLE', which fails if the
>>client handle is not vaild but BLOCKS if it is thus hanging the server
>>script.
>
>Have you tried to check with select() (four-argument form)? It should
>tell you if a handle is ready to accept data.
Won't help.
As Uri has pointed out before in this group, the socket is available
only by finding out if it can be *read*. Besides, even a reliable
check will lead to a race condition. Bad design. An easy fix would
be to handle the "program crashes out" condition -- whatever that
means. Or maybe the OP should just fork.
--
Garry Williams
------------------------------
Date: Thu, 11 Jan 2001 09:06:01 GMT
From: "Waarddebon" <Waarddebon@chello.nl>
Subject: Strange ?
Message-Id: <ZHe76.578134$%C1.7108476@Flipper>
I put several values of variables into 1 variable but with the variables
seperated bij commas
thus:
$a="hello";
$b="1900";
$c="2000";
$d="8:00";
I do that with this line:
$all= join ("," , $a , $b , $c , $d);
This works fine, $all="hello,1900,2000,8:00";
Now I want to seperate those values again (other way around)
Herefor I use this line:
($h , $i , $j , $k) = split(/,/ , $all);
But this doesn't work... if I use
print $h\n;
print $i\n;
print $j\n;
print $k\n;
The variables are all empty, does anyone know what is wrong with this ?
------------------------------
Date: Thu, 11 Jan 2001 09:22:32 +0000
From: Nick Condon <nickco3@yahoo.co.uk>
Subject: Re: Strange ?
Message-Id: <3A5D7B58.6020403@yahoo.co.uk>
Waarddebon wrote:
> I put several values of variables into 1 variable but with the variables
> seperated bij commas
> thus:
>
> $a="hello";
> $b="1900";
> $c="2000";
> $d="8:00";
>
> I do that with this line:
> $all= join ("," , $a , $b , $c , $d);
> This works fine, $all="hello,1900,2000,8:00";
>
> Now I want to seperate those values again (other way around)
> Herefor I use this line:
> ($h , $i , $j , $k) = split(/,/ , $all);
>
> But this doesn't work... if I use
> print $h\n;
> print $i\n;
> print $j\n;
> print $k\n;
> The variables are all empty, does anyone know what is wrong with this ?
I cut and pasted this exact code and it works for me.
------------------------------
Date: Thu, 11 Jan 2001 17:31:43 +0800
From: "james roads" <zhenghua_li@nj.trendmicro.com>
Subject: Re: Strange ?
Message-Id: <93jui8$1lgg$1@news.cz.js.cn>
you should use:
print "$h\n"; or
print $h, "\n";
"Waarddebon" <Waarddebon@chello.nl> wrote in message
news:ZHe76.578134$%C1.7108476@Flipper...
> I put several values of variables into 1 variable but with the variables
> seperated bij commas
> thus:
>
> $a="hello";
> $b="1900";
> $c="2000";
> $d="8:00";
>
> I do that with this line:
> $all= join ("," , $a , $b , $c , $d);
> This works fine, $all="hello,1900,2000,8:00";
>
> Now I want to seperate those values again (other way around)
> Herefor I use this line:
> ($h , $i , $j , $k) = split(/,/ , $all);
>
> But this doesn't work... if I use
> print $h\n;
> print $i\n;
> print $j\n;
> print $k\n;
> The variables are all empty, does anyone know what is wrong with this ?
>
>
>
>
>
------------------------------
Date: 11 Jan 2001 10:33:46 GMT
From: cjw44@flatline.org.uk (Colin Watson)
Subject: Re: Strange ?
Message-Id: <93k26a$9mm$1@riva.ucam.org>
Nick Condon <nickco3@yahoo.co.uk> wrote:
>Waarddebon wrote:
>> Now I want to seperate those values again (other way around)
>> Herefor I use this line:
>> ($h , $i , $j , $k) = split(/,/ , $all);
>>
>> But this doesn't work... if I use
>> print $h\n;
>> print $i\n;
>> print $j\n;
>> print $k\n;
>> The variables are all empty, does anyone know what is wrong with this ?
>
>I cut and pasted this exact code and it works for me.
Did you really? I find this highly unlikely:
[cjw44@riva ~]$ perl
my $h = "a";
print $h\n;
Backslash found where operator expected at - line 2, near "$h\"
(Missing operator before \?)
'print "$h\n";' etc., of course.
--
Colin Watson [cjw44@flatline.org.uk]
"Alles Vergaengliche / Ist nur ein Gleichnis;
Das Unzulaengliche / Hier wird's Ereignis;" - _Faust_, Goethe
------------------------------
Date: Thu, 11 Jan 2001 11:06:57 +0100
From: "claudio militello" <claudio.militello@infos.es>
Subject: WORK AROUND perl odbc SQL-Server 7.0: no records with tinyint
Message-Id: <93k0ls$mli$1@lola.ctv.es>
Hi Jeff,
I found a work around, simply changing the query from:
$sql = "SELECT TE_ID, TE_CMIN from TELEFONOS";
to:
$sql = "SELECT TE_ID,convert(int,TE_CMIN)as TE_CMIN from TELEFONOS";
all is ok !!
Thank you for your suggestions, but I'm still convinced there is something
wrong with the perl odbc...
(perhaps problems with the spanish configuration ?) but using the convert
solves it (paying with performance...).
Last thing: I experienced no problem updating nor inserting a record with a
tinyint via perl odbc.
by
Claudio
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 37
*************************************