Perl6-Pugs

 view release on metacpan or  search on metacpan

INSTALL  view on Meta::CPAN


ENVIRONMENT VARIABLES
---------------------

There are several environment variables that control pugs's build process.

You may use the GHC environment variable to set the ghc executable before 
you run "perl Makefile.PL", for example:

    export GHC=${HOME}/bin/ghc (bash)
    setenv GHC ${HOME}/bin/ghc (csh)
    
To control which optional subsystems are embedded in Pugs, set the 
PUGS_EMBED variable. For example: 
 
    export PUGS_EMBED="parrot noperl5" (bash)
    setenv PUGS_EMBED "parrot noperl5" (csh)

Perl5 is now embedded by default.  Use "noperl5" to disable.

To build with an embedded parrot interpreter, make sure the PUGS_EMBED 
variable contains "parrot", and set the PARROT_PATH variable to point to 
the directory in which you checked out the parrot source tree. For example:
 
    export PARROT_PATH=${HOME}/src/parrot (bash)
    setenv PARROT_PATH ${HOME}/src/parrot (csh)

MAKE TARGETS
------------

The default make target builds an optimized Pugs. This means that Pugs will
be slower to compile, but will run much faster. To disable this, run:
    
    make fast

To run the test suite with a pretty HTML matrix showing test results:

docs/talks/hw2005.tex  view on Meta::CPAN

    insert y "PATH" "/tmp"
\end{lstlisting}

Here both \code{x} and \code{y} must bind to a value of the \code{(HashTable
String String)} type; the \code{insert} for both of them refers to the same
function.  In contrast, the two lines below do different things in Perl 6:

\begin{lstlisting}
    # modify an in-memory storage
    %foo{"PATH"} = "/tmp";
    # calls setenv() to change the environment
    %ENV{"PATH"} = "/tmp";
\end{lstlisting}

Here the operation is polymorphic: Perl looks up the containers that
\code{\%foo} and \code{\%ENV} bind to, then check if they have associated
\emph{implementation objects}.  If they are, Perl then calls the \code{STORE}
method on them, passing the key and value as arguments.

There is a level of indirection between containers and implementation objects,
as the \code{tie} function can change a container's implementation at runtime.

misc/pX/Common/Regexp-Test-Perl5Tests/t/op/taint.t  view on Meta::CPAN


BEGIN { require './test.pl'; }
plan tests => 246;


$| = 1;

use vars qw($ipcsysv); # did we manage to load IPC::SysV?

BEGIN {
  if ($^O eq 'VMS' && !defined($Config{d_setenv})) {
      $ENV{PATH} = $ENV{PATH};
      $ENV{TERM} = $ENV{TERM} ne ''? $ENV{TERM} : 'dummy';
  }
  if ($Config{'extensions'} =~ /\bIPC\/SysV\b/
      && ($Config{d_shm} || $Config{d_msg})) {
      eval { require IPC::SysV };
      unless ($@) {
	  $ipcsysv++;
	  IPC::SysV->import(qw(IPC_PRIVATE IPC_RMID IPC_CREAT S_IRWXU IPC_NOWAIT));
      }

misc/pX/Common/Regexp-Test-Perl5Tests/t/op/taint.t  view on Meta::CPAN

                                 './perl'               ;
my @MoreEnv = qw/IFS CDPATH ENV BASH_ENV/;

if ($Is_VMS) {
    my (%old, $x);
    for $x ('DCL$PATH', @MoreEnv) {
	($old{$x}) = $ENV{$x} =~ /^(.*)$/ if exists $ENV{$x};
    }
    eval <<EndOfCleanup;
	END {
	    \$ENV{PATH} = '' if $Config{d_setenv};
	    warn "# Note: logical name 'PATH' may have been deleted\n";
	    \@ENV{keys %old} = values %old;
	}
EndOfCleanup
}

# Sources of taint:
#   The empty tainted value, for tainting strings
my $TAINT = substr($^X, 0, 0);
#   A tainted zero, useful for tainting numbers

src/Pugs/Embed/Perl5.hs  view on Meta::CPAN

    perl5_apply :: PerlSV -> PerlSV -> Ptr PerlSV -> PugsEnv -> CInt -> IO (Ptr PerlSV)
foreign import ccall "perl5_can"
    perl5_can :: PerlSV -> CString -> IO Bool
foreign import ccall "perl5_eval"
    perl5_eval :: CString -> PugsEnv -> CInt -> IO PerlSV
foreign import ccall "perl5_init"
    perl5_init :: CInt -> Ptr CString -> IO PerlInterpreter

foreign import ccall "pugs_getenv"
    pugs_getenv :: IO PugsEnv
foreign import ccall "pugs_setenv"
    pugs_setenv :: PugsEnv -> IO ()

foreign import ccall "pugs_SvToVal"
    pugs_SvToVal :: PerlSV -> IO PugsVal
foreign import ccall "pugs_MkValRef"
    pugs_MkValRef :: PugsVal -> CString -> IO PerlSV

initPerl5 :: String -> Maybe Env -> IO PerlInterpreter
initPerl5 str env = do
    withCString "-e" $ \prog -> withCString str $ \cstr -> do
        withArray [prog, prog, cstr] $ \argv -> do
            interp <- perl5_init 3 argv
            case env of
                Just val    -> pugs_setenv =<< mkEnv val
                Nothing     -> return ()
            modifyIORef _GlobalFinalizer (>> perl_free interp)
            return interp

mkVal :: Val -> IO PugsVal
mkVal x = do
    -- warn "Creating nonblessed stable pointer for " (showVal x)
    newStablePtr x

mkEnv :: Env -> IO PugsEnv

src/perl5/p5embed.c  view on Meta::CPAN

    SV *rv;
    SV *sv;
    void *old_env = pugs_getenv();
    int count, i;

    dSP;

    ENTER;
    SAVETMPS;

    pugs_setenv(env);

    PUSHMARK(SP);
    if (inv != NULL) {
        XPUSHs(inv);
    }
    for (arg = args; *arg != NULL; arg++) {
        XPUSHs(*arg);
    }
    PUTBACK;

src/perl5/p5embed.c  view on Meta::CPAN

        for (i=count; i>0; --i) {
            out[i] = newSVsv(POPs);
        }
        out[count+1] = NULL;
    }

    PUTBACK;
    FREETMPS;
    LEAVE;

    pugs_setenv(old_env);
    return out;
}

