Mailing List Archive

[Bricolage-General] patch to tweak bric_apachectl
Hi,

Here's a patch for bric_apachectl, against version 1.4.5.
I got caught out by it because it told me it couldn't find the bricolage
libraries when the error was in fact elsewhere.

The changes are:

* The 'unshift(@INC, ...)' was potentially putting a whole set of
colon-separated paths in as a single item, which wouldn't work
(I've changed it to just add the new item)

* Made $_ local when it's set, just for neatness.

* Changed the string eval to a block eval so that it gets compiled
at compile time.

* Added $@ to the error message, so that the user gets more information
if it isn't the most likely thing (can't find the libraries).


--- bin/bric_apachectl.orig Mon Aug 19 00:50:23 2002
+++ bin/bric_apachectl Thu Nov 21 14:14:56 2002
@@ -45,20 +48,24 @@
$ENV{BRICOLAGE_ROOT} ||= "/usr/local/bricolage";

# use $BRICOLAGE_ROOT/lib if exists
- $_ = catdir($ENV{BRICOLAGE_ROOT}, "lib");
- unshift(@INC, $ENV{PERL5LIB} = defined $ENV{PERL5LIB} ?
- "$ENV{PERL5LIB}:$_" : $_)
- if -e $_;
+ local $_ = catdir($ENV{BRICOLAGE_ROOT}, "lib");
+ if (-e $_) {
+ $ENV{PERL5LIB} = defined $ENV{PERL5LIB} ? "$ENV{PERL5LIB}:$_" : $_;
+ unshift @INC, $_;
+ }

# make sure Bric is found
- eval "use Bric";
- die <<'END' if $@;
+ eval { require Bric; Bric->import };
+ die <<"END" if $@;
######################################################################

-Cannot locate Bricolage libraries. Please set the environment
+Cannot load Bricolage libraries. Please set the environment
variable BRICOLAGE_ROOT to the location of your Bricolage
installation or set the environment variable PERL5LIB to the
directory where Bricolage's libraries are installed.
+
+The specific error encountered was as follows:
+$@

######################################################################
END


--
Geoff Richards - GBdirect - http://development.gbdirect.co.uk/


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Bricolage-General mailing list
Bricolage-General@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bricolage-general
Re: [Bricolage-General] patch to tweak bric_apachectl [ In reply to ]
On Thursday, November 21, 2002, at 06:42 AM, Geoff Richards wrote:

> Here's a patch for bric_apachectl, against version 1.4.5.
> I got caught out by it because it told me it couldn't find the
> bricolage
> libraries when the error was in fact elsewhere.

Right, good catch. Thanks.

> The changes are:
>
> * The 'unshift(@INC, ...)' was potentially putting a whole set of
> colon-separated paths in as a single item, which wouldn't work
> (I've changed it to just add the new item)

Makes sense.

> * Made $_ local when it's set, just for neatness.

I've changed this to a my variable.

> * Changed the string eval to a block eval so that it gets compiled
> at compile time.

Well, since it's in a BEGIN block, it was happening at compile-time,
anyway. But I agree that this is more sensible. The call to
Bric->import isn't actually necessary, though.

> * Added $@ to the error message, so that the user gets more
> information
> if it isn't the most likely thing (can't find the libraries).

Great, thanks!

I'll apply this with my tweaks, and roll it into the other scripts, too.

Regards,

David

--
David Wheeler AIM: dwTheory
david@wheeler.net ICQ: 15726394
http://david.wheeler.net/ Yahoo!: dew7e
Jabber: Theory@jabber.org



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Bricolage-General mailing list
Bricolage-General@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bricolage-general