You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Gerald Richter <ri...@ecos.de> on 2001/01/29 11:50:40 UTC

Re: EmbperlObject: offline Windows usage

Hi Freddy,

sometime ago you send me a patch to make EmbperlObject work more correct on
Windows in offline mode. I have now found time to take a closer look at it
and build a modified version of your patch into EmbperlObject. I have just
commited it to the CVS. I would be happy, if you could download it and see
if it works for you as expected. (for infos how to download form the CVS see
"perldoc CVS.pod")

Let me know how it goes...

Gerald

-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------

----- Original Message -----
From: "Freddy Vulto" <fv...@fvu.myweb.nl>
To: <em...@perl.apache.org>
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: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
>
>
>


Re: EmbperlObject: offline Windows usage

Posted by Gerald Richter <ri...@ecos.de>.
>
> Using the latest 'EmbperlObject.pm,v 1.40 2001/01/29 10:43:55' from CVS, I
> can use EmbperlObject on Windows 98 without experiencing problems or
needing
> to make modifications.
>

Great!

> Thanks for patching :-).
>

Thanks for your patch and testing

Gerald



Re: EmbperlObject: offline Windows usage

Posted by Freddy Vulto <fv...@fvu.myweb.nl>.
Gerald,

Using the latest 'EmbperlObject.pm,v 1.40 2001/01/29 10:43:55' from CVS, I
can use EmbperlObject on Windows 98 without experiencing problems or needing
to make modifications.

Thanks for patching :-).

Freddy Vulto


----- Original Message -----
From: Gerald Richter <ri...@ecos.de>
To: Freddy Vulto <fv...@fvu.myweb.nl>; <em...@perl.apache.org>
Sent: Monday, January 29, 2001 11:50 AM
Subject: Re: EmbperlObject: offline Windows usage


> Hi Freddy,
>
> sometime ago you send me a patch to make EmbperlObject work more correct
on
> Windows in offline mode. I have now found time to take a closer look at it
> and build a modified version of your patch into EmbperlObject. I have just
> commited it to the CVS. I would be happy, if you could download it and see
> if it works for you as expected. (for infos how to download form the CVS
see
> "perldoc CVS.pod")
>
> Let me know how it goes...
>
> Gerald
>
> -------------------------------------------------------------
> Gerald Richter    ecos electronic communication services gmbh
> Internetconnect * Webserver/-design/-datenbanken * Consulting
>
> Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
> E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
> WWW:        http://www.ecos.de      Fax:      +49 6133 925152
> -------------------------------------------------------------