perl

 view release on metacpan or  search on metacpan

cpan/Config-Perl-V/t/28_plv52201w.t  view on Meta::CPAN

    cc='gcc', ccflags =' -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE  -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fwrapv -fno-strict-aliasing -mms-bitfields',
    optimize='-s -O2',
    cppflags='-DWIN32'
    ccversion='', gccversion='4.9.2', gccosandvers=''
    intsize=4, longsize=4, ptrsize=8, doublesize=8, byteorder=12345678, doublekind=3
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8, longdblkind=3
    ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='long long', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='g++', ldflags ='-s -L"D:\Strawberry\perl\lib\CORE" -L"D:\Strawberry\c\lib"'
    libpth=D:\Strawberry\c\lib D:\Strawberry\c\x86_64-w64-mingw32\lib D:\Strawberry\c\lib\gcc\x86_64-w64-mingw32\4.9.2
    libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32
 -lcomctl32
    perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbc
cp32 -lcomctl32
    libc=, so=dll, useshrplib=true, libperl=libperl522.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=xs.dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-mdll -s -L"D:\Strawberry\perl\lib\CORE" -L"D:\Strawberry\c\lib"'

cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist.pm  view on Meta::CPAN

When using GCC, that entry specifies that MakeMaker should first look
for C<libgl.a> (followed by C<gl.a>) in all the locations specified by
C<$Config{libpth}>.

When using a compiler other than GCC, the above entry will search for
C<gl.lib> (followed by C<libgl.lib>).

If the library happens to be in a location not in C<$Config{libpth}>,
you need:

        LIBS => ['-Lc:\gllibs -lgl']

Here is a less often used example:

        LIBS => ['-lgl', ':nosearch -Ld:\mesalibs -lmesa -luser32']

This specifies a search for library C<gl> as before.  If that search
fails to find the library, it looks at the next item in the list. The
C<:nosearch> flag will prevent searching for the libraries that follow,
so it simply returns the value as C<-Ld:\mesalibs -lmesa -luser32>,
since GCC can use that value as is with its linker.

cpan/Pod-Simple/lib/Pod/Simple/RTF.pm  view on Meta::CPAN


sub doc_init {
   return <<'END';
{\rtf1\ansi\deff0

END
}

sub color_table {
   return <<'END';
{\colortbl;\red255\green0\blue0;\red0\green0\blue255;}
END
}


sub doc_info {
   my $self = $_[0];

   my $class = ref($self) || $self;

   my $tag = __PACKAGE__ . ' ' . $VERSION;

cpan/Pod-Simple/t/rtf_utf8.t  view on Meta::CPAN

{\*\cs26 \additive \f1\lang1024\noproof\sbasedon25 pod-codelbock-ital;}
{\*\cs27 \additive \f1\lang1024\noproof\sbasedon25 pod-codelbock-bold;}
{\*\cs28 \additive \f1\lang1024\noproof\sbasedon25 pod-codelbock-bold-ital;}

{\s31\ql \keepn\sb90\sa180\f2\fs32\ul\sbasedon0 \snext0 pod-head1;}
{\s32\ql \keepn\sb90\sa180\f2\fs28\ul\sbasedon0 \snext0 pod-head2;}
{\s33\ql \keepn\sb90\sa180\f2\fs25\ul\sbasedon0 \snext0 pod-head3;}
{\s34\ql \keepn\sb90\sa180\f2\fs22\ul\sbasedon0 \snext0 pod-head4;}
}

{\colortbl;\red255\green0\blue0;\red0\green0\blue255;}
{VARIANT TEXT DELETED{\company [see doc]}{\operator [see doc]}
}

\deflang1033\plain\lang1033\widowctrl
{\header\pard\qr\plain\f2\fs17
W\uc1\u346?R\'d3D NOCNEJ CISZY \_\_ explicitly utf8 test document in Polish, 
p.\chpgn\par}
\fs25


cpan/Test-Simple/t/Test2/behavior/trace_signature.t  view on Meta::CPAN

    }->();
};

my $sigpass = $events->[0]->trace->signature;
my $sigfail = $events->[1]->trace->signature;

ok($sigpass ne $sigfail, "Each tool got a new signature");

is($events->[$_]->trace->signature, $sigfail, "Diags share failed ok's signature") for 2 .. $#$events;

like($sigpass, qr/$$~${ \get_tid() }~\d+~\d+:$$:\Q${ \get_tid() }:${ \__FILE__ }:$line\E$/, "signature is sane");

