|
||Hello,
||the following code saves a randomly chosen text from Tk::Text to db
||through DBI/DBD::CSV. When you add a few characters to the widget and
||save by means of a 'change' button, the packed program crashes.
||Saving less characters is ok.
||Tested on windows xp and W98, running a bare script is ok.
||Packed simply with pp -o test.exe test.pl.
||db file test enclosed, perl is v5.8.6 from ActiveState.
||
||
||
||id|notes|entry
||1|"Thank you for using ActivePerl, ActiveStates quality-assured
binary build of Perl, available for Linux, Solaris and Windows. As
part of ActiveStates support for Perl, ActiveState provides the
ActivePerl binary packages free to the community. ActivePerl includes:
||Perl, the binary core distribution
||The Perl Package Manager , for installing Perl extension modules
||Complete documentation
||The Windows version of ActivePerl also includes:
||Perl for ISAPI, an IIS plug-in that makes perl CGI faster
||PerlScript, an ActiveX scripting engine, like JavaScript or VBScript
with a Perl brain
||PerlEz, for embedding Perl the easy way
||
||Refer to the Release Notes for information about this version of
ActivePerl.
||ActiveState Products
||
||ActiveState is the leading provider of productivity tools for Perl
programmers and technology solutions based on Perl.
||Solutions
||ASPN Perl, a complete package of Perl productivity tools and
programming information.
||PerlEx, easy website acceleration for Perl scripts.
||PerlASPX, use Perl for dynamic content generation on ASP.NET Web
servers.
||Productivity Tools
||Perl Dev Kit, the essential toolkit for building Perl applications
for UNIX and Windows platforms.
||Komodo, the cross-platform integrated development environment for
open source languages.
||Visual Perl, the Perl plug-in for Visual Studio .NET.
||Contact ActiveState
||
||For installation-related support issues, contact
[EMAIL PROTECTED]
||
||For general information and support, refer to the ActivePerl mailing
list at http://aspn.ActiveState.com/ASPN/Mail/Browse/Threaded/ActivePerl
||
||To report a bug, or to view bugs fixed in this release, see the
ActivePerl bug site, at http://bugs.ActiveState.com/ActivePerl
||
||Thank you for using ActivePerl, ActiveStates quality-assured binary
build of Perl,
||Komodo, the cross-platform integrated development environment for
open source languages.
||Visual Perl, the Perl plug-in for Visual Studio .NET.
||Contact ActiveState
||
||For installation-related support issues, contact
[EMAIL PROTECTED]
||
||For general information and support, refer to the ActivePerl mailing
list at http://aspn.ActiveState.com/ASPN/Mail/Browse/Threaded/ActivePerl
||
||To report a bug, or to view bugs fixed in this release, see the
ActivePerl bug site, at http://bugs.ActiveState.com/ActivePerl
||
||Thank you for using ActivePerl, ActiveStates quality-assured binary
build of Perl,
||Komodo, the cross-platform integrated development environment for
open source languages.
||Visual Perl, the Perl plug-in for Visual
||sss sss s"|ascii
||
||
||
||
||__START CODE__
||#!/usr/local/perl
||use Tk;
||use Tk::Text;
||use DBI;
||use warnings;
||use strict;
||
||my ($mw,$dbh);
||our ($text);
||
||$mw = MainWindow->new();
||$mw->geometry("600x400");
||$text= $mw->Scrolled('Text',
|| -scrollbars=>'e',
|| )->pack(-side=>'top',
|| -fill=>'both',
|| );
||$mw->Button(-text=>'change',
|| -command=>[\&change,\$dbh],
|| )->pack();
||$mw->Button(-text=>'retrieve',
|| -command=>[\&retrieve,\$dbh],
|| )->pack();
||
||$dbh = DBI->connect("DBI:CSV:csv_sep_char=\\|",{RaiseError =>
1,AutoCommit => 1,})
|| or die "Cannot connect: " . $DBI::errstr;
||
||retrieve(\$dbh);
||
||MainLoop;
||
||sub change {
|| my ($rdbh,$notes);
|| ($rdbh) = @_;
|| chomp ($notes = $text->get("1.0",'end'));
|| $$rdbh->do("UPDATE test SET notes=\'$notes\'")
|| or die "Cannot update: " . $DBI::errstr;
||}
||
||sub retrieve {
|| my ($dbh,$rdbh,$sth,$notes);
|| ($rdbh) = @_;
|| $dbh = $$rdbh;
|| $sth = $dbh->prepare("SELECT notes FROM test")
|| or die "Cannot prepare: " . $DBI::errstr;
|| $sth->execute() or die "Cannot execute: " . $DBI::errstr;
|| $sth->bind_col(1,\$notes) or die "Cannot bind: " . $DBI::errstr;
|| my $a = $sth->fetch or die "Cannot fetch: " . $DBI::errstr;
|| $text->delete("1.0",'end');
|| $text->insert('end',$notes);
|| $sth->finish or die "Cannot finish: " . $DBI::errstr;
||}
||__END CODE__
||
||Does anyone have a clue?
||Thanks much.
||
||-- Radek
|-----------------------------------------------------------------------------------
|Upon further testing, I have found problems, too.
|As reported earlier, there are no problems if I use
| pp -o test.exe -a ./test di_dbd_csv.pl
|It works, but if I then copy test.exe to another directory and try
it, I get
|
|---------------paste
|Execution ERROR: Cannot open .\test: No such file or directory at
DBD/File.pm line 574.
|called from script/di_dbd_csv.pl at 28.
|
|Statement has no result columns to bind (perhaps you need to call
execute first) at script/di_dbd_csv.pl line 47.
|------------end paste
|
|I then went back to the original directory and used the full path
name of the 'test' file, like this:
|
|C:\Documents and Settings\malcolm\My
Documents\perlfiles\pp_misc_tests>pp -o test.exe -a "C:/Documents and
Settings/malcolm/My Documents/perlfiles/pp_misc_tests/test di_dbd_csv.pl
|
|with the same results.
|Can anyone think of why this might be happening?
|
I ran PAR-0.89\contrib\automated_pp_test\automated_pp_test.pl
which tests the -a flag in different ways, including copying the
created executable to a new directory and running it from there. It
passed, so apparantly there is nothing wrong with the -a flag as far
as pp itself is concerned.
My next question is, what happens in DBD/File.pm line 574?
In File.pm, sub open_table, a call is made to $self->get_file_name
that assigns the value of the variable $table to the variable $file.
I added a print statement that let me know that $table, and hence
$file, gets set to "test", wherein lies the problem. Someone who is
familiar with the modules involved would have to take it from here, to
discern why only the base name of the file "test" is being kept.
I don't know if this is related to the originally reported problem
(program crash) but it is a problem here under this scenario. Namely,
running the created executable from a different directory.
Anyone else have some ideas on this?