SV *
perl5_get_sv(const char *name)
{
    SV *sv = get_sv(name, 1);
    /* sv_dump(sv); */
    return sv;
}

src/perl5/p5embed.c  view on Meta::CPAN

SV *
perl5_eval(char *code, void *env, int cxt)
{
    dSP;
    SV* sv;
    void *old_env = pugs_getenv();

    ENTER;
    SAVETMPS;

    pugs_setenv(env);

    sv = newSVpv(code, 0);
#ifdef SvUTF8_on
    SvUTF8_on(sv);
#endif
    eval_sv(sv, cxt);
    SvREFCNT_dec(sv);

    SPAGAIN;
    sv = POPs;

src/perl5/p5embed.c  view on Meta::CPAN

    PUTBACK;

    if (SvTRUE(ERRSV)) {
        STRLEN n_a;
        fprintf(stderr, "Error eval perl5: \"%s\"\n*** %s\n", code, SvPV(ERRSV,n_a));
    }

    FREETMPS;
    LEAVE;

    pugs_setenv(old_env);
    return sv;
}

bool
perl5_can(SV *inv, char *subname)
{
    int rv;

    dSP;

src/perl5/pugsembed.c  view on Meta::CPAN

        }
    }

    return (sv);
}

Val *pugs_getenv ()
{
    SV** rv = hv_fetch(PL_modglobal, "PugsEnv", 7, 0);
    if (rv == NULL) {
        Perl_croak(aTHX_ "PugsEnv uninitialized; please call pugs_setenv() first. (hate software so much.)");
    }
    IV tmp = SvIV((SV*)SvRV(*rv));
    return ((Val *)tmp);
}

void pugs_setenv ( Val *env )
{
    if (env == NULL) { return; }

    SV *sv = newSV(0);
    sv_setref_pv(sv, "pugs", env);
    hv_store(PL_modglobal, "PugsEnv", 7, sv, 0);
}

src/perl5/pugsembed.h  view on Meta::CPAN

extern Val *pugs_MkSvRef  ( SV *sv );
extern SV  *pugs_ValToSv ( Val *val );
extern IV   pugs_ValToIv ( Val *val );
extern NV   pugs_ValToNv ( Val *val );
extern char *pugs_ValToPv ( Val *val );

Val *pugs_SvToVal ( SV *sv );
SV  *pugs_MkValRef ( Val *val, char *typeStr );

Val *pugs_getenv ();
void pugs_setenv ( Val *env );

util/cperl-mode.el  view on Meta::CPAN

  "Create a virtual manpage in Emacs from the Perl Online Documentation."
  (interactive)
  (require 'man)
  (let* ((pod2man-args (concat buffer-file-name " | nroff -man "))
	 (bufname (concat "Man " buffer-file-name))
	 (buffer (generate-new-buffer bufname)))
    (save-excursion
      (set-buffer buffer)
      (let ((process-environment (copy-sequence process-environment)))
        ;; Prevent any attempt to use display terminal fanciness.
        (setenv "TERM" "dumb")
        (set-process-sentinel
         (start-process pod2man-program buffer "sh" "-c"
                        (format (cperl-pod2man-build-command) pod2man-args))
         'Man-bgproc-sentinel)))))

;;; Updated version by him too
(defun cperl-build-manpage ()
  "Create a virtual manpage in Emacs from the POD in the file."
  (interactive)
  (require 'man)



( run in 1.408 second using v1.01-cache-2.11-cpan-6aa56a78535 )