Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: SSI Emulation Library

by chipmunk (Parson)
on Jan 13, 2001 at 21:06 UTC ( #51608=note: print w/ replies, xml ) Need Help??


in reply to SSI Emulation Library

Three points, after a quick scan through your code:

Using $^O =~ /win/ to detect Windows systems will fail to detect 'MSWin32' as a Windows system, and will falsely detect 'Darwin'. This was an issue for the CGI module on p5p recently; the recommended solution was $^O =~ /^MSWin/i.

Removing a trailing slash from a path can be done more easily with a regex than with substr:

$cwd = getcwd(); $path = $ENV{'DOCUMENT_ROOT'}; if ($^O =~ /^MSWin/i) { $cwd =~ s,\\$,,; $path =~ s,\\$,,; } else { $cwd =~ s,/$,,; $path =~ s,/$,,; }
However, / can be used as a directory separator in Perl on Windows, and there are other operating systems, besides Unix and Windows, and they don't all use slash or backslash as the directory separator. File::Spec would be a portable way of dealing with this issue.

Finally... Have you tested your code with HTML that contains multiple SSI directives on the same line?


Comment on Re: SSI Emulation Library
Select or Download Code
Re: Re: SSI Emulation Library
by EvanK (Chaplain) on Jan 14, 2001 at 12:15 UTC
    First off, thanks for pointing out the /win/ thing. And about the fore- and backslashes, I only designed it for windows and *nix, but I'll look into that...and I thought the while loop would take care of multiple directives in one line...

    ______________________________________________
    When I get a little money, I buy books. If I have any left over, I buy food and clothes. -Erasmus

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://51608]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2015-07-07 02:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (86 votes), past polls