1 start include statements
9 my $path = $this -> {'path'};
10 my $name = $this -> {'name'};
12 $path = $this -> merge_path_and_name
( path
=> $path,
15 $path =~ s!([^\/]*)$!!;
18 $this -> {'path'} = $path;
19 $this -> {'name'} = $name;
27 if ( $Config{osname
} eq 'MSWin32' ) {
28 if( $name =~ /^\w\:[\\\/]/ ){
33 } else { # Assume OS == unix
47 $path =~ s!\\!\/!g; # Flip slashes
49 while( $path =~ /[^\/\
.]+\
/\.\.\// ){
50 $path =~ s![^\/\.]+\/\.\.\/!!g; # Remove relative dots
53 while( $path =~ m!^\/\.\.\/! ){
54 $path =~ s!^\/\.\.\/!\/!;
57 while( $path =~ m![^\.]\.\/! ){
58 $path =~ s!\.\/!\/!; # remove singel dots
61 while( $path =~ m!\/\/! ){
62 $path =~ s!\/\/!\/!; # remove double slashes
70 # {{{ merge_path_and_name
71 start merge_path_and_name
73 # path finding strategy:
75 # 1. If path is not given it is assumed to be the current working
76 # directory. If it is not absolute, it is assumed to be relative to
77 # the current working directory.
79 # 2. If filename is absolute and a path is given, compare them and
80 # warn if they differ.
82 # 3. If the filename is relative, merge it with the path.
84 # Step 1. Make the pathname absolute.
86 if ( $Config{osname
} eq 'MSWin32' ) {
87 unless ( $path =~ /^\w\:[\\\/]/ ) {
88 $path = getcwd
() . '/' . $path;
90 } else { # Assume os == unix
91 unless( $path =~ /^\// ) {
92 $path = getcwd
() . '/' . $path;
97 debug
-> warn( level
=> debug
::information
, message
=> "file : No path given, assuming $path" );
100 $path = $self -> clean_path
( path
=> $path );
102 $name = $self -> clean_path
( path
=> $name );
104 unless( $path =~ /\/$/ ) { # append trailing slash
112 if( $self -> is_absolute
( name
=> $name ) ){
113 unless( $path eq $tmp ){
114 debug
-> warn( level
=> debug
::warning
, message
=> "file : Path($path) differs from filename($name), using: $tmp" );
122 $merged_path = $self -> clean_path
( path
=> $path );
124 end merge_path_and_name
131 my $path = $self -> merge_path_and_name
( path
=> $self -> {'path'}, name
=> $parm );
133 $path =~ s!([^\/]*)$!!;
136 $self -> {'path'} = $path;
147 my $path = $self -> merge_path_and_name
( path
=> $parm, name
=> $self -> {'name'} );
149 $path =~ s!([^\/]*)$!!;
152 $self -> {'name'} = $name;
162 $full_name = $self -> {'path'} . $self -> {'name'};