Hi,
your addtions makes sense to me. The only thing to worry about may be the
performance. I don't know how expensive your addtions are. I will take a
further look at it, after I have released 1.3 (which I plan for next week)
and your addtions will go to 1.3.1b1.
Gerald
-------------------------------------------------------------
Gerald Richter ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting
Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: [EMAIL PROTECTED] Voice: +49 6133 925131
WWW: http://www.ecos.de Fax: +49 6133 925152
-------------------------------------------------------------
----- Original Message -----
From: "Freddy Vulto" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 23, 2000 10:50 PM
Subject: EmbperlObject: offline Windows usage
> When trying to use Embperl 1.3b7 offline with DjGpp on Windows 98 I ran
into
> some problems, mainly because the directory comparison was done case
> sensitive, while the Windows filesystem is case tolerant, and because
> EmbperlObject doesn't take into account the volume/drive part of a
filename.
> Also, the ADDPATH code used ':' to separate paths. This should be ';' -
as
> stated in the EmbperlObject documentation - because ':' is used as the
> volume separator in Windows. Furthermore, I encountered some problems,
> using EmbperlObject with relative paths.
>
> I applied the following changes in order to make EmbperlObject.pm work for
> me:
> - within the 'Execute' sub, used the 'norm_path' sub for *every* path/file
> argument to EmbperlObject. This ensures each path/file argument to have
> the same notation, causing the directory comparisons to make sense on
> case tolerant file systems.
> - modified 'norm_path' to turn relative paths into absolute paths, using
> volumes as well.
> - modified 'norm_path' to turn paths to uppercase for case tolerant file
> systems.
>
> Can these changes be useful for a future version? I didn't test the
> modifications on a UNIX system or in 'online' Embperl mode though. The
> modified EmbperlObject.pm can be looked at from:
>
> http://fvu.myweb.nl/Tmp/EmbperlObject.pm
>
>
> Main changes are a modified norm_path:
>
>
>
############################################################################
> #
> #
> # Normalize path into filesystem
> #
> # in $path: path to normalize
> # $volumeDefault: default current volume to prefix to path
> # ret normalized path
> #
>
> sub norm_path {
> my ($path, $volumeDefault) = @_;
> my $result;
> # Path is specified?
> if ($result = $path) {
> # Yes, path is specified;
> # Is path relative?
> if (!File::Spec->file_name_is_absolute($result)) {
> # Yes, path is relative;
> # Make path absolute
> $result = File::Spec->rel2abs($result);
> }
> # Split path
> my ($volume, $directories, $file) = File::Spec->splitpath(
> $result, (-d $result)
> );
> # Default volume is specified?
> if ($volumeDefault) {
> # Yes, default volume is specified;
> # Does path contain a volume?
> if (!$volume) {
> # No, path doesn't contain a volume;
> # Use default volume
> $volume = $volumeDefault;
> }
> }
> # Re-assemble path
> $result = File::Spec->catpath($volume, $directories, $file);
> # If filesystem case tolerant?
> if (File::Spec->case_tolerant) {
> # Yes, filesystem is case tolerant;
> # Use all uppercase
> $result = uc($result);
> }
>
> $result = File::Spec->canonpath($result);
> $result =~ s/\\/\//g ;
> $result = $1 if ($result =~ /^\s*(.*?)\s*$/) ;
> }
> }
>
>
> and this modified portion of the 'Execute' statement:
>
>
> ...
> my $addpath = $req->{object_addpath} ;
> my @addpath = $addpath ? split (/;/, $addpath) : ();
>
> my ($volume, $volumeCurrent, $volumeFile, $nameFile);
> my ($directory, $directoryCurrent, $directoryFile);
>
> # Determine volume & directory
>
> # Split inputfile
> ($volumeFile, $directoryFile, $nameFile) = File::Spec->splitpath(
> $filename, (-d $filename)
> );
> ($volumeCurrent, $directoryCurrent) = File::Spec->splitpath(
> Cwd->getcwd(), 1
> );
> # Use current volume if inputfile doesn't have volume specified
> $volume = $volumeFile ? $volumeFile : $volumeCurrent;
> # Use current directory if inputfile doesn't have directory specified
> $directory = $directoryFile ? $directoryFile : $directoryCurrent;
>
> # Re-assemble filename, making sure it's absolute
> $filename = File::Spec->catpath($volume, $directory, $nameFile);
> # Add volume to directory
> $directory = norm_path($directory, $volume);
> my $rootDir = norm_path(File::Spec->rootdir, $volume);
> my $docRootDir = norm_path($r ? $r->document_root : $rootDir, $volume);
> my $stopDir = norm_path ($req -> {object_stopdir}, $volume);
> my $debug = $req -> {debug} & HTML::Embperl::dbgObjectSearch ;
> ...
>
>
> Gr, Freddy Vulto
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]