perl - How to resolve issues with accessing paths containing @ in directory name -


wa=/perl/temp@23 (env param)      if (defined $env{'wa'}) {         $env{'ac'} = "$env{'wa'}/right";     }     eval(qq|use lib "$env{'ac'}/lib"|); 

error-- possible unintended interpolation of @23 in string @ (eval 1) line 1.

i tried below solutions , none of them of great help.

attempt 1: didn't work

$env{'wa'} =~ s/(^.*)@(.*)/$1\@$2/; if (defined $env{'wa'}) {     $env{'ac'} = "$env{'wa'}/right"; } eval(qq|use lib "$env{'ac'}/lib"|); 

i saw 1 more issue this. when worked once..no clue why , how worked,but lib not added @inc path.

attempt 2: didn't work - saw in post \x40 represents @

$env{'wa'} =~ s/(^.*)@(.*)/$1\x40$2/; if (defined $env{'wa'}) {     $env{'ac'} = "$env{'wa'}/right"; } eval(qq|use lib "$env{'ac'}/lib"|); 

attempt 3: 1 error next

$env{'wa'} =~ s/(^.*)(@)(.*)/$1\@$3/; if (defined $env{'wa'}) {     $env{'ac'} = "$env{'wa'}/right"; } $str = $env{'ac'}; eval(qq|use lib "$str/lib"|); use module 

error: can't locate module in @inc atleast don't unintended interpolation @

can give me pointers on how resolve issue.

why need string eval?

begin {     if (defined $env{wa}) {         $env{ac} = "$env{wa}/right";     } }  use lib "$env{ac}/lib"; 

or, if want set @inc if ac defined:

use if defined $env{ac},     lib => { no warnings 'uninitialized'; "$env{ac}/lib" }; 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -