Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • A dnslookup on wagner.elixus.org is failing, it looks like ns2.elixus.org and ns1.elixus.org are both timing out. :-(
    • Weird, it works for me... Anyway here it is.
      ----------------------------------------------------------------------
      r13201 (orig r1987):  schwern | 2005-04-15 18:39:03 +0800

      First stab at $*CWD

      ----------------------------------------------------------------------
      === mirror/pugs/src/AST.hs
      ======================================================== ==========
      --- mirror/pugs/src/AST.hs  (revision 13200)
      +++ mirror/pugs/src/AST.hs  (revision 13201)
      @@ -1091,6 +1091,15 @@
           fetch = return . maybe undef id
           store _ v = retConstError v

      +instance Scalar.Class IScalarCwd where
      +    iType _ = "Scalar::Cwd"
      +    fetch _ = do
      +        str <- liftIO $ getCurrentDirectory
      +    return $ VStr str
      +    store _ val = do
      +        str <- fromVal val
      +    liftIO $ setCurrentDirectory str
      +
      instance Scalar.Class VScalar where
           iType _ = "Scalar::Const"
           fetch = return
      @@ -1122,6 +1131,7 @@
      type IScalar = IORef Val
      type ICode   = IORef VCode
      data IHashEnv deriving (Typeable) -- phantom types! fun!
      +data IScalarCwd deriving (Typeable) -- phantom types! fun!
      type IScalarProxy = (Eval VScalar, (VScalar -> Eval ()))
      type IScalarLazy = Maybe VScalar

      === mirror/pugs/src/Run.hs
      ======================================================== ==========
      --- mirror/pugs/src/Run.hs  (revision 13200)
      +++ mirror/pugs/src/Run.hs  (revision 13201)
      @@ -102,6 +102,7 @@
               , SymVar SGlobal "$!"           $ MkRef errSV
               , SymVar SGlobal "$/"           $ MkRef matchAV
               , SymVar SGlobal "%*ENV"        $ hashRef (undefined :: IHashEnv)
      +    , SymVar SGlobal "$*CWD"        $ scalarRef (undefined :: IScalarCwd)
               -- XXX What would this even do?
               -- , SymVar SGlobal "%=POD"        (Val . VHash $ emptyHV)
               , SymVar SGlobal "@=POD"        $ MkRef $ constArray []
      === mirror/pugs/t/unspecced/cwd.t
      ================================================= =================
      --- mirror/pugs/t/unspecced/cwd.t  (revision 13200)
      +++ mirror/pugs/t/unspecced/cwd.t  (revision 13201)
      @@ -0,0 +1,14 @@
      +#!/usr/bin/pugs
      +
      +use v6;
      +require Test;
      +
      +plan 2;
      +
      +ok( grep { $_ eq 'LICENSE' }, readdir $*CWD );
      +$*CWD ~= 't/unspecced';
      +ok( grep { $_ eq 'cwd.t' }, readdir $*CWD );
      +
      +
      +skip("error handling not implemented");
      +#is( ($*CWD = 'I/do/not/exist'), undef );