[24427] in Perl-Users-Digest
Perl-Users Digest, Issue: 6613 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 27 00:05:55 2004
Date: Wed, 26 May 2004 21:05:06 -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 Wed, 26 May 2004 Volume: 10 Number: 6613
Today's topics:
Can't locate loadable object for module DBI in @INC (prog4ever)
Re: Can't locate loadable object for module DBI in @INC <matthew.garrish@sympatico.ca>
Re: How do I interpret debugger text representation? <invalid-email@rochester.rr.com>
Re: SQL::Abstract - generating q(like "%?%")? <matthew.garrish@sympatico.ca>
Re: SQL::Abstract - generating q(like "%?%")? <gnari@simnet.is>
Re: SQL::Abstract - generating q(like "%?%")? <dwall@fastmail.fm>
Re: SQL::Abstract - generating q(like "%?%")? <uri@stemsystems.com>
Re: Stat() function fails? <1usa@llenroc.ude>
Re: Stat() function fails? <http://joecosby.com/code/mail.pl>
Re: Stat() function fails? <gnari@simnet.is>
Re: Stat() function fails? <1usa@llenroc.ude>
Re: Stat() function fails? <http://joecosby.com/code/mail.pl>
Re: Stat() function fails? <1usa@llenroc.ude>
Re: Stat() function fails? <uri@stemsystems.com>
Re: Stat() function fails? <1usa@llenroc.ude>
Re: Templating system needs help <uri@stemsystems.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 26 May 2004 18:05:44 -0700
From: chanwern@yahoo.com (prog4ever)
Subject: Can't locate loadable object for module DBI in @INC
Message-Id: <214f736f.0405261705.496b45f9@posting.google.com>
i ran into this problem with dbi 1.42, on hp-ux 11.11 , perl 5.8.0 .
Below is the log file from the installation process.
can anyone advise on how i can resolve this issue? thanks.
==========================================================================
Script started on Wed May 26 15:52:24 2004
[root@oberon:/apps11/src/DBI-1.42]# perl Makefile.PL
*** You are using a perl configured with threading enabled.
*** You should be aware that using multiple threads is
*** not recommended for production environments.
Creating extra DBI::PurePerl test: t/zz_01basics_pp.t
Creating extra DBI::PurePerl test: t/zz_02dbidrv_pp.t
Creating extra DBI::PurePerl test: t/zz_03handle_pp.t
Creating extra DBI::PurePerl test: t/zz_04mods_pp.t
Creating extra DBI::PurePerl test: t/zz_05thrclone_pp.t (use threads)
Creating extra DBI::PurePerl test: t/zz_06attrs_pp.t
Creating extra DBI::PurePerl test: t/zz_07kids_pp.t
Creating extra DBI::PurePerl test: t/zz_08keeperr_pp.t
Creating extra DBI::PurePerl test: t/zz_09trace_pp.t
Creating extra DBI::PurePerl test: t/zz_10examp_pp.t
Creating extra DBI::PurePerl test: t/zz_15array_pp.t
Creating extra DBI::PurePerl test: t/zz_20meta_pp.t
Creating extra DBI::PurePerl test: t/zz_30subclass_pp.t
Creating extra DBI::PurePerl test: t/zz_40profile_pp.t
Creating extra DBI::PurePerl test: t/zz_41prof_dump_pp.t
Creating extra DBI::PurePerl test: t/zz_42prof_data_pp.t
Creating extra DBI::PurePerl test: t/zz_50dbm_pp.t
Creating extra DBI::PurePerl test: t/zz_60preparse_pp.t
Creating extra DBI::PurePerl test: t/zz_80proxy_pp.t
Checking if your kit is complete...
Looks good
I see you're using perl 5.008 on PA-RISC1.1-thread-multi, okay.
Remember to actually *read* the README file!
Use 'make' to build the software (dmake or nmake on Windows).
Then 'make test' to execute self tests.
Then 'make install' to install the DBI and then delete this
working
directory before unpacking and building any DBD::* drivers.
Writing Makefile for DBI
[root@oberon:/apps11/src/DBI-1.42]# make
cp Changes blib/lib/DBI/Changes.pm
cp dbivport.h blib/arch/auto/DBI/dbivport.h
cp dbd_xsh.h blib/arch/auto/DBI/dbd_xsh.h
cp lib/DBI/FAQ.pm blib/lib/DBI/FAQ.pm
cp Driver_xst.h blib/arch/auto/DBI/Driver_xst.h
cp lib/DBI/SQL/Nano.pm blib/lib/DBI/SQL/Nano.pm
cp lib/DBD/DBM.pm blib/lib/DBD/DBM.pm
cp DBI.pm blib/lib/DBI.pm
cp lib/DBD/Proxy.pm blib/lib/DBD/Proxy.pm
cp lib/DBI/Const/GetInfo/ANSI.pm blib/lib/DBI/Const/GetInfo/ANSI.pm
cp DBIXS.h blib/arch/auto/DBI/DBIXS.h
cp lib/DBI/Const/GetInfoReturn.pm blib/lib/DBI/Const/GetInfoReturn.pm
cp lib/DBD/Sponge.pm blib/lib/DBD/Sponge.pm
cp lib/DBI/Const/GetInfoType.pm blib/lib/DBI/Const/GetInfoType.pm cp
lib/DBI/DBD/Metadata.pm blib/lib/DBI/DBD/Metadata.pm cp
lib/DBI/W32ODBC.pm blib/lib/DBI/W32ODBC.pm cp lib/Bundle/DBI.pm
blib/lib/Bundle/DBI.pm cp lib/DBI/Const/GetInfo/ODBC.pm
blib/lib/DBI/Const/GetInfo/ODBC.pm
cp lib/DBI/ProfileDumper/Apache.pm
blib/lib/DBI/ProfileDumper/Apache.pm
cp lib/DBI/Profile.pm blib/lib/DBI/Profile.pm
cp Driver.xst blib/arch/auto/DBI/Driver.xst
cp lib/DBD/File.pm blib/lib/DBD/File.pm
cp lib/DBI/ProfileDumper.pm blib/lib/DBI/ProfileDumper.pm
cp dbipport.h blib/arch/auto/DBI/dbipport.h
cp lib/DBD/NullP.pm blib/lib/DBD/NullP.pm
cp lib/DBI/DBD.pm blib/lib/DBI/DBD.pm
cp lib/DBI/ProxyServer.pm blib/lib/DBI/ProxyServer.pm
cp lib/Win32/DBIODBC.pm blib/lib/Win32/DBIODBC.pm
cp dbi_sql.h blib/arch/auto/DBI/dbi_sql.h
cp lib/DBD/ExampleP.pm blib/lib/DBD/ExampleP.pm
cp lib/DBI/PurePerl.pm blib/lib/DBI/PurePerl.pm
cp lib/DBI/ProfileData.pm blib/lib/DBI/ProfileData.pm
/opt/perl/bin/perl -p -e "s/~DRIVER~/Perl/g"
blib/arch/auto/DBI/Driver.xst > Perl.xsi
/opt/perl/bin/perl /opt/perl/lib/5.8.0/ExtUtils/xsubpp -typemap
/opt/perl/lib/5.8.0/ExtUtils/typemap -typemap typemap Perl.xs >
Perl.xsc && mv Perl.xsc Perl.c
gcc -c -D_POSIX_C_SOURCE=199506L -D_REENTRANT -D_HPUX_SOURCE -fPIC
-mpa-risc-1-1 -fno-strict-aliasing -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -O -DVERSION=\"1.42\" -DXS_VERSION=\"1.42\"
-fPIC "-I/opt/perl/lib/5.8.0/PA-RISC1.1-thread-multi/CORE" -Wall
-Wno-comment Perl.c
/opt/perl/bin/perl /opt/perl/lib/5.8.0/ExtUtils/xsubpp -typemap
/opt/perl/lib/5.8.0/ExtUtils/typemap -typemap typemap DBI.xs >
DBI.xsc && mv DBI.xsc DBI.c
gcc -c -D_POSIX_C_SOURCE=199506L -D_REENTRANT -D_HPUX_SOURCE -fPIC
-mpa-risc-1-1 -fno-strict-aliasing -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -O -DVERSION=\"1.42\" -DXS_VERSION=\"1.42\"
-fPIC "-I/opt/perl/lib/5.8.0/PA-RISC1.1-thread-multi/CORE" -Wall
-Wno-comment DBI.c
DBI.xs: In function `dbih_clearcom':
DBI.xs:1128: warning: unused variable `Perl___notused'
DBI.xs: In function `dbih_get_fbav':
DBI.xs:1265: warning: unused variable `Perl___notused'
DBI.xs: In function `dbih_set_attr_k':
DBI.xs:1436: warning: unused variable `Perl___notused'
DBI.xs:1345: warning: unused variable `Perl___notused'
DBI.xs: In function `dbih_get_attr_k':
DBI.xs:1574: warning: unused variable `Perl___notused'
DBI.xs: In function `log_where':
DBI.xs:1986: warning: unused variable `Perl___notused'
DBI.xs: In function `XS_DBI_dispatch':
DBI.xs:2807: warning: unused variable `Perl___notused'
Running Mkbootstrap for DBI ()
chmod 644 DBI.bs
rm -f blib/arch/auto/DBI/DBI.sl
LD_RUN_PATH="" gcc -shared -static-libgcc -fPIC DBI.o -o
blib/arch/auto/DBI/DBI.sl
chmod 755 blib/arch/auto/DBI/DBI.sl
cp DBI.bs blib/arch/auto/DBI/DBI.bs
chmod 644 blib/arch/auto/DBI/DBI.bs
/opt/perl/bin/perl "-Iblib/arch" "-Iblib/lib" dbiprof.PL dbiprof
Extracted dbiprof from dbiprof.PL with variable substitutions.
cp dbiprof blib/script/dbiprof
/opt/perl/bin/perl "-MExtUtils::MY" -e "MY->fixin(shift)"
blib/script/dbiprof
/opt/perl/bin/perl "-Iblib/arch" "-Iblib/lib" dbiproxy.PL dbiproxy
Extracted dbiproxy from dbiproxy.PL with variable substitutions.
cp dbiproxy blib/script/dbiproxy
/opt/perl/bin/perl "-MExtUtils::MY" -e "MY->fixin(shift)"
blib/script/dbiproxy Manifying blib/man3/DBI::FAQ.3 Manifying
blib/man1/dbiproxy.1 Manifying blib/man3/DBI::SQL::Nano.3 Manifying
blib/man3/DBD::Proxy.3 Manifying blib/man3/DBI::Const::GetInfo::ANSI.3
Manifying blib/man3/DBD::DBM.3
Manifying blib/man3/DBI.3
Manifying blib/man3/DBI::Const::GetInfoReturn.3
Manifying blib/man3/DBD::Sponge.3
Manifying blib/man1/dbiprof.1
Manifying blib/man3/DBI::Const::GetInfoType.3
Manifying blib/man3/DBI::W32ODBC.3
Manifying blib/man3/DBI::DBD::Metadata.3
Manifying blib/man3/DBI::Const::GetInfo::ODBC.3
Manifying blib/man3/DBI::ProfileDumper::Apache.3
Manifying blib/man3/Bundle::DBI.3
Manifying blib/man3/DBI::Profile.3
Manifying blib/man3/DBI::ProfileDumper.3
Manifying blib/man3/DBD::File.3
Manifying blib/man3/DBI::ProxyServer.3
Manifying blib/man3/DBI::DBD.3
Manifying blib/man3/Win32::DBIODBC.3
Manifying blib/man3/DBI::PurePerl.3
Manifying blib/man3/DBI::ProfileData.3
[root@oberon:/apps11/src/DBI-1.42]# make test
PERL_DL_NONLAZY=1 /opt/perl/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
[root@oberon:/apps11/src/DBI-1.42]# make install Installing
/opt/perl/lib/site_perl/5.8.0/PA-RISC1.1-thread-multi/auto/DBI/dbd_xsh.h
Installing /opt/perl/lib/site_perl/5.8.0/PA-RISC1.1-thread-multi/auto/DBI/Driver_xst.h
Installing /opt/perl/lib/site_perl/5.8.0/PA-RISC1.1-thread-multi/auto/DBI/DBIXS.h
Installing /opt/perl/lib/site_perl/5.8.0/PA-RISC1.1-thread-multi/auto/DBI/Driver.xst
Installing /opt/perl/lib/site_perl/5.8.0/PA-RISC1.1-thread-multi/auto/DBI/dbi_sql.h
Installing /opt/perl/lib/site_perl/5.8.0/PA-RISC1.1-thread-multi/auto/DBI/DBI.sl
Installing /opt/perl/lib/site_perl/5.8.0/PA-RISC1.1-thread-multi/DBI.pm
Installing /opt/perl/lib/site_perl/5.8.0/PA-RISC1.1-thread-multi/DBD/Sponge.pm
Installing /opt/perl/lib/site_perl/5.8.0/PA-RISC1.1-thread-multi/DBD/NullP.pm
Installing /opt/perl/lib/site_perl/5.8.0/PA-RISC1.1-thread-multi/DBD/ExampleP.pm
Installing /opt/perl/lib/site_perl/5.8.0/PA-RISC1.1-thread-multi/DBI/Changes.pm
Installing /opt/perl/lib/site_perl/5.8.0/PA-RISC1.1-thread-multi/DBI/DBD.pm
Installing /opt/perl/lib/site_perl/5.8.0/PA-RISC1.1-thread-multi/DBI/PurePerl.pm
Installing /opt/perl/lib/site_perl/5.8.0/PA-RISC1.1-thread-multi/DBI/DBD/Metadata.pm
Installing /opt/perl/man/man1/dbiproxy.1
Installing /opt/perl/man/man3/DBI.3
Installing /opt/perl/man/man3/DBD::Sponge.3
Installing /opt/perl/man/man3/DBI::DBD::Metadata.3
Installing /opt/perl/man/man3/DBI::DBD.3
Installing /opt/perl/man/man3/DBI::PurePerl.3
Installing /opt/perl/bin/dbiproxy
Appending installation info to
/opt/perl/lib/5.8.0/PA-RISC1.1-thread-multi/perllocal.pod
[root@oberon:/apps11/src/DBI-1.42]# make test
PERL_DL_NONLAZY=1 /opt/perl/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
# perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 0)
configuration:
Platform:
osname=hpux, osvers=11.00, archname=PA-RISC1.1-thread-multi
uname='hp-ux bertha b.11.00 u 9000800 136901587 unlimited-user
license '
config_args='-des -Dcc=gcc -Dcf_by=ActiveState
-Dcf_email=ActivePerl@ActiveState.com -Uinstallusrbinperl
-Ud_sigsetjmp -Dusethreads -Duseithreads -Ulocincpth= -Uloclibpth=
-Accflags=-fPIC -Dd_attribut=undef -Dcccdlflags=-fPIC
-Darchname=PA-RISC1.1 -Duselargefiles -Accflags=-mpa-risc-1-1
-Dprefix=/opt/perl -Duselargefiles'
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='gcc', ccflags ='-D_POSIX_C_SOURCE=199506L -D_REENTRANT
-D_HPUX_SOURCE -fPIC -mpa-risc-1-1 -fno-strict-aliasing
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O',
cppflags='-D_HPUX_SOURCE -D_POSIX_C_SOURCE=199506L -D_REENTRANT
-D_HPUX_SOURCE -fPIC -mpa-risc-1-1 -fno-strict-aliasing'
ccversion='', gccversion='3.2 20020708 (experimental)',
gccosandvers='hpux11.00'
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
d_longlong=define, longlongsize=8, d_longdbl=define,
longdblsize=16
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='gcc', ldflags =''
libpth=/lib /usr/lib /usr/ccs/lib /usr/local/lib
libs=-lnsl -lnm -lndbm -lmalloc -ldld -lm -lndir -lcrypt -lsec
-lpthread
perllibs=-lnsl -lnm -lmalloc -ldld -lm -lndir -lcrypt -lsec
-lpthread
libc=/lib/libc.sl, so=sl, useshrplib=false, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_hpux.xs, dlext=sl, d_dlsymun=undef, ccdlflags='-Wl,-E
-Wl,-B,deferred '
cccdlflags='-fPIC', lddlflags='-shared -static-libgcc -fPIC'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES
PERL_IMPLICIT_CONTEXT
Locally applied patches:
ActivePerl Build 806
Built under hpux
Compiled at May 2 2003 21:44:05
@INC:
/opt/perl/lib/5.8.0/PA-RISC1.1-thread-multi
/opt/perl/lib/5.8.0
/opt/perl/lib/site_perl/5.8.0/PA-RISC1.1-thread-multi
/opt/perl/lib/site_perl/5.8.0
/opt/perl/lib/site_perl
.
------------------------------
Date: Wed, 26 May 2004 21:37:05 -0400
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Can't locate loadable object for module DBI in @INC
Message-Id: <1Dbtc.31098$sr3.918759@news20.bellglobal.com>
"prog4ever" <chanwern@yahoo.com> wrote in message
news:214f736f.0405261705.496b45f9@posting.google.com...
> i ran into this problem with dbi 1.42, on hp-ux 11.11 , perl 5.8.0 .
> Below is the log file from the installation process.
>
> can anyone advise on how i can resolve this issue? thanks.
>
You didn't read the readme, did you?
Please don't post problems to comp.lang.perl.* or perl5-porters.
This software is supported via the dbi-users mailing list. For more
information and to keep informed about progress you can join the
mailing list via mailto:dbi-users-help@perl.org
I would suggest googling for an answer before posting there, though.
Matt
------------------------------
Date: Thu, 27 May 2004 01:23:46 GMT
From: Bob Walton <invalid-email@rochester.rr.com>
Subject: Re: How do I interpret debugger text representation?
Message-Id: <40B541A2.7030003@rochester.rr.com>
Sara wrote:
> I have a scalar, which according to the debugger, has some weird stuff
> in it:
>
> DB<28> x $_
> 0 "\c@\c@mm18-wr1.1\cC\c@\c@T25\cH\c@\c@mm18-mn1\cC\c@\c@T2"
>
...
> How can I split up this scalar on \c*anything* ?
Well, what you probably want to do is to split it up by characters.
That can be done by splitting on the null pattern:
my @chars=split //,$scalar;
or to print it with decimal character codes:
print join ':',map {ord} split //,$a;
What IS \c*something*
> anyhow? Control-*something* ?
Yep. \c@ is chr(0), \cA is chr(1), etc. The debugger outputs the
string that way so you can tell what is in it -- if it put the control
characters straight to your console terminal, you'd get all sorts of odd
stuff.
> Tanx
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl
------------------------------
Date: Wed, 26 May 2004 21:22:58 -0400
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: SQL::Abstract - generating q(like "%?%")?
Message-Id: <Npbtc.31086$sr3.912587@news20.bellglobal.com>
"David K. Wall" <dwall@fastmail.fm> wrote in message
news:Xns94F584FEF26D5dkwwashere@216.168.3.30...
> I've been playing with SQL::Abstract, but I can't seem to get it to
> generate the SQL I want. I want the following, with wildcards around
> the placeholder:
>
> WHERE ( DB_FIELD LIKE "%?%" )
> OR ( DB_FIELD LIKE "%?%" )
> OR ( DB_FIELD LIKE "%?%" )
>
> The closest I've been able to get to it is this:
>
> use SQL::Abstract;
> my $test = SQL::Abstract->new( cmp => 'like' );
> my ($stmt, @bind) = $test->where(
> { DB_FIELD => [qw(word1 word2 word3)] }
> );
> print $stmt;
>
>
> which produces (formatted for usenet)
>
> WHERE ( ( ( DB_FIELD LIKE ? )
> OR ( DB_FIELD LIKE ? )
> OR ( DB_FIELD LIKE ? ) ) )
>
> I don't care about the extra parentheses one way or another.
>
You can't put a placeholder within a string. Incorporate the wildcards into
your string values before you execute the statement. Assuming you have the
above three placeholders in your statement, you could then do something like
this:
$my_sth->execute("%$val1%", "%$val2%", "%$val3%");
Matt
------------------------------
Date: Thu, 27 May 2004 01:13:11 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: SQL::Abstract - generating q(like "%?%")?
Message-Id: <c93f7t$2eh$1@news.simnet.is>
"Uri Guttman" <uri@stemsystems.com> wrote in message
news:x7hdu2iuu6.fsf@mail.sysarch.com...
> >>>>> "g" == gnari <gnari@simnet.is> writes:
>
> g> "David K. Wall" <dwall@fastmail.fm> wrote in message
> g> news:Xns94F584FEF26D5dkwwashere@216.168.3.30...
> >> I've been playing with SQL::Abstract, but I can't seem to get it to
> >> generate the SQL I want. I want the following, with wildcards around
> >> the placeholder:
> >>
> >> WHERE ( DB_FIELD LIKE "%?%" )
> >> OR ( DB_FIELD LIKE "%?%" )
> >> OR ( DB_FIELD LIKE "%?%" )
> >>
>
> g> I was under the impression thatbthis is illegal
> g> placeholder syntax
>
> i think you can just have ? there and put the % wrapper in the data
> before you send it to dbi. it really is just a string with %% around it
> and it shouldn't be any different than other uses of placeholders.
and by some coincidence , that is exactly what SQL::Abstract generated.
:-)
gnari
------------------------------
Date: Thu, 27 May 2004 02:16:02 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: SQL::Abstract - generating q(like "%?%")?
Message-Id: <Xns94F5E28311C74dkwwashere@216.168.3.30>
"Matt Garrish" <matthew.garrish@sympatico.ca> wrote:
> You can't put a placeholder within a string. Incorporate the wildcards
> into your string values before you execute the statement. Assuming you
> have the above three placeholders in your statement, you could then do
> something like this:
>
> $my_sth->execute("%$val1%", "%$val2%", "%$val3%");
And oddly enough, that's what my original program was doing. :-) I just read
it wrong. But thanks to you and gnari for pointing it out.
------------------------------
Date: Thu, 27 May 2004 03:40:25 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: SQL::Abstract - generating q(like "%?%")?
Message-Id: <x71xl6illi.fsf@mail.sysarch.com>
>>>>> "g" == gnari <gnari@simnet.is> writes:
g> "Uri Guttman" <uri@stemsystems.com> wrote in message
g> news:x7hdu2iuu6.fsf@mail.sysarch.com...
>>
>> i think you can just have ? there and put the % wrapper in the data
>> before you send it to dbi. it really is just a string with %% around it
>> and it shouldn't be any different than other uses of placeholders.
g> and by some coincidence , that is exactly what SQL::Abstract
g> generated. :-)
well, i just applied PSI::ESP and Add::More::Brains and voila!
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 27 May 2004 01:38:42 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude>
Subject: Re: Stat() function fails?
Message-Id: <Xns94F5DC2F830asu1cornelledu@132.236.56.8>
Joe Cosby <http://joecosby.com/code/mail.pl> wrote in
news:0jfab05uf6gi8c8ufr0mp3rppgfrt91sq3@4ax.com:
> There's no error message or anything, but when it executes
>
> $st = stat($filename) or die "Can't stat file $filename\n";
>
> it dies.
>
> I am running Windows, I tried this on both a FAT32 directory and an
> NTFS directory with the same result.
...
> Does anybody have any idea why this might be failing?
Dunno. But you could help us answer the question by at least checking
what the system thinks was wrong with the call:
my $st = stat $filename or die "Cannot stat $filename: $!";
Also, posting a short but complete script that exhibits the problem would
go a long way toward finding a solution.
--
A. Sinan Unur
1usa@llenroc.ude (reverse each component for email address)
------------------------------
Date: Wed, 26 May 2004 18:57:12 -0700
From: Joe Cosby <http://joecosby.com/code/mail.pl>
Subject: Re: Stat() function fails?
Message-Id: <fbiab092ql4rf0c5l48qda92rbc29ou8h8@4ax.com>
On 27 May 2004 01:38:42 GMT, "A. Sinan Unur" <1usa@llenroc.ude> wrote:
>Joe Cosby <http://joecosby.com/code/mail.pl> wrote in
>news:0jfab05uf6gi8c8ufr0mp3rppgfrt91sq3@4ax.com:
>
>> There's no error message or anything, but when it executes
>>
>> $st = stat($filename) or die "Can't stat file $filename\n";
>>
>> it dies.
>>
>> I am running Windows, I tried this on both a FAT32 directory and an
>> NTFS directory with the same result.
>
>...
>
>> Does anybody have any idea why this might be failing?
>
>Dunno. But you could help us answer the question by at least checking
>what the system thinks was wrong with the call:
>
>my $st = stat $filename or die "Cannot stat $filename: $!";
>
>Also, posting a short but complete script that exhibits the problem would
>go a long way toward finding a solution.
Thanks, I added $!, I had seen that in example code but didn't know
what it meant. Perl is kind of learn-by-osmosis.
The script is very short, here it is:
use File::stat;
chdir 'C:\\My Documents\\DR\\fm docs\\NetComDocs\\user\\doc' || die
"Couldn't chdir";
$some_dir = "software";
opendir(DIR, $some_dir) or die "Can't open directory";
while (defined($filename = readdir(DIR)))
{
$st = stat($filename) or die "Can't stat file $filename: $!";
print $filename . " " . $st->mode . "\n";
}
closedir(DIR)
(end)
The extra error outupt just gave me: "Can't stat file taxcalculator:
at C:\My Documents\projects\perl dir walker\dirwalker.pl line 9."
which is not very helpful ...
The line with chdir on it is wrapped for usenet
I tried the same thing with the perlfunc version of stat() in addition
to with File::stat , same results both ways.
--
Joe Cosby
http://joecosby.com/
LE MARCHE FUTILE?
------------------------------
Date: Thu, 27 May 2004 01:26:05 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: Stat() function fails?
Message-Id: <c93g04$2go$1@news.simnet.is>
"Joe Cosby" <http://joecosby.com/code/mail.pl> wrote in message
news:0jfab05uf6gi8c8ufr0mp3rppgfrt91sq3@4ax.com...
[snip problem involving readdir()]
just show us a minimal program that shows this behaviour.
the usual gotcha with readdir() is that it returns a list of leaf
filenames, and people forget to apply the full path when using
them in IO operations.
you imply that you have not fallen into this trap, but we will
believe it when we see code.
gnari
------------------------------
Date: 27 May 2004 02:10:13 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude>
Subject: Re: Stat() function fails?
Message-Id: <Xns94F5E1875744Aasu1cornelledu@132.236.56.8>
Joe Cosby <http://joecosby.com/code/mail.pl> wrote in
news:fbiab092ql4rf0c5l48qda92rbc29ou8h8@4ax.com:
> On 27 May 2004 01:38:42 GMT, "A. Sinan Unur" <1usa@llenroc.ude> wrote:
>
>>Joe Cosby <http://joecosby.com/code/mail.pl> wrote in
>>news:0jfab05uf6gi8c8ufr0mp3rppgfrt91sq3@4ax.com:
>>
>>> There's no error message or anything, but when it executes
>>>
>>> $st = stat($filename) or die "Can't stat file $filename\n";
>>>
>>> it dies.
...
>>> Does anybody have any idea why this might be failing?
>>
>>Dunno. But you could help us answer the question by at least checking
>>what the system thinks was wrong with the call:
>>
>>my $st = stat $filename or die "Cannot stat $filename: $!";
>>
>>Also, posting a short but complete script that exhibits the problem
>>would go a long way toward finding a solution.
>
> Thanks, I added $!, I had seen that in example code but didn't know
> what it meant. Perl is kind of learn-by-osmosis.
>
> The script is very short, here it is:
use strict;
use warnings;
> use File::stat;
>
> chdir 'C:\\My Documents\\DR\\fm docs\\NetComDocs\\user\\doc' || die
> "Couldn't chdir";
chdir 'C:/My Documents/DR/fm docs/NetComDocs/user/doc' or die "Couldn't
chdir: $";
> $some_dir = "software";
my $some_dir = 'software';
> opendir(DIR, $some_dir) or die "Can't open directory";
opendir DIR, $some_dir or die "Can't open directory $some_dir: $!";
> while (defined($filename = readdir(DIR)))
Have you read the documentation for readdir?
If you're planning to filetest the return values out of a
"readdir", you'd better prepend the directory in question.
Otherwise, because we didn't "chdir" there, it would have been
testing the wrong file.
> {
> $st = stat($filename) or die "Can't stat file $filename: $!";
my $st = stat $filename or die "Can't stat file $filename: $!";
> print $filename . " " . $st->mode . "\n";
> }
> closedir(DIR)
--
A. Sinan Unur
1usa@llenroc.ude (reverse each component for email address)
------------------------------
Date: Wed, 26 May 2004 19:26:53 -0700
From: Joe Cosby <http://joecosby.com/code/mail.pl>
Subject: Re: Stat() function fails?
Message-Id: <25kab0p08serahc7uplnr6qp364gumipm8@4ax.com>
On Thu, 27 May 2004 01:26:05 -0000, "gnari" <gnari@simnet.is> wrote:
>"Joe Cosby" <http://joecosby.com/code/mail.pl> wrote in message
>news:0jfab05uf6gi8c8ufr0mp3rppgfrt91sq3@4ax.com...
>
>[snip problem involving readdir()]
>
>just show us a minimal program that shows this behaviour.
>
>the usual gotcha with readdir() is that it returns a list of leaf
>filenames, and people forget to apply the full path when using
>them in IO operations.
>
>you imply that you have not fallen into this trap, but we will
>believe it when we see code.
Thanks for both responses, I tried appending the full path at an
earlier point (although it -seemed- that shouldn't be necessary
because I had chdir()'d), this is a version with the full path added
to $filename:
(start of script)
use File::stat;
chdir 'C:\\My Documents\\DR\\fm docs\\NetComDocs\\user\\doc' || die
"Couldn't chdir";
$pathroot = 'C:\\My Documents\\DR\\fm docs\\NetComDocs\\user\\doc\\';
$some_dir = "software";
opendir(DIR, $some_dir) or die "Can't open directory";
while (defined($filename = readdir(DIR)))
{
$filename = $pathroot . $filename;
$st = stat($filename) or die "Can't stat file $filename: $!";
print $filename . " " . $st->mode . "\n";
}
closedir(DIR)
(end of script)
This doesn't seem to work either, I get:
"C:\My Documents\projects\java dir walker>perl "C:\My
Documents\projects\perl dir walker\dirwalker.pl"
C:\My Documents\DR\fm docs\NetComDocs\user\doc\. 16895
C:\My Documents\DR\fm docs\NetComDocs\user\doc\.. 16895
Can't stat file C:\My Documents\DR\fm
docs\NetComDocs\user\doc\taxcalculator: at C:\My
Documents\projects\perl dir walker\dirwalker.pl line 11."
If anybody has time, could they verify this script on their own
system, if there isn't anything obviously wrong in the code?
It should run on another setup without too much work, changing the
chdir line, the $pathroot and $some_dir so they mapped to a directory
on your own system.
If it works on somebody else's setup and not mine I will probably give
up on this.
--
Joe Cosby
http://joecosby.com/
Ego. Id. "Bob".
------------------------------
Date: 27 May 2004 02:53:52 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude>
Subject: Re: Stat() function fails?
Message-Id: <Xns94F5E8EE1FB8Basu1cornelledu@132.236.56.8>
Joe Cosby <http://joecosby.com/code/mail.pl> wrote in
news:25kab0p08serahc7uplnr6qp364gumipm8@4ax.com:
> On Thu, 27 May 2004 01:26:05 -0000, "gnari" <gnari@simnet.is> wrote:
>
>>"Joe Cosby" <http://joecosby.com/code/mail.pl> wrote in message
>>news:0jfab05uf6gi8c8ufr0mp3rppgfrt91sq3@4ax.com...
>>
>>[snip problem involving readdir()]
>>
>>just show us a minimal program that shows this behaviour.
>>
>>the usual gotcha with readdir() is that it returns a list of leaf
>>filenames, and people forget to apply the full path when using
>>them in IO operations.
>>
>>you imply that you have not fallen into this trap, but we will
>>believe it when we see code.
>
> Thanks for both responses, I tried appending the full path at an
> earlier point (although it -seemed- that shouldn't be necessary
> because I had chdir()'d), this is a version with the full path added
> to $filename:
>
OK, I have to admit this is getting irritating. It looks like you have
not paid attention to any of the comments I made.
> (start of script)
> use File::stat;
>
> chdir 'C:\\My Documents\\DR\\fm docs\\NetComDocs\\user\\doc' || die
> "Couldn't chdir";
use strict;
use warnings;
my $pathroot = 'C:/My Documents/DR/fm docs/NetComDocs/user/doc';
chdir $pathroot or die "Couldn't chdir to $pathroot: $!";
> $some_dir = "software";
> opendir(DIR, $some_dir) or die "Can't open directory";
> while (defined($filename = readdir(DIR)))
You are reading the $some_dir directory in $pathroot.
> {
> $filename = $pathroot . $filename;
> $st = stat($filename) or die "Can't stat file $filename: $!";
Why are you not prepending $some_dir to the $filename?
stat("$pathroot/$some_dir/$filename")
or die "Can't stat file $pathroot/$some_dir/$filename: $!";
> If anybody has time, could they verify this script on their own
> system, if there isn't anything obviously wrong in the code?
There _is_ something obviously wrong with the code.
--
A. Sinan Unur
1usa@llenroc.ude (reverse each component for email address)
------------------------------
Date: Thu, 27 May 2004 03:47:10 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Stat() function fails?
Message-Id: <x7y8neh6pu.fsf@mail.sysarch.com>
>>>>> "ASU" == A Sinan Unur <1usa@llenroc.ude> writes:
ASU> chdir 'C:/My Documents/DR/fm docs/NetComDocs/user/doc' or die "Couldn't
ASU> chdir: $";
^s/"/!/
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 27 May 2004 04:03:34 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude>
Subject: Re: Stat() function fails?
Message-Id: <Xns94F69B493asu1cornelledu@132.236.56.8>
Uri Guttman <uri@stemsystems.com> wrote in
news:x7y8neh6pu.fsf@mail.sysarch.com:
>>>>>> "ASU" == A Sinan Unur <1usa@llenroc.ude> writes:
>
> ASU> chdir 'C:/My Documents/DR/fm docs/NetComDocs/user/doc' or die
> "Couldn't ASU> chdir: $";
> ^s/"/!/
Actually, that should be s/"/!"/
;-)
Sorry for the typo.
--
A. Sinan Unur
1usa@llenroc.ude (reverse each component for email address)
------------------------------
Date: Thu, 27 May 2004 01:25:58 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Templating system needs help
Message-Id: <x7d64qirtl.fsf@mail.sysarch.com>
>>>>> "TA" == Tore Aursand <tore@aursand.no> writes:
TA> $VAR1 = {
TA> '__ROOT__' => {
TA> 'children' => [
TA> {
TA> 'name' => 'WEEK_LIST',
TA> 'columns' => [ 'NR' ],
TA> 'values' => [
TA> [ '1' ],
TA> [ '2' ]
TA> ],
TA> 'children' => [
TA> {
TA> 'name' => 'DAY_LIST',
TA> 'columns' => [ 'DAY' ],
TA> 'values' => [
TA> [ '1' ],
TA> [ '2' ],
TA> [ '3' ],
TA> [ '4' ],
TA> [ '5' ],
TA> [ '6' ],
TA> [ '7' ],
TA> ]
TA> },
TA> <%% WEEK_LIST BEGIN %%>
TA> <%% NR %%>:<%% DAY_LIST BEGIN %%> <%% DAY %%><%% DAY_LIST END %%>
TA> <%% WEEK_LIST END %%>
TA> Thus - in the end - the following output should be created:
TA> 1: 1 2 3 4 5 6 7
TA> 2: 8 9 10 11 12 13 14
TA> Now. I have absolutely _no_ idea on how to create this list (and take
TA> height for the fact that there can be unlimited nested lists). Anyone
TA> feel like they have the guts to try? :)
very recently i did something like this for a proof of concept. it is a
different way to look at templating but it fits your needs well. but the
code is at work so i will get it tomorrow. rather small and interesting
stuff as well.
the concept is that you preprocess the templates and extract out the
'chunks' that are delimited by BEGIN/END (and they have a name). those
chunks are then substituted elsewhere in the file where you have a
special tag with the same name. this would be inside some string (i like
here docs) and can be munged by code. so this template:
sub expand_rows {
code_to_mung( <<ROW ) ;
%ROW%
ROW
return \$munged_rows ;
}
print <<TEMPLATE ;
blah <%ROW BEGIN sub=expand_rows%>asdfghjkl<%ROW END%>
<<TEMPLATE
would get expanded to:
sub expand_rows {
code_to_mung( <<ROW ) ;
asdfghjkl
ROW
return \$munged_rows ;
}
print <<TEMPLATE ;
blah ${ expand_rows() }
<<TEMPLATE
this way the code has direct access to the chunk it wants and it can
return an expanded chunk back into the main text. but the template
separates the code from the full text.
and that can be made recursive with a little more effort so it can
handle nested data easily.
i always passed in hashes that were already stuffed with data and you
have that already. all you need to do is write the code to do the row
stuff and that can be generic to a point. the basic template
preprocessing is generic and fairly easy to write (the code i have is
less than a page). it is very powerful and yet simple, just the way i
like to design stuff. :)
if i ever get into it again, i would make a module for it. it is just a
short experiment so far but it does work. the hard part was figuring out
how to pass row text to a sub for runtime expansion and yet keep it in
the main text. the callback from a ${} was the key as well as moving the
chunk to the actual code.
simple values can be just replaced with an access to the tree like:
blah<%FOO%>blah
becomes
blah$tree->{FOO}blah
and that can be improved to handle deeper trees or similar stuff.
so is cpan ready for ANOTHER template system? this separates code from
text (which i like) and doesn't invent a new mini-lang (like template
toolkit does). i dunno if it can handle all the possible complex
template needs but scalars, nesting and loops are done with little
effort.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
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 6613
***************************************