Tobias Eichner wrote:
> I have created a Perl library that I want to use with my programs (via
> require). However the Perl library should be placed at a sub-folder of the
> working directory (the place where the program runs).
>
> For example:
>
> /my/custom/path/ is the location of the program
Jay Savage wrote:
On Tue, Jul 1, 2008 at 11:30 AM, Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote:
Thomas Bätzler wrote:
Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote:
Some would suggest the use of the FindBin module. It does the right
thing, but unfortunately it is known to be buggy.
Actually,
@Gunnar Hjalmarsson:
> To me it seems as there is no perfect method. As long as you invoke your
> program from command line, perhaps FindBin is the best choice. But since
> you are going to write CGI programs, FindBin's failure as regards
> mod_perl is not insignificant. Therefore I'd stick with
On Tue, Jul 1, 2008 at 11:30 AM, Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote:
> Thomas Bätzler wrote:
>>
>> Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote:
>>>
>>> Some would suggest the use of the FindBin module. It does the right
>>> thing, but unfortunately it is known to be buggy.
>>
>> Actually
Tobias Eichner wrote:
Giving it a closer look, I experience a strange behaviour. I'm using
ActiveState Perl on WinXp here.
The following script has been used for testing:
use File::Spec;
BEGIN
{
my ($volume,$softwaredir,$librarydir);
($volume,$softwaredir) = File::Spec->splitpath(
From: Tobias Eichner <[EMAIL PROTECTED]>
> @Gunnar Hjalmarsson:
>
> > use File::Spec;
> > my ($vol, $progdir);
> > BEGIN { ($vol, $progdir) = File::Spec->splitpath( __FILE__ ) }
> > use lib File::Spec->catpath( $vol, $progdir, 'libraries' );
>
> At http://perldoc.perl.org/perl
From: "Amit Saxena" <[EMAIL PROTECTED]>
> I still doubt whether
>
> * unshift (@INC,$librarydir);*
>
> works or not.
>
> To the best I have read the articles and tutorials, @INC can't be updated in
> this way.
Then you've read them wrong. Of course you can use unshift() on @INC,
you just have
@Gunnar Hjalmarsson:
> That code is executed at runtime, and hence lets you require() modules
> at runtime. If you want to use() a module instead, you need to make the
> code be executed at compile time. You can do that by putting the code in
> a BEGIN block.
Thanks for noting. I've considered
Tobias Eichner wrote:
I wrote the following script that fits my needs; maybe someone finds
it useful, maybe someone finds an error in it (if so, let me know - I
tested it on OS X and Win XP):
use File::Spec;
my ($volume,$softwaredir,$librarydir);
($volume,$softwaredir) = File::Spec->splitpath
Amit Saxena wrote:
I still doubt whether
* unshift (@INC,$librarydir);*
works or not.
To the best I have read the articles and tutorials, @INC can't be updated in
this way.
Where did you read that?
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-ma
Giving it a closer look, I experience a strange behaviour. I'm using
ActiveState Perl on WinXp here.
The following script has been used for testing:
use File::Spec;
BEGIN
{
my ($volume,$softwaredir,$librarydir);
($volume,$softwaredir) = File::Spec->splitpath(__FILE__);
$libraryd
> * unshift (@INC,$librarydir);*
...
> To the best I have read the articles and tutorials, @INC can't be updated in
> this way.
What I read about is that paths can't be deleted easily from @INC, but I haven'
tried it yet (since I don't see an application deleting a path that others have
set at @
Hi
I still doubt whether
* unshift (@INC,$librarydir);*
works or not.
To the best I have read the articles and tutorials, @INC can't be updated in
this way.
You have to either use one of the options below :-
- *PERL5LIB* environment variable
- using *use lib ("")* construct
- use *Fi
I wrote the following script that fits my needs; maybe someone finds it useful,
maybe someone finds an error in it (if so, let me know - I tested it on OS X
and Win XP):
use File::Spec;
my ($volume,$softwaredir,$librarydir);
($volume,$softwaredir) = File::Spec->splitpath(__FILE__);
$librarydir
Tobias Eichner wrote:
@Gunnar Hjalmarsson:
use File::Spec;
my ($vol, $progdir);
BEGIN { ($vol, $progdir) = File::Spec->splitpath( __FILE__ ) }
use lib File::Spec->catpath( $vol, $progdir, 'libraries' );
At http://perldoc.perl.org/perldata.html it is stated that __FILE__
c
@Gunnar Hjalmarsson:
> use File::Spec;
> my ($vol, $progdir);
> BEGIN { ($vol, $progdir) = File::Spec->splitpath( __FILE__ ) }
> use lib File::Spec->catpath( $vol, $progdir, 'libraries' );
At http://perldoc.perl.org/perldata.html it is stated that __FILE__ contains
the curren
Tobias Eichner wrote:
Gunnar Hjalmarsson wrote:
Both those methods assume that the path to the directory where the
program resides equals the current working directory. That's often
the case, but not always.
Isn't the "working directory" always the path where the program
executes from ?
No
Thomas Bätzler wrote:
Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote:
Some would suggest the use of the FindBin module. It does the
right thing, but unfortunately it is known to be buggy.
Actually, I wish more modules were as "buggy" as FindBin ;-)
I.e. that they would work robustly for all of
Tobias Eichner wrote:
>
> I have created a Perl library that I want to use with my programs (via
> require). However the Perl library should be placed at a sub-folder of the
> working directory (the place where the program runs).
>
> For example:
>
> /my/custom/path/ is the location of the progra
Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote:
> Some would suggest the use of the FindBin module. It does the
> right thing, but unfortunately it is known to be buggy.
Actually, I wish more modules were as "buggy" as FindBin ;-)
I.e. that they would work robustly for all of the common usage
case
Tobias Eichner <[EMAIL PROTECTED]> wrote:
> I have created a Perl library that I want to use with my
> programs (via require). However the Perl library should be
> placed at a sub-folder of the working directory (the place
> where the program runs).
>
> For example:
>
> /my/custom/path/ is the
PERL5LIB is no choice, since there would be the same issue of how to write
paths a cross-platform way.
> Both those methods assume that the path to the directory where the
> program resides equals the current working directory. That's often the
> case, but not always.
Isn't the "working direct
You can also set the environment variable PERL5LIB to whatever directory
that contains your
custom library files.
Regards,
Amit Saxena
On Tue, Jul 1, 2008 at 6:32 PM, Gunnar Hjalmarsson <[EMAIL PROTECTED]>
wrote:
> Tobias Eichner wrote:
>
>> I have created a Perl library that I want to use with
Tobias Eichner wrote:
I have created a Perl library that I want to use with my programs
(via require). However the Perl library should be placed at a
sub-folder of the working directory (the place where the program
runs).
For example:
/my/custom/path/ is the location of the program.
/my/custom/
I have created a Perl library that I want to use with my programs (via
require). However the Perl library should be placed at a sub-folder of the
working directory (the place where the program runs).
For example:
/my/custom/path/ is the location of the program.
/my/custom/path/libraries/ is the
25 matches
Mail list logo