my $trace = Test2::EventFacet::Trace->new(frame => ['main', 'foo.t', 42, 'xxx']);
delete $trace->{cid};
is($trace->signature, undef, "No signature without a cid");

is($events->[0]->related($events->[1]), 0, "event 0 is not related to event 1");
is($events->[1]->related($events->[2]), 1, "event 1 is related to event 2");

my $e = Test2::Event::Ok->new(pass => 1);
is($e->related($events->[0]), undef, "Cannot check relation, invalid trace");

cpan/perlfaq/lib/perlfaq4.pod  view on Meta::CPAN


This won't expand C<"\n"> or C<"\t"> or any other special escapes.

=head2 How do I remove consecutive pairs of characters?

(contributed by brian d foy)

You can use the substitution operator to find pairs of characters (or
runs of characters) and replace them with a single instance. In this
substitution, we find a character in C<(.)>. The memory parentheses
store the matched character in the back-reference C<\g1> and we use
that to require that the same thing immediately follow it. We replace
that part of the string with the character in C<$1>.

    s/(.)\g1/$1/g;

We can also use the transliteration operator, C<tr///>. In this
example, the search list side of our C<tr///> contains nothing, but
the C<c> option complements that so it contains everything. The
replacement list also contains nothing, so the transliteration is
almost a no-op since it won't do any replacements (or more exactly,
replace the character with itself). However, the C<s> option squashes
duplicated and consecutive characters in the string so a character
does not show up next to itself

ext/File-Glob/t/case.t  view on Meta::CPAN

@a = csh_glob($pat);
is(scalar @a, 0, 'None should be uppercase');

@a = bsd_glob($pat, GLOB_NOCASE);
cmp_ok(scalar @a, '>=', 3, 'explicit use of the GLOB_NOCASE flag');

# Test Win32 backslash nastiness...
SKIP: {
    skip 'Not Win32', 3 unless $^O eq 'MSWin32';

    @a = File::Glob::bsd_glob("op\\g*.t");
    cmp_ok(scalar @a, '>=', 8);
    mkdir "[]", 0;
    @a = File::Glob::bsd_glob("\\[\\]", GLOB_QUOTE);
    rmdir "[]";
    is(scalar @a, 1);
    @a = bsd_glob("op\\*", GLOB_QUOTE);
    isnt(scalar @a, 0);
}

pod/perl5100delta.pod  view on Meta::CPAN

quantifiers. (Yves Orton)

=item Backtracking control verbs

The regex engine now supports a number of special-purpose backtrack
control verbs: (*THEN), (*PRUNE), (*MARK), (*SKIP), (*COMMIT), (*FAIL)
and (*ACCEPT). See L<perlre> for their descriptions. (Yves Orton)

=item Relative backreferences

A new syntax C<\g{N}> or C<\gN> where "N" is a decimal integer allows a
safer form of back-reference notation as well as allowing relative
backreferences. This should make it easier to generate and embed patterns
that contain backreferences. See L<perlre/"Capture buffers">. (Yves Orton)

=item C<\K> escape

The functionality of Jeff Pinyan's module Regexp::Keep has been added to
the core. In regular expressions you can now use the special escape C<\K>
as a way to do something like floating length positive lookbehind. It is
also useful in substitutions like:

pod/perl5340delta.pod  view on Meta::CPAN

like C<m/x{,3}/> meaning C<m/x{0,3}/>

=cut


=head2 Blanks freely allowed within but adjacent to curly braces

(in double-quotish contexts and regular expression patterns)

This means you can write things like S<C<\x{ FFFC }>> if you like.  This
applies to all such constructs, namely C<\b{}>, C<\g{}>, C<\k{}>,
C<\N{}>, C<\o{}>, and C<\x{}>; as well as the regular expression
quantifier C<{I<m>,I<n>}>.  C<\p{}> and C<\P{}> retain their
already-existing, even looser, rules mandated by the Unicode standard
(see L<perluniprops/Properties accessible through \p{} and \P{}>).

This ability is in effect regardless of the presence of the C</x>
regular expression pattern modifier.

Additionally, the comma in a regular expression braced quantifier may
have blanks (tabs or spaces) before and/or after the comma, like

