bash's pushd (and to list, dirs command) seems to track as a LIFO, the specified path to perceived pwd - i.e., the path actually used via series of cds (the only information that can solve this problem of state*). Cwd::Ext appears to do something similar. Unfortunately, there are no useful modules for you to leverage this behavior of pushd via bash. Maybe a useful module to create would be Bash::Pushd::Pwd or something like that.

* See Hysteresis, Path dependence


In reply to Re: Getting the absolute path of a script, without PWD by perlfan
in thread Getting the shell's version of working directory, without PWD's help by perlancar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":