[26169] in Perl-Users-Digest
Perl-Users Digest, Issue: 8358 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 25 18:05:18 2005
Date: Thu, 25 Aug 2005 15:05:05 -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, 25 Aug 2005 Volume: 10 Number: 8358
Today's topics:
Re: Best Linux distro for range of Perl modules <emschwar@pobox.com>
Re: Can a Perl Programmer Pick up PHP quickly? <perl@my-header.org>
Re: can't rebind placehodler - Blob, ODBC, SQL Server, <mark.clementsREMOVETHIS@wanadoo.fr>
Re: FAQ 3.5 How do I debug my Perl programs? <emschwar@pobox.com>
Re: Field matching <noreply@gunnar.cc>
Re: how to read file from sub-directories and do an ave <emschwar@pobox.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 25 Aug 2005 12:32:03 -0600
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: Best Linux distro for range of Perl modules
Message-Id: <etou0hdamvw.fsf@wilson.emschwar>
zaphod <none@none.com> writes:
> Any views on which Linux distro installs the widest range of Perl module
> packages with a full install or with a minimal upgrade after the default
> install?
Debian, and its derivative Ubuntu, have just shy of 100 perl modules
pre-packaged; there is also the dh-make-perl program, which helps
create .debs out of CPAN packages (you still have to do a little work,
but it helps a lot).
-=Eric
------------------------------
Date: Thu, 25 Aug 2005 20:11:32 +0200
From: Matija Papec <perl@my-header.org>
Subject: Re: Can a Perl Programmer Pick up PHP quickly?
Message-Id: <va2sg19601joh49mho95mcn3c16dasf11q@4ax.com>
X-Ftn-To: Mike
mike@nospam.com (Mike) wrote:
>
>I have a lot of experience with Perl and a good paying job has come up
>that requires someone to update and maintain a website written in PHP.
>
>Can a Perl programmer pick up PHP easily? Are there similarities?
It is almost like perl but without map, grep[1], anonymous functions, real
references and namespaces. :) In turn it offers great deal of core functions
but I wouldn't consider that as an advantage.
[1] you can implement your own basic "poor man map" if you're really
desperate
--
Matija
------------------------------
Date: Thu, 25 Aug 2005 21:58:14 +0200
From: Mark Clements <mark.clementsREMOVETHIS@wanadoo.fr>
Subject: Re: can't rebind placehodler - Blob, ODBC, SQL Server, DBI, Win32
Message-Id: <430e22d7$0$17224$8fcfb975@news.wanadoo.fr>
Eric Anderson wrote:
> I have been banging my head against the wall for a while now trying to
> figure out why I can't upload a some blob data to a SQL Server database
> via DBI. I think I had it working a while back but I cannot be sure and
> obviously I am missing something here. The basic code is:
>
> $sql = 'UPDATE "File" SET Data = ? WHERE FileID = ?';
> $stmt = $self->storage()->prepare( $sql );
> $stmt->trace('5', 'C:\trace.log');
> $stmt->bind_param(1, $self->data(), {TYPE=>SQL_LONGVARBINARY});
> $stmt->bind_param(2, $self->id());
> $stmt->execute();
> $stmt->trace('0');
>
> I've tried many variations of the above but I always get the same basic
> results. The above variations is what I understand as the "correct"
> method based on the documentation. This code is inside an object so
> $self->data() returns the blob data as a scalar and $self->id() returns
> the id of the record we are updating. The whole thing is in the context
> of a CGI application (Mason actually) that is doing a file upload. My
> test file is a PDF file (but I have tried many different files of
> various sizes and types). $self->storage() returns a database handler to
> the SQL server and I generally haven't had any problems storing other
> types of data. It will return a brand new handler (new connection) so
> there is not an issue of a previous execution getting in the way.
>
> My error message I get is:
>
> Can't rebind placeholder 1 at /Program Files/Apache
> Group/Apache2/sites/cordata/singlesignon/sso/app/models//Data/File.pm
> line 36.
>
> Line 36 is the execute() statement. To try to debug this I enabled
> tracing (as you can see from the code). I have pasted the trace at the
> end of this message. I would be very thankful for any insight that could
> be provided. The two things that jump out to me in the trace are:
>
> SQLDescribeParam failed reverting to default type for this parameter:
> HY010 [Microsoft][ODBC Driver Manager] Function sequence error
>
> and
>
> _rebind_ph/SQLBindParameter error -1 recorded: [Microsoft][ODBC SQL
> Server Driver]Invalid precision value (SQL-HY104)(DBD:
> _rebind_ph/SQLBindParameter err=-1)
>
> but I don't know enough about what is going on to determine what I need
> to do to fix the problem. Again thank you for any help you can provide.
<snip trace>
Have you tried binding as different types eg
SQL_BINARY
SQL_VARBINARY
what is the actual datatype of the field in question ie "Data" (which
isn't a very descriptive name :) )?
Mark
------------------------------
Date: Thu, 25 Aug 2005 15:21:11 -0600
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: FAQ 3.5 How do I debug my Perl programs?
Message-Id: <etod5o1af20.fsf@wilson.emschwar>
"Eric J. Roode" <sdn.girths00869@zoemail.net> writes:
> Might I suggest adding a note about the excellent Devel::ptkdb
> debugger? It requires Tk, and it doesn't come with perl, but it's a
> great windowed debugger, in the style that many people coming to Perl
> from other languages may be used to.
Honestly, I've never been particularly comfortable with the standard
perl debugger, but when a co-worker showed me what you could do with
-d:ptkdb, I was hooked. Aside from conditional breakpoints, which I
can't figure out how to make work, it's brilliant.
-=Eric
------------------------------
Date: Thu, 25 Aug 2005 23:16:15 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Field matching
Message-Id: <3n6qloF5otiU1@individual.net>
Geezer From The Freezer wrote:
> Gunnar Hjalmarsson wrote:
>> Geezer From The Freezer wrote:
>>> Whats the best way at using field manipulation in perl (much like
>>> awk where you can use: awk '$2 == 3 && $3 == 9{print}' )
>>
>> Which ways are you considering?
>
> I was considering sticking the whole file in an array and using a
> foreach $line (@array) then splitting the $line and then trying to
> compare the fields, but it seems sloppy.
I see. As long as you only need to _get_ certain field values, Jim's
method is memory saving. If you also need to _set_ values, the Tie::File
module may be what you want.
use Tie::File;
tie my @rows, 'Tie::File', @file or die "Couldn't bind @file: $!";
for (@rows) {
my @f = split;
if ( $f[1] == 3 and $f[2] == 9 ) {
$f[3] = $f[1] + $f[2];
$_ = "@f";
}
}
untie @rows or die $!;
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Thu, 25 Aug 2005 12:17:35 -0600
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: how to read file from sub-directories and do an average?
Message-Id: <etoy86pank0.fsf@wilson.emschwar>
Tad McClellan <tadmc@augustmail.com> writes:
> Ross <a@cuhk.edu.hk> wrote:
>> @inputdirname = readdir(WORKINGDIR);
>> foreach $inputdirname (sort @inputdirname) {
>
>
> There is no need for a temporary array:
>
> foreach $inputdirname (sort readdir WORKINGDIR) {
No, but I have found that unless memory usage is a specific
optimization goal, temporary variables help tremendously in debugging,
and I will often use them even if they are not strictly required. I
could easly insert a
{
local $" = ', ';
print STDERR "inputdirs: [@inputdirname]\n";
}
block if I don't seem to be getting what I want to, or if I'm using
the debugger (mad props to Devel::ptkdb!), set a breakpoint after the
readdir() call.
-=Eric
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 8358
***************************************