pod/perlcheat.pod  view on Meta::CPAN

                  /o compile pat once   ()     capture
  DEBUG                                 (?:p)  no capture
  -MO=Deparse     REGEX CHARCLASSES     (?#t)  comment
  -MO=Terse       .   [^\n]             (?=p)  ZW pos ahead
  -D##            \s  whitespace        (?!p)  ZW neg ahead
  -d:Trace        \w  word chars        (?<=p) ZW pos behind \K
                  \d  digits            (?<!p) ZW neg behind
  CONFIGURATION   \pP named property    (?>p)  no backtrack
  perl -V:ivsize  \h  horiz.wh.space    (?|p|p)branch reset
                  \R  linebreak         (?<n>p)named capture
                  \S \W \D \H negate    \g{n}  ref to named cap
                                        \K     keep left part
  FUNCTION RETURN LISTS
  stat      localtime    caller         SPECIAL VARIABLES
   0 dev    0 second      0 package     $_    default variable
   1 ino    1 minute      1 filename    $0    program name
   2 mode   2 hour        2 line        $/    input separator
   3 nlink  3 day         3 subroutine  $\    output separator
   4 uid    4 month-1     4 hasargs     $|    autoflush
   5 gid    5 year-1900   5 wantarray   $!    sys/libcall error
   6 rdev   6 weekday     6 evaltext    $@    eval error

pod/perldiag.pod  view on Meta::CPAN

(W misc) You have attempted to weaken a reference that is already weak.
Doing so has no effect.

=item Reference is not weak

(W misc) You have attempted to unweaken a reference that is not weak.
Doing so has no effect.

=item Reference to invalid group 0 in regex; marked by S<<-- HERE> in m/%s/

(F) You used C<\g0> or similar in a regular expression.  You may refer
to capturing parentheses only with strictly positive integers
(normal backreferences) or with strictly negative integers (relative
backreferences).  Using 0 does not make sense.

=item Reference to nonexistent group in regex; marked by S<<-- HERE> in
m/%s/

(F) You used something like C<\7> in your regular expression, but there are
not at least seven sets of capturing parentheses in the expression.  If
you wanted to have the character with ordinal 7 inserted into the regular

pod/perlre.pod  view on Meta::CPAN

 \L          lowercase until \E (think vi)
 \U          uppercase until \E (think vi)
 \Q          quote (disable) pattern metacharacters until \E
 \E          end either case modification or quoted section, think vi

Details are in L<perlop/Quote and Quote-like Operators>.

=head3 Character Classes and other Special Escapes

In addition, Perl defines the following:
X<\g> X<\k> X<\K> X<backreference>

 Sequence   Note    Description
  [...]     [1]  Match a character according to the rules of the
                   bracketed character class defined by the "...".
                   Example: [a-z] matches "a" or "b" or "c" ... or "z"
  [[:...:]] [2]  Match a character according to the rules of the POSIX
                   character class "..." within the outer bracketed
                   character class.  Example: [[:upper:]] matches any
                   uppercase character.
  (?[...])  [8]  Extended bracketed character class

pod/perlrebackslash.pod  view on Meta::CPAN

 \A                Beginning of string.  Not in [].
 \b{}, \b          Boundary. (\b is a backspace in []).
 \B{}, \B          Not a boundary.  Not in [].
 \cX               Control-X.
 \d                Match any digit character.
 \D                Match any character that isn't a digit.
 \e                Escape character.
 \E                Turn off \Q, \L and \U processing.  Not in [].
 \f                Form feed.
 \F                Foldcase till \E.  Not in [].
 \g{}, \g1         Named, absolute or relative backreference.
                   Not in [].
 \G                Pos assertion.  Not in [].
 \h                Match any horizontal whitespace character.
 \H                Match any character that isn't horizontal whitespace.
 \k{}, \k<>, \k''  Named backreference.  Not in [].
 \K                Keep the stuff left of \K.  Not in [].
 \l                Lowercase next character.  Not in [].
 \L                Lowercase till \E.  Not in [].
 \n                (Logical) newline character.
 \N                Match any character but newline.  Not in [].

pod/perlretut.pod  view on Meta::CPAN

For convenience, Perl sets C<$+> to the string held by the highest numbered
C<$1>, C<$2>,... that got assigned (and, somewhat related, C<$^N> to the
value of the C<$1>, C<$2>,... most-recently assigned; I<i.e.> the C<$1>,
C<$2>,... associated with the rightmost closing parenthesis used in the
match).


=head2 Backreferences

Closely associated with the matching variables C<$1>, C<$2>, ... are
the I<backreferences> C<\g1>, C<\g2>,...  Backreferences are simply
matching variables that can be used I<inside> a regexp.  This is a
really nice feature; what matches later in a regexp is made to depend on
what matched earlier in the regexp.  Suppose we wanted to look
for doubled words in a text, like "the the".  The following regexp finds
all 3-letter doubles with a space in between:

    /\b(\w\w\w)\s\g1\b/;

The grouping assigns a value to C<\g1>, so that the same 3-letter sequence
is used for both parts.

A similar task is to find words consisting of two identical parts:

    % simple_grep '^(\w\w\w\w|\w\w\w|\w\w|\w)\g1$' /usr/dict/words
    beriberi
    booboo
    coco
    mama
    murmur
    papa

The regexp has a single grouping which considers 4-letter
combinations, then 3-letter combinations, I<etc>., and uses C<\g1> to look for
a repeat.  Although C<$1> and C<\g1> represent the same thing, care should be
taken to use matched variables C<$1>, C<$2>,... only I<outside> a regexp
and backreferences C<\g1>, C<\g2>,... only I<inside> a regexp; not doing
so may lead to surprising and unsatisfactory results.


=head2 Relative backreferences

Counting the opening parentheses to get the correct number for a
backreference is error-prone as soon as there is more than one
capturing group.  A more convenient technique became available
with Perl 5.10: relative backreferences. To refer to the immediately
preceding capture group one now may write C<\g-1> or C<\g{-1}>, the next but
last is available via C<\g-2> or C<\g{-2}>, and so on.

Another good reason in addition to readability and maintainability
for using relative backreferences is illustrated by the following example,
where a simple pattern for matching peculiar strings is used:

    $a99a = '([a-z])(\d)\g2\g1';   # matches a11a, g22g, x33x, etc.

Now that we have this pattern stored as a handy string, we might feel
tempted to use it as a part of some other pattern:

    $line = "code=e99e";
    if ($line =~ /^(\w+)=$a99a$/){   # unexpected behavior!
        print "$1 is valid\n";
    } else {
        print "bad line: '$line'\n";
    }

But this doesn't match, at least not the way one might expect. Only
after inserting the interpolated C<$a99a> and looking at the resulting
full text of the regexp is it obvious that the backreferences have
backfired. The subexpression C<(\w+)> has snatched number 1 and
demoted the groups in C<$a99a> by one rank. This can be avoided by
using relative backreferences:

    $a99a = '([a-z])(\d)\g{-1}\g{-2}';  # safe for being interpolated


=head2 Named backreferences

Perl 5.10 also introduced named capture groups and named backreferences.
To attach a name to a capturing group, you write either
C<< (?<name>...) >> or C<< (?'name'...) >>.  The backreference may
then be written as C<\g{name}>.  It is permissible to attach the
same name to more than one group, but then only the leftmost one of the
eponymous set can be referenced.  Outside of the pattern a named
capture group is accessible through the C<%+> hash.

Assuming that we have to match calendar dates which may be given in one
of the three formats yyyy-mm-dd, mm/dd/yyyy or dd.mm.yyyy, we can write
three suitable patterns where we use C<'d'>, C<'m'> and C<'y'> respectively as the
names of the groups capturing the pertaining components of a date. The
matching operation combines the three patterns as alternatives:

regcomp.c  view on Meta::CPAN

                break;
            }

            RETURN_FAIL_ON_RESTART_FLAGP(flagp);

            /* Here, evaluates to a single code point.  Go get that */
            RExC_parse_set(atom_parse_start);
            goto defchar;

        case 'k':    /* Handle \k<NAME> and \k'NAME' and \k{NAME} */
      parse_named_seq:  /* Also handle non-numeric \g{...} */
        {
            char ch;
            if (   RExC_parse >= RExC_end - 1
                || ((   ch = RExC_parse[1]) != '<'
                                      && ch != '\''
                                      && ch != '{'))
            {
                RExC_parse_inc_by(1);
                /* diag_listed_as: Sequence \%s... not terminated in regex; marked by <-- HERE in m/%s/ */
                vFAIL2("Sequence %.2s... not terminated", atom_parse_start);

t/op/lex.t  view on Meta::CPAN

    fresh_perl_is(
      qq'"ab}"ax;&{+z}\x8Ao}\x82x;', <<gibberish,
Bareword found where operator expected (Missing operator before "ax"?) at - line 1, near ""ab}"ax"
syntax error at - line 1, near ""ab}"ax"
Execution of - aborted due to compilation errors.
gibberish
       { stderr => 1 },
      'gibberish containing &{+z} - used to crash [perl #123753]'
    );
    fresh_perl_is(
      "\@{\327\n", <<\gibberisi,
Unrecognized character \xD7; marked by <-- HERE after @{<-- HERE near column 3 at - line 1.
gibberisi
       { stderr => 1 },
      '@ { \327 \n - used to garble output (or fail asan) [perl #128951]'
    );
}

fresh_perl_is(
  '/$a[/<<a',
  "Missing right curly or square bracket at - line 1, within pattern\n" .

t/op/lvref.t  view on Meta::CPAN

like $@, qr/^Assigned value is not a CODE reference at/,
    'list-assigning non-code ref to package code ref';

eval '(\do{}) = 42';
like $@, qr/^Can't modify reference to do block in list assignment at /,
    "Can't modify reference to do block in list assignment";
eval '(\pos) = 42';
like $@,
     qr/^Can't modify reference to match position in list assignment at /,
    "Can't modify ref to some scalar-returning op in list assignment";
eval '(\glob) = 42';
like $@,
     qr/^Can't modify reference to glob in list assignment at /,
    "Can't modify reference to some list-returning op in list assignment";
eval '\pos = 42';
like $@,
    qr/^Can't modify reference to match position in scalar assignment at /,
   "Can't modify ref to some scalar-returning op in scalar assignment";
eval '\(local @b) = 42';
like $@,
    qr/^Can't modify reference to localized parenthesized array in list(?x:

t/op/ref.t  view on Meta::CPAN


# bug #22719

runperl(prog => 'sub f { my $x = shift; *z = $x; } f({}); f();');
is ($?, 0, 'coredump on typeglob = (SvRV && !SvROK)');

# bug #27268: freeing self-referential typeglobs could trigger
# "Attempt to free unreferenced scalar" warnings

is (runperl(
    prog => 'use Symbol;my $x=bless \gensym,q{t}; print;*$$x=$x',
    stderr => 1
), '', 'freeing self-referential typeglob');

# using a regex in the destructor for STDOUT segfaulted because the
# REGEX pad had already been freed (ithreads build only). The
# object is required to trigger the early freeing of GV refs to STDOUT

TODO: {
    local $TODO = "works but output through pipe is mangled" if $^O eq 'VMS';
    like (runperl(

t/re/pat_advanced.t  view on Meta::CPAN

    {
        my $v;
        ($v = 'bar') =~ /(\w+)/g;
        $v = 'foo';
        is("$1", 'bar',
	   '$1 is safe after /g - may fail due to specialized config in pp_hot.c');
    }

    {
        my $message = "http://nntp.perl.org/group/perl.perl5.porters/118663";
        my $qr_barR1 = qr/(bar)\g-1/;
        like("foobarbarxyz", $qr_barR1, $message);
        like("foobarbarxyz", qr/foo${qr_barR1}xyz/, $message);
        like("foobarbarxyz", qr/(foo)${qr_barR1}xyz/, $message);
        like("foobarbarxyz", qr/(foo)(bar)\g{-1}xyz/, $message);
        like("foobarbarxyz", qr/(foo${qr_barR1})xyz/, $message);
        like("foobarbarxyz", qr/(foo(bar)\g{-1})xyz/, $message);
    }

    {
        my $message = '$REGMARK';
        our @r = ();
        local $REGMARK;
        local $REGERROR;
        like('foofoo', qr/foo (*MARK:foo) (?{push @r,$REGMARK}) /x, $message);
        is("@r","foo", $message);
        is($REGMARK, "foo", $message);

win32/GNUmakefile  view on Meta::CPAN

endif

# Set the install location of the compiler headers/libraries.
# These are saved into $Config{incpath} and $Config{libpth}.
ifneq ($(GCCCROSS),)
CCINCDIR := $(CCHOME)\$(GCCCROSS)\include
CCLIBDIR := $(CCHOME)\$(GCCCROSS)\lib
ARCHPREFIX := $(GCCCROSS)-
else ifeq ($(CCTYPE),GCC)
CCINCDIR := $(CCHOME)\include
CCLIBDIR := $(CCHOME)\lib;$(CCHOME)\$(GCCTARGET)\lib;$(CCHOME)\lib\gcc\$(GCCTARGET)\$(GCCVER)
ARCHPREFIX :=
else
CCINCDIR := $(CCHOME)\include
ifeq ($(CCTYPE),MSVC120)
ifeq ($(WIN64),define)
CCLIBDIR := $(CCHOME)\lib\amd64
else
CCLIBDIR := $(CCHOME)\lib
endif
else ifeq ($(CCTYPE),MSVC140)

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.889 second using v1.00-cache-2.02-grep-82fe00e-cpan-1925d2aa809 )