 |
| Recent blog posts: | |
 |
| They have birthday today: | |
 |
| Forums: | | |
 |
| Discuss: | |
 |
| Recent forum topics: | |
 |
| Recent forum comments: | |
 |
| Ìîäåðàòîð: | |
 |
Friday, 27 February 2009
|
| r25629 - docs/Perl6/Spec Guest 21:43:29 |
| | Author: lwall Date: 2009-02-27 19:43:29 +0100 (Fri, 27 Feb 2009) New Revision: 25629
Modified: docs/Perl6/Spec/S06-routines.pod Log: correct fossil
Modified: docs/Perl6/Spec/S06-routines.pod =================================================================== --- docs/Perl6/Spec/S06-routines.pod 2009-02-27 18:28:01 UTC (rev 25628) +++ docs/Perl6/Spec/S06-routines.pod 2009-02-27 18:43:29 UTC (rev 25629) @@ -288,7 +288,7 @@ This may then be invoked via the syntax for contextual variables: - &+myfunc(42); + &*myfunc(42); =head2 Lvalue subroutines
|
| | Add comment |
|
| r25627 - docs/Perl6/Spec Guest 21:27:22 |
| | Author: lwall Date: 2009-02-27 19:27:22 +0100 (Fri, 27 Feb 2009) New Revision: 25627
Modified: docs/Perl6/Spec/S04-control.pod Log: off-by-one on the year
Modified: docs/Perl6/Spec/S04-control.pod =================================================================== --- docs/Perl6/Spec/S04-control.pod 2009-02-27 18:24:47 UTC (rev 25626) +++ docs/Perl6/Spec/S04-control.pod 2009-02-27 18:27:22 UTC (rev 25627) @@ -12,7 +12,7 @@ Maintainer: Larry Wall <larry@wall.org> Date: 19 Aug 2004 - Last Modified: 27 Feb 2008 + Last Modified: 27 Feb 2009 Number: 4 Version: 72
|
| | Add comment |
|
| Re: how to require() a file? Gunnar Hjalmarsson 20:54:04 |
| | Stanis aw T. Findeisen wrote:
I am trying to require() a file using its absolute name. In command line mode everything works fine, but not in Apache: [Fri Feb 27 17:45:07 2009] [error] Can't locate /home/stf/public_ht ml/test/arcv/public_html/../common.pl in @INC (@INC contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi <snip>
/usr/lib/perl5/5.8.8 . /etc/httpd) at -----------------------^
How can I require() a file when using Perl in CGI mode? Do I have to modify @INC? Based on your reply (to an answer that I not saw) it seems like giving the web server read access to common.pl solved your problem. Together with the fact that the current directory is included in @INC, it indicates that you are not running the script under mod_perl.
I guess I am using mod_perl: Guess?? You really, really ought to know! What happens if you add this line to the script:
print "Not mod_perl\n" unless $ENV{MOD_PERL};
-- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl
|
| | 1 answer | Add comment |
|
| DBI: misuse of %lx and %ld formats Charles Jardine 18:59:36 |
| | I have built a 64 bit version of Perl 5.10.0 under SLES 10 (x86-64). I am now installing DBI and DBD::Oracle.
Both of these modules produce alarming warnings at compile time. E.g.
DBI.xs: In function ‘dbih_setup_fbav’: DBI.xs:1549: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has type ‘int’
I have pasted a transcript of the DBI compilation below. The DBD::Oracle warnings are similar, but more numerous.
I have looked at the source, and it seems to me that these warnings are genuine. 32 bit integers are being passed to PerlIO_printf where the format requires 64 bits. This is incorrect C. The effects will be architecture dependent, and may include incorrect output and even core dumps.
That said, the modules pass their tests and seem to work. However, the incorrect code is mostly only exercised when tracing is turned on.
I wondered why I had never seen this before. It turns out that Perl 5.10.0 has an improvement in this area. For gcc, the declaration of PerlIO_printf has been enhanced by the addition of '__attribute__((format(__printf__,2,3)))'. This, for the first time, allows gcc to check the types of PerlIO_printf's arguments.
Do others agree with me that these format errors constitute a bug which needs fixing? If so I will attempt a patch.
In the meanwhile I will retreat to a 32 bit perl.
=============================== transcript follows =============================== + perl -V Summary of my perl5 (revision 5 version 10 subversion 0) configuration: Platform: osname=linux, osvers=2.6.16.60-0.34-smp, archname=x86_64-linux-thread-multi uname='linux ruff 2.6.16.60-0.34-smp #1 smp fri jan 16 14:59:01 utc 2009 x86_64 x86_64 x86_64 gnulinux ' config_args='-des -Dprefix=/usr/local/perl/5.10.0-B -Dusethreads -Duse64bitall -Dlibpth=/lib64 /usr/lib64 /usr/local/lib64 -Dlocincpth=/usr/local/include -A define:libc=/lib64/libc-2.4.so -Uinstallusrbinperl -Dman1dir=none -Dman3dir=none -Duseshrplib -Uperladmin -Dotherlibdirs=/usr/local/perl5lib' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -I/usr/local/include' ccversion='', gccversion='4.1.2 20070115 (SUSE Linux)', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc', ldflags ='' libpth=/lib64 /usr/lib64 /usr/local/lib64 libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc libc=/lib64/libc-2.4.so, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='2.4' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/local/perl/5.10.0-B/lib/5.10.0/x86_64-linux-thread-multi/CORE' cccdlflags='-fPIC', lddlflags='-shared -O2'
Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_64_BIT_ALL USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API Built under linux Compiled at Feb 26 2009 10:00:29 @INC: /usr/local/perl/5.10.0-B/lib/5.10.0/x86_64-linux-thread-multi /usr/local/perl/5.10.0-B/lib/5.10.0 /usr/local/perl/5.10.0-B/lib/site_perl/5.10.0/x86_64-linux-thread-multi /usr/local/perl/5.10.0-B/lib/site_perl/5.10.0 /usr/local/perl5lib . + perl Makefile.PL
*** Your LANG environment variable is set to 'en_GB.UTF-8' *** This may cause problems for some perl installations. *** If you get test failures, please try again with LANG unset. *** If that then works, please email dbi-dev@perl.org with details *** including the output of 'perl -V'
*** You are using a perl configured with threading enabled. *** You should be aware that using multiple threads is *** not recommended for production environments.
Your perl was compiled with gcc (version 4.1.2 20070115 (SUSE Linux)), okay. Creating test wrappers for DBI::PurePerl: t/zvp_01basics.t t/zvp_02dbidrv.t t/zvp_03handle.t t/zvp_04mods.t t/zvp_05concathash.t t/zvp_06attrs.t t/zvp_07kids.t t/zvp_08keeperr.t t/zvp_09trace.t t/zvp_10examp.t t/zvp_11fetch.t t/zvp_12quote.t t/zvp_13taint.t t/zvp_14utf8.t t/zvp_15array.t t/zvp_19fhtrace.t t/zvp_20meta.t t/zvp_30subclass.t t/zvp_35thrclone.t (use threads) t/zvp_40profile.t t/zvp_41prof_dump.t t/zvp_42prof_data.t t/zvp_43prof_env.t t/zvp_50dbm.t t/zvp_60preparse.t t/zvp_65transact.t t/zvp_70callbacks.t t/zvp_72childhandles.t t/zvp_80proxy.t t/zvp_85gofer.t t/zvp_86gofer_fail.t t/zvp_87gofer_cache.t Creating test wrappers for DBD::Gofer: t/zvg_01basics.t t/zvg_02dbidrv.t t/zvg_03handle.t t/zvg_04mods.t t/zvg_05concathash.t t/zvg_06attrs.t t/zvg_07kids.t t/zvg_08keeperr.t t/zvg_09trace.t t/zvg_10examp.t t/zvg_11fetch.t t/zvg_12quote.t t/zvg_13taint.t t/zvg_14utf8.t t/zvg_15array.t t/zvg_19fhtrace.t t/zvg_20meta.t t/zvg_30subclass.t t/zvg_35thrclone.t (use threads) t/zvg_40profile.t t/zvg_41prof_dump.t t/zvg_42prof_data.t t/zvg_43prof_env.t t/zvg_50dbm.t t/zvg_60preparse.t t/zvg_65transact.t t/zvg_70callbacks.t t/zvg_72childhandles.t t/zvg_80proxy.t t/zvg_85gofer.t t/zvg_86gofer_fail.t t/zvg_87gofer_cache.t Creating test wrappers for PurePerl & Gofer: t/zvxgp_01basics.t t/zvxgp_02dbidrv.t t/zvxgp_03handle.t t/zvxgp_04mods.t t/zvxgp_05concathash.t t/zvxgp_06attrs.t t/zvxgp_07kids.t t/zvxgp_08keeperr.t t/zvxgp_09trace.t t/zvxgp_10examp.t t/zvxgp_11fetch.t t/zvxgp_12quote.t t/zvxgp_13taint.t t/zvxgp_14utf8.t t/zvxgp_15array.t t/zvxgp_19fhtrace.t t/zvxgp_20meta.t t/zvxgp_30subclass.t t/zvxgp_35thrclone.t (use threads) t/zvxgp_40profile.t t/zvxgp_41prof_dump.t t/zvxgp_42prof_data.t t/zvxgp_43prof_env.t t/zvxgp_50dbm.t t/zvxgp_60preparse.t t/zvxgp_65transact.t t/zvxgp_70callbacks.t t/zvxgp_72childhandles.t t/zvxgp_80proxy.t t/zvxgp_85gofer.t t/zvxgp_86gofer_fail.t t/zvxgp_87gofer_cache.t Checking if your kit is complete... Looks good
I see you're using perl 5.010000 on x86_64-linux-thread-multi, okay. Remember to actually *read* the README file! Use 'make' to build the software (dmake or nmake on Windows). Then 'make test' to execute self tests. Then 'make install' to install the DBI and then delete this working directory before unpacking and building any DBD::* drivers.
Writing Makefile for DBI + make /usr/local/perl/5.10.0-B/bin/perl "-MExtUtils::Command" -e mkpath blib/lib/DBI rm -f blib/lib/DBI/Changes.pm cp Changes blib/lib/DBI/Changes.pm /usr/local/perl/5.10.0-B/bin/perl "-MExtUtils::Command" -e mkpath blib/lib/DBI rm -f blib/lib/DBI/Roadmap.pm cp Roadmap.pod blib/lib/DBI/Roadmap.pm cp Driver_xst.h blib/arch/auto/DBI/Driver_xst.h cp lib/DBD/Proxy.pm blib/lib/DBD/Proxy.pm cp lib/DBI/Gofer/Response.pm blib/lib/DBI/Gofer/Response.pm cp lib/DBI/Gofer/Transport/Base.pm blib/lib/DBI/Gofer/Transport/Base.pm cp lib/DBI/Util/_accessor.pm blib/lib/DBI/Util/_accessor.pm cp lib/DBD/DBM.pm blib/lib/DBD/DBM.pm cp DBIXS.h blib/arch/auto/DBI/DBIXS.h cp Roadmap.pod blib/lib/Roadmap.pod cp dbixs_rev.pl blib/lib/dbixs_rev.pl cp lib/DBI/Const/GetInfoType.pm blib/lib/DBI/Const/GetInfoType.pm cp lib/DBI/Gofer/Serializer/DataDumper.pm blib/lib/DBI/Gofer/Serializer/DataDumper.pm cp lib/DBI/DBD/Metadata.pm blib/lib/DBI/DBD/Metadata.pm cp lib/DBD/Gofer/Transport/pipeone.pm blib/lib/DBD/Gofer/Transport/pipeone.pm cp lib/DBI/Const/GetInfo/ODBC.pm blib/lib/DBI/Const/GetInfo/ODBC.pm cp lib/DBI/ProfileDumper/Apache.pm blib/lib/DBI/ProfileDumper/Apache.pm cp Driver.xst blib/arch/auto/DBI/Driver.xst cp lib/DBD/File.pm blib/lib/DBD/File.pm cp lib/DBI/Util/CacheMemory.pm blib/lib/DBI/Util/CacheMemory.pm cp lib/DBD/NullP.pm blib/lib/DBD/NullP.pm cp lib/DBI/ProfileSubs.pm blib/lib/DBI/ProfileSubs.pm cp dbi_sql.h blib/arch/auto/DBI/dbi_sql.h cp lib/DBD/Gofer.pm blib/lib/DBD/Gofer.pm cp dbivport.h blib/arch/auto/DBI/dbivport.h cp dbd_xsh.h blib/arch/auto/DBI/dbd_xsh.h cp dbixs_rev.h blib/arch/auto/DBI/dbixs_rev.h cp lib/DBD/Gofer/Transport/Base.pm blib/lib/DBD/Gofer/Transport/Base.pm cp lib/DBI/FAQ.pm blib/lib/DBI/FAQ.pm cp lib/DBD/Gofer/Policy/rush.pm blib/lib/DBD/Gofer/Policy/rush.pm cp lib/DBI/SQL/Nano.pm blib/lib/DBI/SQL/Nano.pm cp lib/DBI/Gofer/Request.pm blib/lib/DBI/Gofer/Request.pm cp lib/DBI/Const/GetInfo/ANSI.pm blib/lib/DBI/Const/GetInfo/ANSI.pm cp lib/DBD/Gofer/Transport/stream.pm blib/lib/DBD/Gofer/Transport/stream.pm cp lib/DBD/Gofer/Policy/classic.pm blib/lib/DBD/Gofer/Policy/classic.pm cp lib/DBI/Const/GetInfoReturn.pm blib/lib/DBI/Const/GetInfoReturn.pm cp lib/DBD/Gofer/Policy/Base.pm blib/lib/DBD/Gofer/Policy/Base.pm cp DBI.pm blib/lib/DBI.pm cp lib/DBI/Gofer/Serializer/Storable.pm blib/lib/DBI/Gofer/Serializer/Storable.pm cp lib/DBI/Gofer/Transport/stream.pm blib/lib/DBI/Gofer/Transport/stream.pm cp lib/DBD/Sponge.pm blib/lib/DBD/Sponge.pm cp lib/DBD/Gofer/Policy/pedantic.pm blib/lib/DBD/Gofer/Policy/pedantic.pm cp lib/DBI/W32ODBC.pm blib/lib/DBI/W32ODBC.pm cp lib/DBI/Gofer/Transport/pipeone.pm blib/lib/DBI/Gofer/Transport/pipeone.pm cp lib/DBD/Gofer/Transport/null.pm blib/lib/DBD/Gofer/Transport/null.pm cp lib/Bundle/DBI.pm blib/lib/Bundle/DBI.pm cp TASKS.pod blib/lib/TASKS.pod cp lib/DBI/Profile.pm blib/lib/DBI/Profile.pm cp lib/DBI/ProfileDumper.pm blib/lib/DBI/ProfileDumper.pm cp lib/DBI/ProxyServer.pm blib/lib/DBI/ProxyServer.pm cp lib/DBI/Gofer/Serializer/Base.pm blib/lib/DBI/Gofer/Serializer/Base.pm cp dbipport.h blib/arch/auto/DBI/dbipport.h cp lib/DBI/Gofer/Execute.pm blib/lib/DBI/Gofer/Execute.pm cp lib/DBI/DBD.pm blib/lib/DBI/DBD.pm cp lib/Win32/DBIODBC.pm blib/lib/Win32/DBIODBC.pm cp lib/DBI/PurePerl.pm blib/lib/DBI/PurePerl.pm cp lib/DBD/ExampleP.pm blib/lib/DBD/ExampleP.pm cp lib/DBI/ProfileData.pm blib/lib/DBI/ProfileData.pm /usr/local/perl/5.10.0-B/bin/perl -p -e "s/~DRIVER~/Perl/g" ./Driver.xst > Perl.xsi /usr/local/perl/5.10.0-B/bin/perl /usr/local/perl/5.10.0-B/lib/5.10.0/ExtUtils/xsubpp -typemap /usr/local/perl/5.10.0-B/lib/5.10.0/ExtUtils/typemap -typemap typemap Perl.xs > Perl.xsc && mv Perl.xsc Perl.c cc -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"1.607\" -DXS_VERSION=\"1.607\" -fPIC "-I/usr/local/perl/5.10.0-B/lib/5.10.0/x86_64-linux-thread-multi/CORE" -W -Wall -Wpointer-arith -Wbad-function-cast -Wno-comment -Wno-sign-compare -Wno-cast-qual -Wmissing-noreturn -Wno-unused-parameter Perl.c Perl.xsi: In function ‘XS_DBD__Perl__db_disconnect’: Perl.xsi:306: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has type ‘I32’ Perl.xsi:306: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has type ‘I32’ Perl.xsi: In function ‘XS_DBD__Perl__db_DESTROY’: Perl.xsi:352: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has type ‘I32’ Perl.xsi:352: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has type ‘I32’ Perl.xsi:380: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has type ‘I32’ Perl.xsi:380: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has type ‘I32’ Perl.xsi: In function ‘XS_DBD__Perl__st_finish’: Perl.xsi:675: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has type ‘I32’ Perl.xsi:675: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has type ‘I32’ Perl.xsi: In function ‘XS_DBD__Perl__st_DESTROY’: Perl.xsi:752: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has type ‘I32’ Perl.xsi:752: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has type ‘I32’ Perl.xsi:766: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has type ‘I32’ Perl.xsi:766: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has type ‘I32’ /usr/local/perl/5.10.0-B/bin/perl /usr/local/perl/5.10.0-B/lib/5.10.0/ExtUtils/xsubpp -typemap /usr/local/perl/5.10.0-B/lib/5.10.0/ExtUtils/typemap -typemap typemap DBI.xs > DBI.xsc && mv DBI.xsc DBI.c cc -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"1.607\" -DXS_VERSION=\"1.607\" -fPIC "-I/usr/local/perl/5.10.0-B/lib/5.10.0/x86_64-linux-thread-multi/CORE" -W -Wall -Wpointer-arith -Wbad-function-cast -Wno-comment -Wno-sign-compare -Wno-cast-qual -Wmissing-noreturn -Wno-unused-parameter DBI.c DBI.xs: In function ‘set_err_sv’: DBI.xs:623: warning: value computed is not used DBI.xs: In function ‘set_trace’: DBI.xs:888: warning: format ‘%lx’ expects type ‘long unsigned int’, but argument 6 has type ‘int’ DBI.xs:888: warning: format ‘%ld’ expects type ‘long int’, but argument 7 has type ‘unsigned int’ DBI.xs: In function ‘dbih_setup_handle’: DBI.xs:1289: warning: value computed is not used DBI.xs:1290: warning: value computed is not used DBI.xs:1295: warning: value computed is not used DBI.xs:1298: warning: value computed is not used DBI.xs: In function ‘dbih_setup_fbav’: DBI.xs:1549: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has type ‘int’ DBI.xs:1549: warning: format ‘%ld’ expects type ‘long int’, but argument 4 has type ‘I32’ DBI.xs:1556: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has type ‘I32’ DBI.xs:1570: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has type ‘int’ DBI.xs: In function ‘dbih_set_attr_k’: DBI.xs:1717: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has type ‘I32’ DBI.xs:1717: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has type ‘I32’ DBI.xs:1724: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has type ‘I32’ DBI.xs:1724: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has type ‘I32’ DBI.xs:1926: warning: value computed is not used DBI.xs: In function ‘dbih_get_attr_k’: DBI.xs:2017: warning: value computed is not used DBI.xs:2241: warning: value computed is not used DBI.xs: In function ‘_profile_next_node’: DBI.xs:2447: warning: value computed is not used DBI.xs: In function ‘XS_DBI_dispatch’: DBI.xs:3000: warning: value computed is not used DBI.xs:3062: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has type ‘I32’ DBI.xs:3062: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has type ‘I32’ DBI.xs:3075: warning: value computed is not used DBI.xs: In function ‘XS_DBI__new_handle’: DBI.xs:4092: warning: value computed is not used DBI.xs: In function ‘XS_DBD_____db_take_imp_data’: DBI.xs:4623: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has type ‘I32’ DBI.xs:4623: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has type ‘I32’ DBI.xs: In function ‘XS_DBD_____st_fetchrow_hashref’: DBI.xs:4801: warning: value computed is not used DBI.xs: In function ‘XS_DBD_____st_finish’: DBI.xs:4864: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has type ‘I32’ DBI.xs:4864: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has type ‘I32’ DBI.xs: In function ‘XS_DBD_____st_DESTROY’: DBI.xs:4878: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has type ‘I32’ DBI.xs:4878: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has type ‘I32’ DBI.xs:4894: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has type ‘I32’ DBI.xs:4894: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has type ‘I32’ Running Mkbootstrap for DBI () chmod 644 DBI.bs rm -f blib/arch/auto/DBI/DBI.so cc -shared -O2 DBI.o -o blib/arch/auto/DBI/DBI.so \ \ chmod 755 blib/arch/auto/DBI/DBI.so cp DBI.bs blib/arch/auto/DBI/DBI.bs chmod 644 blib/arch/auto/DBI/DBI.bs /usr/local/perl/5.10.0-B/bin/perl "-Iblib/arch" "-Iblib/lib" dbiprof.PL dbiprof Extracted dbiprof from dbiprof.PL with variable substitutions. dbiprof syntax OK cp dbiprof blib/script/dbiprof /usr/local/perl/5.10.0-B/bin/perl "-MExtUtils::MY" -e "MY->fixin(shift)" blib/script/dbiprof /usr/local/perl/5.10.0-B/bin/perl "-Iblib/arch" "-Iblib/lib" dbiproxy.PL dbiproxy Extracted dbiproxy from dbiproxy.PL with variable substitutions. dbiproxy syntax OK cp dbiproxy blib/script/dbiproxy /usr/local/perl/5.10.0-B/bin/perl "-MExtUtils::MY" -e "MY->fixin(shift)" blib/script/dbiproxy /usr/local/perl/5.10.0-B/bin/perl "-Iblib/arch" "-Iblib/lib" dbilogstrip.PL dbilogstrip Extracted dbilogstrip from dbilogstrip.PL with variable substitutions. dbilogstrip syntax OK cp dbilogstrip blib/script/dbilogstrip /usr/local/perl/5.10.0-B/bin/perl "-MExtUtils::MY" -e "MY->fixin(shift)" blib/script/dbilogstrip
-- Charles Jardine - Computing Service, University of Cambridge cj10@cam.ac.uk Tel: +44 1223 334506, Fax: +44 1223 334679
|
| | 3 answer | Add comment |
|
| r25623 - docs/Perl6/Spec Guest 15:41:26 |
| | Author: wayland Date: 2009-02-27 13:41:26 +0100 (Fri, 27 Feb 2009) New Revision: 25623
Modified: docs/Perl6/Spec/S16-io.pod Log: Fixed name of NameServices. wayland-- for not picking this up before .
Modified: docs/Perl6/Spec/S16-io.pod =================================================================== --- docs/Perl6/Spec/S16-io.pod 2009-02-27 12:32:32 UTC (rev 25622) +++ docs/Perl6/Spec/S16-io.pod 2009-02-27 12:41:26 UTC (rev 25623) @@ -75,21 +75,6 @@ =head1 Name Services -=head NameServices role - -The NameServices role has a bunch of functions that between them will return the whole -Name Services database between them, as lists of objects. The lists are specifically -intended to be lazy. - -role NameServices { - method List of User users() {...} # getpwent, setpwent, endpwent - method List of Group groups() {...} # getgrent, setgrent, endgrent - method List of Service services() {...} # getservent, setservent, endservent - method List of Protocol protocols() {...} # getprotoent, setprotoent, endprotoent - method List of Network networks() {...} # getnetent, setnetent, endnetent - method List of Host hosts() {...} # gethostent, sethostent, endhostent -} - =head2 User role role User { @@ -148,6 +133,21 @@ Tries to write the group entry into the system group database. +=head OS::Unix::NameServices role + +The NameServices role has a bunch of functions that between them will return the whole +Name Services database between them, as lists of objects. The lists are specifically +intended to be lazy. + +role NameServices { + method List of User users() {...} # getpwent, setpwent, endpwent + method List of Group groups() {...} # getgrent, setgrent, endgrent + method List of Service services() {...} # getservent, setservent, endservent + method List of Protocol protocols() {...} # getprotoent, setprotoent, endprotoent + method List of Network networks() {...} # getnetent, setnetent, endnetent + method List of Host hosts() {...} # gethostent, sethostent, endhostent +} + =head1 Additions Please post errors and feedback to perl6-language. If you are making
|
| | Add comment |
|
| r25622 - docs/Perl6/Spec Guest 15:32:32 |
| | Author: wayland Date: 2009-02-27 13:32:32 +0100 (Fri, 27 Feb 2009) New Revision: 25622
Modified: docs/Perl6/Spec/S16-io.pod docs/Perl6/Spec/S29-functions.pod Log: Replaced iterators with NameServices role, based on an idea of ruoso++ (although I doubt he wants credit for some of the things I've done with his ideas )
Modified: docs/Perl6/Spec/S16-io.pod =================================================================== --- docs/Perl6/Spec/S16-io.pod 2009-02-27 12:06:57 UTC (rev 25621) +++ docs/Perl6/Spec/S16-io.pod 2009-02-27 12:32:32 UTC (rev 25622) @@ -3,7 +3,7 @@ =head1 Title -DRAFT: Synopsis 16: IO / User / Group +DRAFT: Synopsis 16: IO / Name Services =head1 Version @@ -73,8 +73,23 @@ S32-setting-library/IO.pod. The main functions used are listed in S29 with references to S32-setting-library/IO.pod. -=head1 Users and Groups +=head1 Name Services +=head NameServices role + +The NameServices role has a bunch of functions that between them will return the whole +Name Services database between them, as lists of objects. The lists are specifically +intended to be lazy. + +role NameServices { + method List of User users() {...} # getpwent, setpwent, endpwent + method List of Group groups() {...} # getgrent, setgrent, endgrent + method List of Service services() {...} # getservent, setservent, endservent + method List of Protocol protocols() {...} # getprotoent, setprotoent, endprotoent + method List of Network networks() {...} # getnetent, setnetent, endnetent + method List of Host hosts() {...} # gethostent, sethostent, endhostent +} + =head2 User role role User { @@ -115,13 +130,6 @@ All the information is naturally fetched from the system via getpwuid, getpwnam, or the like. -=head2 UserIterator role - -role UserIterator does Iterator {...} - -In the Unix implementation, this deals with getpwent, setpwent, and endpwent. Basically, -it returns a User object with each iteration. - =head2 Group role role Group { @@ -140,13 +148,6 @@ Tries to write the group entry into the system group database. -=head2 GroupIterator role - -role GroupIterator does Iterator {...} - -In the Unix implementation, this deals with getgrent, setgrent, and endgrent. Basically, -it returns a Group object with each iteration. - =head1 Additions Please post errors and feedback to perl6-language. If you are making
Modified: docs/Perl6/Spec/S29-functions.pod =================================================================== --- docs/Perl6/Spec/S29-functions.pod 2009-02-27 12:06:57 UTC (rev 25621) +++ docs/Perl6/Spec/S29-functions.pod 2009-02-27 12:32:32 UTC (rev 25622) @@ -777,9 +777,9 @@ See .pairs() method, above. -=item endpwent, endgrent +=item endpwent, endgrent, endservent, endprotoent, endnetent, endhostent -The UserIterator and GroupIterator roles in S16 cover most of these. +The NameServices role in S16 covers most of these. =item format, formline @@ -789,9 +789,9 @@ The User and Group roles in S16 cover most of these. -=item getpwent, getgrent +=item getpwent, getgrent, getservent, getnetent, gethostent -The UserIterator and GroupIterator roles in S16 cover most of these. +The NameServices role in S16 covers most of these. =item length() @@ -841,9 +841,9 @@ See IPC::SysV; -=item setpwent, setgrent +=item setpwent, setgrent, setservent, setprotoent, setnetent, sethostent -The UserIterator and GroupIterator roles in S16 cover most of these. +The NameServices role in S16 covers most of these. =item shmctl, shmget, shmread, shmwrite @@ -926,34 +926,18 @@ getservbyname getservbyport - getservent - setservent - endservent - --Protocol getprotobyname getprotobynumber - getprotoent - setprotoent - endprotoent - --Network getnetbyaddr getnetbyname - getnetent - setnetent - endnetent - --Host gethostbyaddr gethostbyname - gethostent - sethostent - endhostent - =item Flow control break
|
| | Add comment |
|
| r25614 - docs/Perl6/Spec/S32-setting-library Guest 15:12:40 |
| | Author: wayland Date: 2009-02-27 10:19:30 +0100 (Fri, 27 Feb 2009) New Revision: 25614
Modified: docs/Perl6/Spec/S32-setting-library/Str.pod Log: Return type for subst
Modified: docs/Perl6/Spec/S32-setting-library/Str.pod =================================================================== --- docs/Perl6/Spec/S32-setting-library/Str.pod 2009-02-27 08:29:42 UTC (rev 25613) +++ docs/Perl6/Spec/S32-setting-library/Str.pod 2009-02-27 09:19:30 UTC (rev 25614) @@ -509,7 +509,7 @@ =item subst - method subst(Str $self: Regex $search, Str $replacement); + method Str subst(Str $self: Regex $search, Str $replacement); XXX Does this return a Match? A Str?
|
| | 1 answer | Add comment |
|
| r25621 - docs/Perl6/Spec Guest 15:06:57 |
| | Author: wayland Date: 2009-02-27 13:06:57 +0100 (Fri, 27 Feb 2009) New Revision: 25621
Modified: docs/Perl6/Spec/S16-io.pod docs/Perl6/Spec/S29-functions.pod Log: Created UserIterator and GroupIterator, and grouped some S29 functions together.
Modified: docs/Perl6/Spec/S16-io.pod =================================================================== --- docs/Perl6/Spec/S16-io.pod 2009-02-27 11:57:30 UTC (rev 25620) +++ docs/Perl6/Spec/S16-io.pod 2009-02-27 12:06:57 UTC (rev 25621) @@ -115,6 +115,13 @@ All the information is naturally fetched from the system via getpwuid, getpwnam, or the like. +=head2 UserIterator role + +role UserIterator does Iterator {...} + +In the Unix implementation, this deals with getpwent, setpwent, and endpwent. Basically, +it returns a User object with each iteration. + =head2 Group role role Group { @@ -133,6 +140,13 @@ Tries to write the group entry into the system group database. +=head2 GroupIterator role + +role GroupIterator does Iterator {...} + +In the Unix implementation, this deals with getgrent, setgrent, and endgrent. Basically, +it returns a Group object with each iteration. + =head1 Additions Please post errors and feedback to perl6-language. If you are making
Modified: docs/Perl6/Spec/S29-functions.pod =================================================================== --- docs/Perl6/Spec/S29-functions.pod 2009-02-27 11:57:30 UTC (rev 25620) +++ docs/Perl6/Spec/S29-functions.pod 2009-02-27 12:06:57 UTC (rev 25621) @@ -777,6 +777,10 @@ See .pairs() method, above. +=item endpwent, endgrent + +The UserIterator and GroupIterator roles in S16 cover most of these. + =item format, formline See Exegesis 7. @@ -785,6 +789,10 @@ The User and Group roles in S16 cover most of these. +=item getpwent, getgrent + +The UserIterator and GroupIterator roles in S16 cover most of these. + =item length() This word is banned in Perl 6. You must specify units. In practise, this probably means @@ -833,6 +841,10 @@ See IPC::SysV; +=item setpwent, setgrent + +The UserIterator and GroupIterator roles in S16 cover most of these. + =item shmctl, shmget, shmread, shmwrite See IPC::SysV; @@ -896,42 +908,52 @@ =item OS or library related -chroot -crypt -endgrent -endhostent -endnetent -endprotoent -endpwent -endservent -getgrent -gethostbyaddr -gethostbyname -gethostent -getlogin -getnetbyaddr -getnetbyname -getnetent -getpeername -getpgrp -getppid -getpriority -getprotobyname -getprotobynumber -getprotoent -getpwent -getservbyname -getservbyport -getservent -setgrent -sethostent -setnetent -setpgrp -setpriority -setprotoent -setpwent -setservent + chroot + crypt + getlogin + getpeername -- should this go on Pipe? +OS objects: + + --Process + getpgrp + getppid + getpriority + setpgrp + setpriority + + --Service + getservbyname + getservbyport + + getservent + setservent + endservent + + --Protocol + getprotobyname + getprotobynumber + + getprotoent + setprotoent + endprotoent + + --Network + getnetbyaddr + getnetbyname + + getnetent + setnetent + endnetent + + --Host + gethostbyaddr + gethostbyname + + gethostent + sethostent + endhostent + =item Flow control break
|
| | Add comment |
|
| r25619 - docs/Perl6/Spec Guest 14:34:30 |
| | Author: wayland Date: 2009-02-27 12:34:30 +0100 (Fri, 27 Feb 2009) New Revision: 25619
Modified: docs/Perl6/Spec/S16-io.pod docs/Perl6/Spec/S29-functions.pod Log: Did some work on users and groups
Modified: docs/Perl6/Spec/S16-io.pod =================================================================== --- docs/Perl6/Spec/S16-io.pod 2009-02-27 11:10:45 UTC (rev 25618) +++ docs/Perl6/Spec/S16-io.pod 2009-02-27 11:34:30 UTC (rev 25619) @@ -24,8 +24,10 @@ corresponding global function, it's merely an exported version of the method. -=head1 Overridable IO handles +=head1 IO +=head2 Overridable IO handles + In Perl 6, there are the I<standard> IO handles, and any number of overriding inner filehandles for the same symbol. @@ -65,15 +67,78 @@ } # stdout reverts to outer scope's definition -=head1 Roles and Classes +=head2 Roles and Classes The roles and classes that define most of the functionality for IO are defined in S32-setting-library/IO.pod. The main functions used are listed in S29 with references to S32-setting-library/IO.pod. +=head1 Users and Groups + +=head2 User role + +role User { + has $username; # Username (some descendants(?) may want to implement a real $name) + has $id; # User ID + has $dir; # Home directory for files +} + +=item new + + method User new($Username?, $UID?) {...} + +Creates a new User object, fetching the information either by username or user ID. + +=item write + + method write() {...} + +Tries to write the current User object to the user database. This may well fail. + +=item Str + +When converted to a Str, returns $username. + +=item Num + +When converted to a Num, returns $uid. + +=head2 OS::Unix::User role + +role OS::Unix::User does User { + has $password; + has $gid; + has $gecos; + has $shell; +} + +All the information is naturally fetched from the system via getpwuid, getpwnam, or the +like. + +=head2 Group role + +role Group { + has $name; + has $id; + has @members; +} + +=item new + + method Group new(:$Name, ID); + +=item write + + method write(); + +Tries to write the group entry into the system group database. + =head1 Additions Please post errors and feedback to perl6-language. If you are making a general laundry list, please separate messages by topic. =cut + +=encoding utf8 +
Modified: docs/Perl6/Spec/S29-functions.pod =================================================================== --- docs/Perl6/Spec/S29-functions.pod 2009-02-27 11:10:45 UTC (rev 25618) +++ docs/Perl6/Spec/S29-functions.pod 2009-02-27 11:34:30 UTC (rev 25619) @@ -420,53 +420,6 @@ my $address = gethost("foo.example.com").addr; my $hostname = gethost addr<"10.1.2.3">); -=item getpw - - our OS::PW multi getpw() - our OS::PW multi getpw( Int $uid ) - our OS::PW multi getpw( Str $name ) - - our OS::PW multi method OS::PWEnt::getpw( OS::PWEnt $pw: ) - our OS::PW multi method OS::PWEnt::getpw( OS::PWEnt $pw: Int $uid ) - our OS::PW multi method OS::PWEnt::getpw( OS::PWEnt $pw: Str $name ) - -The C<getpw> function operates on system login information, returning -data about users in the form of an C<OS::PW> object ("PW" refers -to the historical C<getpw*> functions that are part of the POSIX -standard, and stands for "password"). - -When given no parameters, the "next" user entry is returned (C<undef> is -returned when the list of users has been exhausted). - -When C<$uid> is provided, a user with the given UID is found and returned. -C<undef> is returned if no matching entry is found. - -When C<$name> is provided, a user with the matching name is found and -returned. C<undef> is returned if no matching entry is found. - -The return value is an object that represents the system-specific -information about the user. When numified, this object returns the -UID of the user. When stringified, this object returns the username. - -Therefore, the typical convention of: - - my Int $uid = getpw(~$name); - -and - - my Str $name = getpw(+$uid); - -Will work as expected. - -See the documentation for the C<OS::PW> and C<OS::PWEnt> classes for more -information and the equivalent of the Perl 5 setpwent / endpwent functions. - -WARNING: Even when used as a method on an C<OS::PWEnt> object, there -may be system-specific, global state associated with the implementation -of these routines. - -[Note: TODO setpgrp setpriority times -ajs ] - =item chroot our Bool multi chroot ( Str $path = CALLER::<$_> ) @@ -828,6 +781,10 @@ See Exegesis 7. +=item getgrgid, getgrnam, getpwnam, getpwuid + +The User and Group roles in S16 cover most of these. + =item length() This word is banned in Perl 6. You must specify units. In practise, this probably means @@ -948,8 +905,6 @@ endpwent endservent getgrent -getgrgid -getgrnam gethostbyaddr gethostbyname gethostent @@ -965,8 +920,6 @@ getprotobynumber getprotoent getpwent -getpwnam -getpwuid getservbyname getservbyport getservent
|
| | Add comment |
|
| r25616 - docs/Perl6/Spec Guest 12:58:10 |
| | Author: wayland Date: 2009-02-27 10:58:10 +0100 (Fri, 27 Feb 2009) New Revision: 25616
Modified: docs/Perl6/Spec/S16-io.pod docs/Perl6/Spec/S17-concurrency.pod Log: Moved Signals and IPC from S16 to S17, which can now be processes and concurrency.
Modified: docs/Perl6/Spec/S16-io.pod =================================================================== --- docs/Perl6/Spec/S16-io.pod 2009-02-27 09:33:12 UTC (rev 25615) +++ docs/Perl6/Spec/S16-io.pod 2009-02-27 09:58:10 UTC (rev 25616) @@ -3,7 +3,7 @@ =head1 Title -DRAFT: Synopsis 16: IPC / IO / Signals +DRAFT: Synopsis 16: IO / User / Group =head1 Version @@ -71,127 +71,6 @@ S32-setting-library/IO.pod. The main functions used are listed in S29 with references to S32-setting-library/IO.pod. -=head1 POSIX Signals - -The %*SIG variable contains a Hash of Proc::Signals::Signal. - -class Signal { - has $exception; # This specifies what exception will be raised when this signal is received - has $interrupt; # See siginterrupt(3) - has $blocked; # Is this signal blocked? cf. sigprocmask -} - -The @*SIGQUEUE array contains a queue of the signals that are blocked and queued. - -The standard POSIX signals simply raise control exceptions that are handled as normal -through the control signal handler, and caught by CONTROL blocks. - -=head2 Signal defaults - -The signals have defaults as specified in the table below. $blocked always defaults to -false. - - Signal Default Exception - ------ ----------------- - SIGHUP ControlExceptionSigHUP - SIGINT ControlExceptionSigINT - SIGQUIT ControlExceptionSigQUIT - SIGILL ControlExceptionSigILL - SIGABRT ControlExceptionSigABRT - SIGFPE ControlExceptionSigFPE - SIGKILL ControlExceptionSigKILL - SIGSEGV ControlExceptionSigSEGV - SIGPIPE ControlExceptionSigPIPE - SIGALRM ControlExceptionSigALRM - SIGTERM ControlExceptionSigTERM - SIGUSR1 ControlExceptionSigUSR1 - SIGUSR2 ControlExceptionSigUSR2 - SIGCHLD ControlExceptionSigCHLD - SIGCONT ControlExceptionSigCONT - SIGSTOP ControlExceptionSigSTOP - SIGTSTP ControlExceptionSigTSTP - SIGTTIN ControlExceptionSigTTIN - SIGTTOU ControlExceptionSigTTOU - SIGBUS ControlExceptionSigBUS - SIGPROF ControlExceptionSigPROF - SIGSYS ControlExceptionSigSYS - SIGTRAP ControlExceptionSigTRAP - SIGURG Undefined - SIGVTALRM ControlExceptionSigVTALRM - SIGXCPU ControlExceptionSigXCPU - SIGXFSZ ControlExceptionSigXFSZ - SIGEMT ControlExceptionSigEMT - SIGSTKFLT ControlExceptionSigSTKFLT - SIGIO ControlExceptionSigIO - SIGPWR ControlExceptionSigPWR - SIGLOST ControlExceptionSigLOST - SIGWINCH Undefined - -=head2 Signal exceptions - -A table below describes the exceptions. - -Each of these has a default action as well. The possible actions are: - - Term Default action is to terminate the process. - - Ign Default action is to ignore the signal ($signal.exception is undef by default) - - Core Default action is to terminate the process and dump core (see core(5)). - - Stop Default action is to stop the process. - - Cont Default action is to continue the process if it is currently stopped. - -Some actions do the Resumeable role. An exception listed in the table below that does the -Resumeable role is marked with a * in the R column. - -The exceptions are: - - Signal Action R Comment - ---------------------------------------------------------------------- - ControlExceptionSigHUP Term ? Hangup detected on controlling terminal or death of controlling process - ControlExceptionSigINT Term ? Interrupt from keyboard - ControlExceptionSigQUIT Core ? Quit from keyboard - ControlExceptionSigILL Core ? Illegal Instruction - ControlExceptionSigABRT Core ? Abort signal from abort(3) - ControlExceptionSigFPE Core ? Floating point exception - ControlExceptionSigKILL Term ? Kill signal - ControlExceptionSigSEGV Core Invalid memory reference - ControlExceptionSigPIPE Term ? Broken pipe: write to pipe with no readers - ControlExceptionSigALRM Term ? Timer signal from alarm(2) - ControlExceptionSigTERM Term ? Termination signal - ControlExceptionSigUSR1 Term ? User-defined signal 1 - ControlExceptionSigUSR2 Term ? User-defined signal 2 - ControlExceptionSigCHLD Ign * Child stopped or terminated - ControlExceptionSigCONT Cont * Continue if stopped - ControlExceptionSigSTOP Stop ? Stop process - ControlExceptionSigTSTP Stop ? Stop typed at tty - ControlExceptionSigTTIN Stop ? tty input for background process - ControlExceptionSigTTOU Stop ? tty output for background process - ControlExceptionSigBUS Core ? Bus error (bad memory access) - ControlExceptionSigPROF Term ? Profiling timer expired - ControlExceptionSigSYS Core ? Bad argument to routine (SVr4) - ControlExceptionSigTRAP Core ? Trace/breakpoint trap - ControlExceptionSigURG Ign ? Urgent condition on socket (4.2BSD) - ControlExceptionSigVTALRM Term ? Virtual alarm clock (4.2BSD) - ControlExceptionSigXCPU Core ? CPU time limit exceeded (4.2BSD) - ControlExceptionSigXFSZ Core ? File size limit exceeded (4.2BSD) - ControlExceptionSigEMT Term ? - ControlExceptionSigSTKFLT Term ? Stack fault on coprocessor (unused) - ControlExceptionSigIO Term ? I/O now possible (4.2BSD) - ControlExceptionSigPWR Term ? Power failure (System V) - ControlExceptionSigLOST Term ? File lock lost - ControlExceptionSigWINCH Ign ? Window resize signal (4.3BSD, Sun) - -See L<S04-control> for details on how to handle exceptions. - -XXX I'm unsure how the actions in the table above can be made to make sense. The Ign -actions are already dealt with because %SIG{CHLD}.exception already defaults to undef. -The Term action will probably be self-solving (ie. will terminate the process). The -others I'm just plain unsure about. XXX - - =head1 Additions Please post errors and feedback to perl6-language. If you are making
Modified: docs/Perl6/Spec/S17-concurrency.pod =================================================================== --- docs/Perl6/Spec/S17-concurrency.pod 2009-02-27 09:33:12 UTC (rev 25615) +++ docs/Perl6/Spec/S17-concurrency.pod 2009-02-27 09:58:10 UTC (rev 25616) @@ -2,33 +2,247 @@ =head1 TITLE -DRAFT: Synopsis 17: Concurrency +DRAFT: Synopsis 17: Processes and Concurrency =head1 AUTHOR -Elizabeth Mattijsen <liz@dijkmat.nl> -Audrey Tang <audreyt@audreyt.org> - =head1 VERSION + Authors: Elizabeth Mattijsen <liz@dijkmat.nl> + Audrey Tang <audreyt@audreyt.org> Maintainer: Elizabeth Mattijsen <liz@dijkmat.nl> Contributions: Christoph Buchetmann + Tim Nelson <wayland@wayland.id.au> Date: 13 Jun 2005 - Last Modified: 4 Mar 2008 - Number 0 - Version: 3 + Last Modified: 27 Feb 2009 + Number 17 + Version: 4 +This draft document is a paste together from various sources. The bulk of it is simply +the old S17-concurrency.pod, which dealt only with concurrency. Signals were added from +S16-io, but haven't been merged with the conflicting S17 signals doco. An event loop +section has been added here because a) Larry mentioned the idea, and b) Moritz suggested +that http://www.seas.upenn.edu/~lipeng/homepage/unify.html be our model for concurrency, +and in that model, an event loop underlies the threads. + +=head1 Overview + +An event loop underlies everything in this document. POSIX signals can interact with +this, and concurrency is built on top of it. Naturally, IPC (inter-process communication) +is documented here too (XXX or should be ). + +=head1 The Event Loop + +=head1 POSIX Signals + +The %*SIG variable contains a Hash of Proc::Signals::Signal. + +class Proc::Signals::Signal { + has $exception; # This specifies what exception will be raised when this signal is received + has $interrupt; # See siginterrupt(3) + has $blocked; # Is this signal blocked? cf. sigprocmask +} + +The @*SIGQUEUE array contains a queue of the signals that are blocked and queued. + +The standard POSIX signals simply raise control exceptions that are handled as normal +through the control signal handler, and caught by CONTROL blocks, as specified in S04. + +To declare your main program catches INT signals, put a CONTROL block anywhere +in the toplevel to handle exceptions like this: + + CONTROL { + when Error::Signal::INT { ... } + } + +=head2 Signal defaults + +The signals have defaults as specified in the table below. $blocked always defaults to +false. + + Signal Default Exception + ------ ----------------- + SIGHUP ControlExceptionSigHUP + SIGINT ControlExceptionSigINT + SIGQUIT ControlExceptionSigQUIT + SIGILL ControlExceptionSigILL + SIGABRT ControlExceptionSigABRT + SIGFPE ControlExceptionSigFPE + SIGKILL ControlExceptionSigKILL + SIGSEGV ControlExceptionSigSEGV + SIGPIPE ControlExceptionSigPIPE + SIGALRM ControlExceptionSigALRM + SIGTERM ControlExceptionSigTERM + SIGUSR1 ControlExceptionSigUSR1 + SIGUSR2 ControlExceptionSigUSR2 + SIGCHLD ControlExceptionSigCHLD + SIGCONT ControlExceptionSigCONT + SIGSTOP ControlExceptionSigSTOP + SIGTSTP ControlExceptionSigTSTP + SIGTTIN ControlExceptionSigTTIN + SIGTTOU ControlExceptionSigTTOU + SIGBUS ControlExceptionSigBUS + SIGPROF ControlExceptionSigPROF + SIGSYS ControlExceptionSigSYS + SIGTRAP ControlExceptionSigTRAP + SIGURG Undefined + SIGVTALRM ControlExceptionSigVTALRM + SIGXCPU ControlExceptionSigXCPU + SIGXFSZ ControlExceptionSigXFSZ + SIGEMT ControlExceptionSigEMT + SIGSTKFLT ControlExceptionSigSTKFLT + SIGIO ControlExceptionSigIO + SIGPWR ControlExceptionSigPWR + SIGLOST ControlExceptionSigLOST + SIGWINCH Undefined + +=head2 Signal exceptions + +A table below describes the exceptions. + +Each of these has a default action as well. The possible actions are: + + Term Default action is to terminate the process. + + Ign Default action is to ignore the signal ($signal.exception is undef by default) + + Core Default action is to terminate the process and dump core (see core(5)). + + Stop Default action is to stop the process. + + Cont Default action is to continue the process if it is currently stopped. + +Some actions do the Resumeable role. An exception listed in the table below that does the +Resumeable role is marked with a * in the R column. + +The exceptions are: + + Signal Action R Comment + ---------------------------------------------------------------------- + ControlExceptionSigHUP Term ? Hangup detected on controlling terminal or death of controlling process + ControlExceptionSigINT Term ? Interrupt from keyboard + ControlExceptionSigQUIT Core ? Quit from keyboard + ControlExceptionSigILL Core ? Illegal Instruction + ControlExceptionSigABRT Core ? Abort signal from abort(3) + ControlExceptionSigFPE Core ? Floating point exception + ControlExceptionSigKILL Term ? Kill signal + ControlExceptionSigSEGV Core Invalid memory reference + ControlExceptionSigPIPE Term ? Broken pipe: write to pipe with no readers + ControlExceptionSigALRM Term ? Timer signal from alarm(2) + ControlExceptionSigTERM Term ? Termination signal + ControlExceptionSigUSR1 Term ? User-defined signal 1 + ControlExceptionSigUSR2 Term ? User-defined signal 2 + ControlExceptionSigCHLD Ign * Child stopped or terminated + ControlExceptionSigCONT Cont * Continue if stopped + ControlExceptionSigSTOP Stop ? Stop process + ControlExceptionSigTSTP Stop ? Stop typed at tty + ControlExceptionSigTTIN Stop ? tty input for background process + ControlExceptionSigTTOU Stop ? tty output for background process + ControlExceptionSigBUS Core ? Bus error (bad memory access) + ControlExceptionSigPROF Term ? Profiling timer expired + ControlExceptionSigSYS Core ? Bad argument to routine (SVr4) + ControlExceptionSigTRAP Core ? Trace/breakpoint trap + ControlExceptionSigURG Ign ? Urgent condition on socket (4.2BSD) + ControlExceptionSigVTALRM Term ? Virtual alarm clock (4.2BSD) + ControlExceptionSigXCPU Core ? CPU time limit exceeded (4.2BSD) + ControlExceptionSigXFSZ Core ? File size limit exceeded (4.2BSD) + ControlExceptionSigEMT Term ? + ControlExceptionSigSTKFLT Term ? Stack fault on coprocessor (unused) + ControlExceptionSigIO Term ? I/O now possible (4.2BSD) + ControlExceptionSigPWR Term ? Power failure (System V) + ControlExceptionSigLOST Term ? File lock lost + ControlExceptionSigWINCH Ign ? Window resize signal (4.3BSD, Sun) + +See L<S04-control> for details on how to handle exceptions. + +XXX I'm unsure how the actions in the table above can be made to make sense. The Ign +actions are already dealt with because %SIG{CHLD}.exception already defaults to undef. +The Term action will probably be self-solving (ie. will terminate the process). The +others I'm just plain unsure about. XXX + +=head1 Alarm + +XXX Everything about Alarm is from the old S17-concurrency.pod + +An alarm is just a pre-arranged exception to be delivered to your program. + +By the time alarm has arrived, the current block may have already finished +executing, so you would need to set up CATCH blocks in places where an alarm +can rise to handle it properly. + +You can request an alarm using the number of seconds, or with a target date. +It returns a proxy alarm object that you can do interesting things with. + + multi Alarm *alarm (Num $seconds = $CALLER::_, &do = {die Sig::ALARM}, repeat = 1) + multi Alarm *alarm (Date $date, &do = {die Sig::ALARM}, repeat = 1) + +Perl 6's C<alarm> has three additional features over traditional alarms: + +=head2 Multiple and Lexical Alarms + +One can set up multiple alarms using repeated alarm calls: + + { + my $a1 = alarm(2); + my $a2 = alarm(2); + sleep 10; + CATCH { + is critical; # if you don't want $a2 to be raised inside this + when Sig::ALARM { ... } + } + } + +To stop an alarm, call C<$alarm.stop>. The C<alarms> method for Conc objects +(including process and threads) returns a list of alarms currently scheduled +for that concurrent context. + +When an alarm object is garbage collected, the alarm is stopped automatically. +Under void context, the implicit alarm object can only be stopped by querying +C<.alarms> on the current process. + +We are not sure what C<alarm(0)> would mean. Probably a deprecation warning? + +=head2 Repeated Alarms + +If you request a repeated alarm using the C<repeated> named argument, it will +attempt to fire off the alarm that many times. However, the alarm will be +suppressed when inside a C<CATCH> block that's already handling the exception +raised by I<same> alarm. + +To repeat 0 times is to not fire off any alarms at all. To repeat +Inf times +is to repeat over and over again. + +=head2 Callbacks in Alarms + +You can arrange a callback (like JavaScript's setTimeOut) in C<alarm>, which +will then be invoked with the then-current code as caller. + +If you set up such a callback to another Conc object, what happens is just like +when you called C<.die> on behalf of that object -- namely, the callback +closure, along with anything it referenced, is shared to the target Conc +context. + +Unlike in Perl 5's ithreads where you cannot share anything after the fact, +this allows passing shared objects in an C<ad-hoc> fashion across concurrent +parts of the program. Under the default (multiplexing) concurrency model, this +is basically a no-op. + +=head1 IPC + +=head1 Concurrency + This is a draft document. After being some time under the surface of Perl 6 development this is a attempt to document working concurrency issues, list the remaining todos and mark the probably obsolete and redundant points. -=head1 Overview +=head2 Overview + Concurrency can take many forms in Perl 6. With varying degrees of explicitness and control capabilities. This document attempts to describe what these capabilities are and in which form they can be accessed in Perl 6. -=head2 Processes, threads, fibers? +=head3 Processes, threads, fibers? Concurrency comes in many shapes and forms. Most Perl users are used to the concept of a "process" or a "thread" (usually depending on the OS they @@ -55,7 +269,7 @@ And for sake of consistency, an unthreaded "normal" program is considered to be also running in a single thread. -=head2 Variables +=head3 Variables In the past, there have been two models for concurrent processes in Perl. In general, these are referred to as "5.005 threads" (C<perldoc perlothrtut>) @@ -80,9 +294,9 @@ access inside a thread, except for those with an explicit "is shared" attribute?) -=head1 Contend/Maybe/Defer +=head2 Contend/Maybe/Defer -=head2 No user accessible locks +=head3 No user accessible locks Differently from any current concurrent process implementation in Perl, there are no user accessible locks. Instead, the concept of Software @@ -110,7 +324,7 @@ (EM: maybe point out if / how old style locks can be "simulated", for those needing a migration path?) -=head2 Atomic Code blocks +=head3 Atomic Code blocks my ($x, $y); sub c { @@ -135,7 +349,7 @@ which execution can return (in exactly the same state) if a problem occurs (a.k.a. a L<defer> is done) inside the scope of the Code block. -=head3 defer +=head4 defer The C<defer> function basically restores the state of the thread at the last checkpoint and will wait there until an external event allows it to @@ -148,7 +362,7 @@ The last checkpoint is either the outermost C<contend> boundary, or the most immediate caller constructed with C<maybe>. -=head3 maybe +=head4 maybe The C<maybe> statement causes a checkpoint to be made for C<defer> for each block in the C<maybe> chain, creating an alternate execution path to @@ -169,7 +383,7 @@ If placed outside a C<contend> block, the C<maybe> statement creates its own C<contend> barrier. -=head3 limitations +=head4 limitations Because Perl 6 must be able to revert its state to the state it had at the checkpoint, it is not allowed to perform any non-revertible actions. These @@ -185,7 +399,7 @@ If you're not interested in revertability, but are interested in uninterruptability, you could use the "is critical" trait. -=head3 Critical Code blocks +=head4 Critical Code blocks sub tricky is critical { # code accessing external info, not to be interrupted @@ -201,7 +415,7 @@ non-seekable file handles), it cannot do a C<defer> as it would be impossible to restore the state to the beginning of the Code block. -=head3 Mixing Atomic and Critical +=head4 Mixing Atomic and Critical Both "atomic" as well as "critical" propagate down the call chain. This means that any subroutine that in itself is not "atomic" or "critical" becomes @@ -216,7 +430,7 @@ of an Atomic Code block. -=head1 Co-Routines +=head2 Co-Routines There is no real difference between a subroutine (or method) and a so-called 'co-routine'. The only difference is how control is relinquished by the @@ -244,7 +458,7 @@ looking at them, but will B<not> be handled automatically. It would seem that the use of named parameters is therefore advisable. -=head2 Coroutine attributes +=head3 Coroutine attributes =over @@ -254,7 +468,7 @@ =back -=head2 Coroutine methods +=head3 Coroutine methods =over @@ -264,7 +478,7 @@ =back -=head2 Coroutine examples +=head3 Coroutine examples =over @@ -296,7 +510,7 @@ =back -=head1 Threads +=head2 Threads All outside of a thread defined variables are shared and transactional variables by default @@ -305,7 +519,7 @@ Unjoined threads will be joined at the beginning of the END block batch of the parent thread that spawned them -=head2 Thread creation +=head3 Thread creation A thread will be created using the keyword C<async> followed by a codeblock being executed in this thread. @@ -316,7 +530,7 @@ }; -=head2 Thread status and attributes +=head3 Thread status and attributes =over @@ -361,7 +575,7 @@ =back -=head2 Thread operators +=head3 Thread operators =over @@ -385,7 +599,7 @@ =back -=head2 Thread methods +=head3 Thread methods =over @@ -456,93 +670,16 @@ =back -=head2 Signals +=head3 Continuations -Asynchronous exceptions are just like user-initiated exceptions with C<die>, -so you can also catch it with regular C<CATCH> blocks as specified in S04. - -To declare your main program catches INT signals, put a CATCH block anywhere -in the toplevel to handle exceptions like this: - - CATCH { - when Error::Signal::INT { ... } - } - -=head2 Alarm - -An alarm is just a pre-arranged exception to be delivered to your program. - -By the time alarm has arrived, the current block may have already finished -executing, so you would need to set up CATCH blocks in places where an alarm -can rise to handle it properly. - -You can request an alarm using the number of seconds, or with a target date. -It returns a proxy alarm object that you can do interesting things with. - - multi Alarm *alarm (Num $seconds = $CALLER::_, &do = {die Sig::ALARM}, repeat = 1) - multi Alarm *alarm (Date $date, &do = {die Sig::ALARM}, repeat = 1) - -Perl 6's C<alarm> has three additional features over traditional alarms: - -=head3 Multiple and Lexical Alarms - -One can set up multiple alarms using repeated alarm calls: - - { - my $a1 = alarm(2); - my $a2 = alarm(2); - sleep 10; - CATCH { - is critical; # if you don't want $a2 to be raised inside this - when Sig::ALARM { ... } - } - } - -To stop an alarm, call C<$alarm.stop>. The C<alarms> method for Conc objects -(including process and threads) returns a list of alarms currently scheduled -for that concurrent context. - -When an alarm object is garbage collected, the alarm is stopped automatically. -Under void context, the implicit alarm object can only be stopped by querying -C<.alarms> on the current process. - -We are not sure what C<alarm(0)> would mean. Probably a deprecation warning? - -=head3 Repeated Alarms - -If you request a repeated alarm using the C<repeated> named argument, it will -attempt to fire off the alarm that many times. However, the alarm will be -suppressed when inside a C<CATCH> block that's already handling the exception -raised by I<same> alarm. - -To repeat 0 times is to not fire off any alarms at all. To repeat +Inf times -is to repeat over and over again. - -=head3 Callbacks in Alarms - -You can arrange a callback (like JavaScript's setTimeOut) in C<alarm>, which -will then be invoked with the then-current code as caller. - -If you set up such a callback to another Conc object, what happens is just like -when you called C<.die> on behalf of that object -- namely, the callback -closure, along with anything it referenced, is shared to the target Conc -context. - -Unlike in Perl 5's ithreads where you cannot share anything after the fact, -this allows passing shared objects in an C<ad-hoc> fashion across concurrent -parts of the program. Under the default (multiplexing) concurrency model, this -is basically a no-op. - -=head2 Continuations - TODO document -=head2 Junctive Autothreading and Hyper Operations +=head3 Junctive Autothreading and Hyper Operations Live in userland for the time being. -=head2 Still more or less unorganized stuff +=head3 Still more or less unorganized stuff ### INTERFACE BARRIER ### @@ -581,16 +718,12 @@ } ### INTERFACE BARRIER ### -=head2 See also +=head3 See also =over =item * -L<S16/Interprocess Communication> - -=item * - L<S16/IE<sol>O Considerations> =item * @@ -605,4 +738,11 @@ =cut +=head1 Additions + +Please post errors and feedback to perl6-language. If you are making +a general laundry list, please separate messages by topic. + +=cut + =for vim:set expandtab sw=4:
|
| | Add comment |
|
| r25615 - docs/Perl6/Spec/S32-setting-library Guest 12:33:13 |
| | Author: wayland Date: 2009-02-27 10:33:12 +0100 (Fri, 27 Feb 2009) New Revision: 25615
Modified: docs/Perl6/Spec/S32-setting-library/Str.pod Log: Typo, my bad. wayland-- Incidentally, I can karma myself here, I think
Modified: docs/Perl6/Spec/S32-setting-library/Str.pod =================================================================== --- docs/Perl6/Spec/S32-setting-library/Str.pod 2009-02-27 09:19:30 UTC (rev 25614) +++ docs/Perl6/Spec/S32-setting-library/Str.pod 2009-02-27 09:33:12 UTC (rev 25615) @@ -511,8 +511,6 @@ method Str subst(Str $self: Regex $search, Str $replacement); -XXX Does this return a Match? A Str? - =item trans method trans(Str $self: Str $key, Str $val);
|
| | Add comment |
|
| r25612 - in docs/Perl6/Spec: . S32-setting-library Guest 11:28:45 |
| | Author: wayland Date: 2009-02-27 09:28:45 +0100 (Fri, 27 Feb 2009) New Revision: 25612
Modified: docs/Perl6/Spec/S28-special-names.pod docs/Perl6/Spec/S32-setting-library/IO.pod Log: IO.pod/S28: Regularised %*PROTOCOLS
Modified: docs/Perl6/Spec/S28-special-names.pod =================================================================== --- docs/Perl6/Spec/S28-special-names.pod 2009-02-27 08:26:45 UTC (rev 25611) +++ docs/Perl6/Spec/S28-special-names.pod 2009-02-27 08:28:45 UTC (rev 25612) @@ -106,6 +106,7 @@ $*PID Int # system process id %=POD S02 # (or some such) $*PROGRAM_NAME Str # name of the Perl program being executed + %*PROTOCOLS S16 Hash of Method # Stores the methods needed for the uri() function ::?ROLE Str # current role (as package or type name) $?ROLE Role # current role &?ROUTINE S06 Routine # current sub or method (itself)
Modified: docs/Perl6/Spec/S32-setting-library/IO.pod =================================================================== --- docs/Perl6/Spec/S32-setting-library/IO.pod 2009-02-27 08:26:45 UTC (rev 25611) +++ docs/Perl6/Spec/S32-setting-library/IO.pod 2009-02-27 08:28:45 UTC (rev 25612) @@ -74,7 +74,7 @@ These can naturally be overridden or added to by other modules. -=item %PROTOCOLS global variable +=item %*PROTOCOLS global variable For each protocol, stores a type name that should be instantiated by calling the .uri() constructor on that type, and passing in the appropriate uri.
|
| | Add comment |
|
| r25610 - docs/Perl6/Spec/S32-setting-library Guest 11:16:29 |
| | Author: wayland Date: 2009-02-27 09:16:28 +0100 (Fri, 27 Feb 2009) New Revision: 25610
Modified: docs/Perl6/Spec/S32-setting-library/IO.pod Log: IO.pod: Got rid of code, replaced it with spec
Modified: docs/Perl6/Spec/S32-setting-library/IO.pod =================================================================== --- docs/Perl6/Spec/S32-setting-library/IO.pod 2009-02-27 07:42:32 UTC (rev 25609) +++ docs/Perl6/Spec/S32-setting-library/IO.pod 2009-02-27 08:16:28 UTC (rev 25610) @@ -61,9 +61,10 @@ =item uri IO::Streamable method uri(Str $uri); + IO::Streamable sub uri(Str $uri); Returns an appropriate IO::Streamable descendant, with the type depending on the uri -passed in. Here's the mapping: +passed in. Here are some example mappings: URI type IO type ======== ======= @@ -71,15 +72,12 @@ ftp: IO::Socket::TCP (data channel) http: IO::Socket::TCP -IO::Streamable method uri(Str $uri) { - $uri.match(/^<alnum>+\:/); - return(&$PROTOCOLS{$1}($uri)); -} +These can naturally be overridden or added to by other modules. =item %PROTOCOLS global variable -For each protocol, stores a subroutine reference that returns the appropriate object when -the URI is passed in. +For each protocol, stores a type name that should be instantiated by calling the .uri() +constructor on that type, and passing in the appropriate uri. =back
|
| | Add comment |
|
| r25609 - docs/Perl6/Spec Guest 10:42:32 |
| | Author: lwall Date: 2009-02-27 08:42:32 +0100 (Fri, 27 Feb 2009) New Revision: 25609
Modified: docs/Perl6/Spec/S06-routines.pod Log: typo
Modified: docs/Perl6/Spec/S06-routines.pod =================================================================== --- docs/Perl6/Spec/S06-routines.pod 2009-02-27 07:40:26 UTC (rev 25608) +++ docs/Perl6/Spec/S06-routines.pod 2009-02-27 07:42:32 UTC (rev 25609) @@ -240,7 +240,7 @@ Redefining a stub subroutine does not produce an error, but redefining an already-defined subroutine does. If you wish to redefine a defined sub, you must explicitly use the "C<supersede>" declarator. (The compiler may -refuse to do this if it has already commited to the previous definition.) +refuse to do this if it has already committed to the previous definition.) The C<...> is the "yadayadayada" operator, which is executable but returns a failure. You can also use C<???> to produce a warning, or C<!!!> to
|
| | Add comment |
|
| r25607 - docs/Perl6/Spec Guest 10:39:57 |
| | Author: lwall Date: 2009-02-27 08:39:57 +0100 (Fri, 27 Feb 2009) New Revision: 25607
Modified: docs/Perl6/Spec/S06-routines.pod docs/Perl6/Spec/S12-objects.pod Log: deprecate "is also" and "is instead" in favor of augment and supersede declarators
Modified: docs/Perl6/Spec/S06-routines.pod =================================================================== --- docs/Perl6/Spec/S06-routines.pod 2009-02-27 07:03:18 UTC (rev 25606) +++ docs/Perl6/Spec/S06-routines.pod 2009-02-27 07:39:57 UTC (rev 25607) @@ -13,9 +13,9 @@ Maintainer: Larry Wall <larry@wall.org> Date: 21 Mar 2003 - Last Modified: 24 Feb 2009 + Last Modified: 26 Feb 2009 Number: 6 - Version: 103 + Version: 104 This document summarizes Apocalypse 6, which covers subroutines and the @@ -239,7 +239,8 @@ Redefining a stub subroutine does not produce an error, but redefining an already-defined subroutine does. If you wish to redefine a defined sub, -you must explicitly use the "C<is instead>" trait. +you must explicitly use the "C<supersede>" declarator. (The compiler may +refuse to do this if it has already commited to the previous definition.) The C<...> is the "yadayadayada" operator, which is executable but returns a failure. You can also use C<???> to produce a warning, or C<!!!> to
Modified: docs/Perl6/Spec/S12-objects.pod =================================================================== --- docs/Perl6/Spec/S12-objects.pod 2009-02-27 07:03:18 UTC (rev 25606) +++ docs/Perl6/Spec/S12-objects.pod 2009-02-27 07:39:57 UTC (rev 25607) @@ -14,7 +14,7 @@ Date: 27 Oct 2004 Last Modified: 26 Feb 2009 Number: 12 - Version: 70 + Version: 71 =head1 Overview @@ -1463,15 +1463,16 @@ you can add more methods to them, though you have to be explicit that that is what you're doing: - class Object is also { + augment class Object { method wow () { say "Wow, I'm an object." } } Otherwise you'll get a class redefinition error. (Also, to completely -replace a definition, use "C<is instead>" instead of "C<is also>"...but -don't do that.) +replace a definition, use "C<supersede>" instead of "C<augment>"...but +don't do that, since the compiler may have already committed to +optimizations based on the old definition.) -In order to discourage casual misuse of these traits, they are not +In order to discourage casual misuse of these declarators, they are not allowed on global classes unless you put a special declaration at the top: use MONKEY_PATCHING;
|
| | Add comment |
|
| r25606 - docs/Perl6/Spec Guest 10:03:18 |
| | Author: lwall Date: 2009-02-27 08:03:18 +0100 (Fri, 27 Feb 2009) New Revision: 25606
Modified: docs/Perl6/Spec/S02-bits.pod docs/Perl6/Spec/S12-objects.pod Log: some enum cleanup
Modified: docs/Perl6/Spec/S02-bits.pod =================================================================== --- docs/Perl6/Spec/S02-bits.pod 2009-02-27 06:46:09 UTC (rev 25605) +++ docs/Perl6/Spec/S02-bits.pod 2009-02-27 07:03:18 UTC (rev 25606) @@ -12,9 +12,9 @@ Maintainer: Larry Wall <larry@wall.org> Date: 10 Aug 2004 - Last Modified: 25 Feb 2009 + Last Modified: 26 Feb 2009 Number: 2 - Version: 155 + Version: 156 This document summarizes Apocalypse 2, which covers small-scale lexical items and typological issues. (These Synopses also contain @@ -2459,8 +2459,8 @@ Fat arrow Adverbial pair Paren form ========= ============== ========== - a => 1 :a - a => 0 :!a + a => True :a + a => False :!a a => 0 :a(0) a => $x :a($x) a => 'foo' :a<foo> :a(<foo>)
Modified: docs/Perl6/Spec/S12-objects.pod =================================================================== --- docs/Perl6/Spec/S12-objects.pod 2009-02-27 06:46:09 UTC (rev 25605) +++ docs/Perl6/Spec/S12-objects.pod 2009-02-27 07:03:18 UTC (rev 25606) @@ -12,9 +12,9 @@ Maintainer: Larry Wall <larry@wall.org> Date: 27 Oct 2004 - Last Modified: 12 Feb 2009 + Last Modified: 26 Feb 2009 Number: 12 - Version: 69 + Version: 70 =head1 Overview @@ -1298,11 +1298,6 @@ my enum Day ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; my enum Day <Sun Mon Tue Wed Thu Fri Sat>; -For any enum value the C<.perl> method will return its long name. -A numeric enum value numifies to its numeric value and stringifies to its short name. -A string enum value has no special numeric value, and stringifies to its string value -rather than its name. [XXX inconsistent] - If the first value is unspecified, it defaults to 0. To specify the first value, use pair notation (see below). @@ -1316,6 +1311,23 @@ my Int enum day ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; my enum day of uint4 <Sun Mon Tue Wed Thu Fri Sat>; +For any enum value of an object type, the object itself knows its own +type, so the C<.perl> method will return its long name, while C<.name> +returns its short name. Other than that, number valued enums act +just like numbers, while string valued enums act just like strings. + +Enums based on native types may be used only for their value, since a +native value doesn't know its own type. To translate such a value back to its name +requires a call to the name method, which must be qualified by the type: + + 3.day::name # returns "Wed" + +Alternatively, native types may be placed in a typed variable, which determines +which method to call: + + my day $d = 3; + $d.name # returns "Wed" + An anonymous enum just makes sure each string turns into a pair with sequentially increasing values, so: @@ -1414,11 +1426,11 @@ Two built-in enums are: - our bit enum Bool <False True>; - our bit enum Taint <Untainted Tainted>; + our Bit enum Bool <False True>; + our Bit enum Taint <Untainted Tainted>; Note that C<Bool> and C<Taint> are really role names, and the enum -values are really subset types of the C<bit> integer type. You can +values are really subset types of the C<Bit> integer type. You can call the C<.Bool> coercion or the C<true> function or the C<?> prefix operator on any built-in type, but the value returned is of type C<bit>. Never compare a value to "C<true>", or even "C<True>".
|
| | Add comment |
|
| r25605 - docs/Perl6/Spec/S32-setting-library Guest 09:46:10 |
| | Author: wayland Date: 2009-02-27 07:46:09 +0100 (Fri, 27 Feb 2009) New Revision: 25605
Modified: docs/Perl6/Spec/S32-setting-library/Containers.pod Log: Typo. martin++
Modified: docs/Perl6/Spec/S32-setting-library/Containers.pod =================================================================== --- docs/Perl6/Spec/S32-setting-library/Containers.pod 2009-02-27 05:04:59 UTC (rev 25604) +++ docs/Perl6/Spec/S32-setting-library/Containers.pod 2009-02-27 06:46:09 UTC (rev 25605) @@ -703,7 +703,7 @@ =head2 Junction -All method calls on Junctions autohread if there's no such method in the +All method calls on Junctions autothread if there's no such method in the Junction class. =over 4
|
| | Add comment |
|
| Rakudo Perl development release #14 ("Vienna") Patrick R. Michaud 09:05:17 |
| | On behalf of the Rakudo development team, I'm pleased to announce the February 2009 development release of Rakudo Perl #14 "Vienna". Rakudo is an implementation of Perl 6 on the Parrot Virtual Machine [1]. The tarball for the February 2009 release is available from
http://www.pmichaud.com/perl6/rakudo-2009-02.tar.gz
However, because of the rapid pace of Rakudo development and addition of new features, we still recommend that people wanting to use or work with Rakudo obtain the latest version directly from the main repository at github -- more on this in a bit.
This is the fourteenth development release of Rakudo Perl, but it's the first release independent from Parrot releases. We will continue to follow a monthly release cycle, with each release to be code named after a Perl Mongers group. This release is named for Vienna.pm (http://vienna.pm.org), who have been sponsoring Jonathan Worthington's work on Rakudo since April 2008. A list of the other planned release dates and codenames for 2009 is available in the "docs/release_guide.pod" file. In general, Rakudo development releases are scheduled to occur two days after each Parrot monthly release. Parrot releases the third Tuesday of each month.
Rakudo Perl now uses git [2] for its version control system, hosted at http://github.com/rakudo/rakudo . The README file there is kept up-to-date with the latest instructions for obtaining and building Rakudo Perl.
In this release of Rakudo Perl, we've made the following major changes and improvements:
* Rakudo is now passing 7076 spectests. This is an increase of 796 passing tests since the January 2009 release.
* The Configure.pl script supports a "--gen-parrot" option to automatically fetch and build the appropriate version of Parrot.
* The default make target now builds a binary executable directly, either perl6 or perl6.exe. It's still a Parrot "fakecutable", but we think we've made it more reliable so that it doesn't generate segmentation faults on exits. (If you don't know what a "fakecutable" is you can safely ignore this.)
* Many builtins are beginning to be written in pure Perl 6, or Perl 6 functions with inline PIR. These builtins are part of the core "setting" for Perl 6, and appear in the src/setting/ directory. Previously this was known as the "prelude".
* Improved Test.pm diagnostic output.
Also, Rakudo now implements the following Perl 6 features:
* Anonymous classes may be specified using :: * Existing parameterized roles are now reused instead of creating new ones. * Roles pun a class when .new is invoked on them. * "proto" now marks all same-named routines as "multi". * "XopX" is now "Xop". * <-> (rw) pointy blocks. * min= and max= metaoperators. * Many many bugfixes and documentation improvements.
The development team thanks all of our contributors and sponsors for making Rakudo Perl possible. The next release of Rakudo (#15) is scheduled for March 19, 2009.
References: [1] Parrot, http://parrot.org/ [2] Git version control system, http://git-scm.org/
|
| | Add comment |
|
| r25604 - in docs/Perl6/Spec: . S32-setting-library Guest 08:05:00 |
| | Author: wayland Date: 2009-02-27 06:04:59 +0100 (Fri, 27 Feb 2009) New Revision: 25604
Modified: docs/Perl6/Spec/S16-io.pod docs/Perl6/Spec/S32-setting-library/Str.pod Log: Various small fixes, mostly to signals
Modified: docs/Perl6/Spec/S16-io.pod =================================================================== --- docs/Perl6/Spec/S16-io.pod 2009-02-27 04:28:08 UTC (rev 25603) +++ docs/Perl6/Spec/S16-io.pod 2009-02-27 05:04:59 UTC (rev 25604) @@ -106,7 +106,7 @@ SIGTERM ControlExceptionSigTERM SIGUSR1 ControlExceptionSigUSR1 SIGUSR2 ControlExceptionSigUSR2 - SIGCHLD undef + SIGCHLD ControlExceptionSigCHLD SIGCONT ControlExceptionSigCONT SIGSTOP ControlExceptionSigSTOP SIGTSTP ControlExceptionSigTSTP @@ -116,7 +116,7 @@ SIGPROF ControlExceptionSigPROF SIGSYS ControlExceptionSigSYS SIGTRAP ControlExceptionSigTRAP - SIGURG undef + SIGURG Undefined SIGVTALRM ControlExceptionSigVTALRM SIGXCPU ControlExceptionSigXCPU SIGXFSZ ControlExceptionSigXFSZ @@ -125,7 +125,7 @@ SIGIO ControlExceptionSigIO SIGPWR ControlExceptionSigPWR SIGLOST ControlExceptionSigLOST - SIGWINCH undef + SIGWINCH Undefined =head2 Signal exceptions @@ -163,7 +163,7 @@ ControlExceptionSigTERM Term ? Termination signal ControlExceptionSigUSR1 Term ? User-defined signal 1 ControlExceptionSigUSR2 Term ? User-defined signal 2 - ControlExceptionSigCHLD Ign ? Child stopped or terminated + ControlExceptionSigCHLD Ign * Child stopped or terminated ControlExceptionSigCONT Cont * Continue if stopped ControlExceptionSigSTOP Stop ? Stop process ControlExceptionSigTSTP Stop ? Stop typed at tty
Modified: docs/Perl6/Spec/S32-setting-library/Str.pod =================================================================== --- docs/Perl6/Spec/S32-setting-library/Str.pod 2009-02-27 04:28:08 UTC (rev 25603) +++ docs/Perl6/Spec/S32-setting-library/Str.pod 2009-02-27 05:04:59 UTC (rev 25604) @@ -3,7 +3,7 @@ =head1 Title -DRAFT: Synopsis 32: Setting Library - Miscellaneous Scalars +DRAFT: Synopsis 32: Setting Library - Str =head1 Version
|
| | Add comment |
|
| r25573 - in docs/Perl6/Spec: . S32-setting-library Guest 08:03:55 |
| | Author: wayland Date: 2009-02-26 04:43:20 +0100 (Thu, 26 Feb 2009) New Revision: 25573
Added: docs/Perl6/Spec/S32-setting-library/Exception.pod Modified: docs/Perl6/Spec/S16-io.pod docs/Perl6/Spec/S32-setting-library/Numeric.pod Log: Numeric.pod: Added some notes on what needs to be documented here S16 and Exception.pod: Did some work on turning signals into exceptions. I probably need to pre-emptively ask for forgiveness for just making stuff up here .
Modified: docs/Perl6/Spec/S16-io.pod =================================================================== --- docs/Perl6/Spec/S16-io.pod 2009-02-26 02:46:46 UTC (rev 25572) +++ docs/Perl6/Spec/S16-io.pod 2009-02-26 03:43:20 UTC (rev 25573) @@ -73,22 +73,125 @@ =head1 POSIX Signals +The %*SIG variable contains a Hash of Proc::Signals::Signal. + +class Signal { + has $exception; # This specifies what exception will be raised when this signal is received + has $interrupt; # See siginterrupt(3) + has $blocked; # Is this signal blocked? cf. sigprocmask +} + +The @*SIGQUEUE array contains a queue of the signals that are blocked and queued. + The standard POSIX signals simply raise control exceptions that are handled as normal -through the signal handler, except for the fact that some of them are resumeable. The -exception names are: +through the control signal handler, and caught by CONTROL blocks. -=over +=head2 Signal defaults -=item * ControlExceptionSigHUP +The signals have defaults as specified in the table below. $blocked always defaults to +false. -=item * ControlExceptionSigTERM + Signal Default Exception + ------ ----------------- + SIGHUP ControlExceptionSigHUP + SIGINT ControlExceptionSigINT + SIGQUIT ControlExceptionSigQUIT + SIGILL ControlExceptionSigILL + SIGABRT ControlExceptionSigABRT + SIGFPE ControlExceptionSigFPE + SIGKILL ControlExceptionSigKILL + SIGSEGV ControlExceptionSigSEGV + SIGPIPE ControlExceptionSigPIPE + SIGALRM ControlExceptionSigALRM + SIGTERM ControlExceptionSigTERM + SIGUSR1 ControlExceptionSigUSR1 + SIGUSR2 ControlExceptionSigUSR2 + SIGCHLD undef + SIGCONT ControlExceptionSigCONT + SIGSTOP ControlExceptionSigSTOP + SIGTSTP ControlExceptionSigTSTP + SIGTTIN ControlExceptionSigTTIN + SIGTTOU ControlExceptionSigTTOU + SIGBUS ControlExceptionSigBUS + SIGPROF ControlExceptionSigPROF + SIGSYS ControlExceptionSigSYS + SIGTRAP ControlExceptionSigTRAP + SIGURG undef + SIGVTALRM ControlExceptionSigVTALRM + SIGXCPU ControlExceptionSigXCPU + SIGXFSZ ControlExceptionSigXFSZ + SIGEMT ControlExceptionSigEMT + SIGSTKFLT ControlExceptionSigSTKFLT + SIGIO ControlExceptionSigIO + SIGPWR ControlExceptionSigPWR + SIGLOST ControlExceptionSigLOST + SIGWINCH undef -=item * ControlExceptionSigINT +=head2 Signal exceptions -=back +A table below describes the exceptions. +Each of these has a default action as well. The possible actions are: + + Term Default action is to terminate the process. + + Ign Default action is to ignore the signal ($signal.exception is undef by default) + + Core Default action is to terminate the process and dump core (see core(5)). + + Stop Default action is to stop the process. + + Cont Default action is to continue the process if it is currently stopped. + +Some actions do the Resumeable role. An exception listed in the table below that does the +Resumeable role is marked with a * in the R column. + +The exceptions are: + + Signal Action R Comment + ---------------------------------------------------------------------- + ControlExceptionSigHUP Term ? Hangup detected on controlling terminal or death of controlling process + ControlExceptionSigINT Term ? Interrupt from keyboard + ControlExceptionSigQUIT Core ? Quit from keyboard + ControlExceptionSigILL Core ? Illegal Instruction + ControlExceptionSigABRT Core ? Abort signal from abort(3) + ControlExceptionSigFPE Core ? Floating point exception + ControlExceptionSigKILL Term ? Kill signal + ControlExceptionSigSEGV Core Invalid memory reference + ControlExceptionSigPIPE Term ? Broken pipe: write to pipe with no readers + ControlExceptionSigALRM Term ? Timer signal from alarm(2) + ControlExceptionSigTERM Term ? Termination signal + ControlExceptionSigUSR1 Term ? User-defined signal 1 + ControlExceptionSigUSR2 Term ? User-defined signal 2 + ControlExceptionSigCHLD Ign ? Child stopped or terminated + ControlExceptionSigCONT Cont * Continue if stopped + ControlExceptionSigSTOP Stop ? Stop process + ControlExceptionSigTSTP Stop ? Stop typed at tty + ControlExceptionSigTTIN Stop ? tty input for background process + ControlExceptionSigTTOU Stop ? tty output for background process + ControlExceptionSigBUS Core ? Bus error (bad memory access) + ControlExceptionSigPROF Term ? Profiling timer expired + ControlExceptionSigSYS Core ? Bad argument to routine (SVr4) + ControlExceptionSigTRAP Core ? Trace/breakpoint trap + ControlExceptionSigURG Ign ? Urgent condition on socket (4.2BSD) + ControlExceptionSigVTALRM Term ? Virtual alarm clock (4.2BSD) + ControlExceptionSigXCPU Core ? CPU time limit exceeded (4.2BSD) + ControlExceptionSigXFSZ Core ? File size limit exceeded (4.2BSD) + ControlExceptionSigEMT Term ? + ControlExceptionSigSTKFLT Term ? Stack fault on coprocessor (unused) + ControlExceptionSigIO Term ? I/O now possible (4.2BSD) + ControlExceptionSigPWR Term ? Power failure (System V) + ControlExceptionSigLOST Term ? File lock lost + ControlExceptionSigWINCH Ign ? Window resize signal (4.3BSD, Sun) + See L<S04-control> for details on how to handle exceptions. +XXX I'm unsure how the actions in the table above can be made to make sense. The Ign +actions are already dealt with because %SIG{CHLD}.exception already defaults to undef. +The Term action will probably be self-solving (ie. will terminate the process). The +others I'm just plain unsure about. XXX + + =head1 Additions Please post errors and feedback to perl6-language. If you are making
Added: docs/Perl6/Spec/S32-setting-library/Exception.pod =================================================================== --- docs/Perl6/Spec/S32-setting-library/Exception.pod (rev 0) +++ docs/Perl6/Spec/S32-setting-library/Exception.pod 2009-02-26 03:43:20 UTC (rev 25573) @@ -0,0 +1,52 @@ + +=encoding utf8 + +=head1 Title + +DRAFT: Synopsis 32: Setting Library - Exception + +=head1 Version + + Author: Tim Nelson <wayland@wayland.id.au> + Maintainer: Larry Wall <larry@wall.org> + Contributions: Tim Nelson <wayland@wayland.id.au> + Date: 26 Feb 2009 + Last Modified: 26 Feb 2009 + Version: 1 + +The document is a draft. + +If you read the HTML version, it is generated from the pod in the pugs +repository under /docs/Perl6/Spec/S32-setting-library/Exception.pod so edit it there in +the SVN repository if you would like to make changes. + +=head1 Roles + +role Exception { +# XXX How do we tell the difference between a warning and a fatal error? +} + +role Resumeable { + method resume() {...} +} + +role Failure { + method Bool {...} # XXX I'm hoping this worries about .defined and .true + method handled {...} +} + +=head1 Classes + +class Failure does Failure { + has $.handled; +} + +class ControlExceptionSigHUP does Exception does Resumeable {} + +=head1 Additions + +Please post errors and feedback to perl6-language. If you are making +a general laundry list, please separate messages by topic. + + +
Modified: docs/Perl6/Spec/S32-setting-library/Numeric.pod =================================================================== --- docs/Perl6/Spec/S32-setting-library/Numeric.pod 2009-02-26 02:46:46 UTC (rev 25572) +++ docs/Perl6/Spec/S32-setting-library/Numeric.pod 2009-02-26 03:43:20 UTC (rev 25573) @@ -24,6 +24,10 @@ repository under /docs/Perl6/Spec/S32-setting-library/Numeric.pod so edit it there in the SVN repository if you would like to make changes. +This documents Bit, Int, Num, Rat, Complex, and Bool. + +XXX So where are Bit, Int, and Rat + =head1 Function Packages =head2 Bool
|
| | 2 answer | Add comment |
|
| r25490 - docs/Perl6/Spec Guest 06:50:16 |
| | Author: wayland Date: 2009-02-23 04:47:22 +0100 (Mon, 23 Feb 2009) New Revision: 25490
Added: docs/Perl6/Spec/S28-special-variables.pod Log: Created the draft spec here. It's very drafty, but no more than some.
Also added the $*DEFIN, etc, as per S16.
Added: docs/Perl6/Spec/S28-special-variables.pod =================================================================== --- docs/Perl6/Spec/S28-special-variables.pod (rev 0) +++ docs/Perl6/Spec/S28-special-variables.pod 2009-02-23 03:47:22 UTC (rev 25490) @@ -0,0 +1,740 @@ +=head1 NAME + + [DRAFT] Synopsis 28 - Special Variables [DRAFT] + +=head1 Version + + Author: Larry Wall <larry@wall.org> + Maintainer: Larry Wall <larry@wall.org> + Contributions: Tim Nelson <wayland@wayland.id.au> + Date: 23 Feb 2009, created from miscellaneous documents lying around + Last Modified: 23 Feb 2009 + Version: 1 + +=head1 INTRODUCTION + +This document serves as a collection point +for what is known about special variables +in Perl 6 and correlates them with the changes from Perl 5. + +If you are trying to find the Perl 6 equivalent of a Perl 5 special +variable you know, try searching this file for the Perl 5 version. +Each main entry is followed by a note containing the corresponding +Perl 5 variable(s). The list of main entries is also followed by +a table showing the 5 and 6 variables side-by-side. + +Most/All variables of the form $*SOMETHING should also work in the form +$SOMETHING (without the '*') unless masked by "my $SOMETHING". + +=head1 DESCRIPTION + +=head2 Secondary Sigils (also known as "twigils"): + + $+ # currently compiling scope (see S02) + $? # lexically-scoped (compile time, see S02) + $* # global (run time, see S02) + $= # file-scoped (see S02) + $^ # implicit block argument (see S06 placeholder variables) + $< # current $/ scope (see S02) + $. # public attribute (see S12 attributes) + $! # private attribute (see S12 attributes) + + +=head2 Named variables (see S02): + + $/ # match object from last rule + $0 # first captured value from match: $/.[0] + @*ARGS # command-line arguments + &?BLOCK # current block (itself, see S06) + @?BLOCK # current blocks (themselves, see S06) + $?BLOCKLABEL # label of current block (see S06) + # XXX redundant with $?LABEL? + ::?CLASS # current class (as package name) + $?CLASS # current class (as variable) + @?CLASS # current classes + %?CONFIG # configuration hash + $=DATA # data block handle (=begin DATA ... =end) + $*DEFIN # Default input file handle (see S16) + $*DEFOUT # Default output file handle (see S16) + $*DEFERR # Default error file handle (see S16) + $*EGID # effective group id + %*ENV # system environment + $*ERR # standard error handle (but you likely want $*DEFERR) + $*EUID # effective user id + $*EXECUTABLE_NAME # executable name + $?FILE # current file + $?GRAMMAR # current grammar + @?GRAMMAR # current grammars + $*GID # group id + $*IN # standard input handle (but you likely want $*DEFIN) + $?LABEL # label of current block + @?LABEL # labels of current blocks + $?LINE # current line + $?MODULE # current module + @?MODULE # current modules + $?OS # operating system compiled for + $*OS # operating system running under + $?OSVER # operating system version compiled for + $*OSVER # operating system version running under + $*OUT # standard output handle (but you likely want $*DEFOUT) + $?PACKAGE # current package (as object) + @?PACKAGE # current packages + $?PACKAGENAME # name of current package (see S10) + $?PERLVER # perl version compiled for + $*PERLVER # perl version running under + $*PROGRAM_NAME # name of the program being executed + $*PID # system process id + $?PUGS_VERSION # Pugs version (not canonical) + $*PUGS_HAS_HSPLUGINS # True if Pugs was compiled with support for hsplugins + # (not canonical) + ::?ROLE # current role (as package name) + $?ROLE # current role (as variable) + @?ROLE # current roles + &?ROUTINE # current sub or method (itself, see S06) + @?ROUTINE # current subs or methods (themselves) + $*UID # system user id + +There were threads on p6l about unifying all variables which concern the OS or +the VM ($*UID, $*PROGRAM_NAME, etc.) into two variables, $?ENV (compile-time +environment) and $*ENV (runtime environment). Larry did like the idea, but +"ENV" is probably to overloaded to mean the hash of environment variables +(which would be found under $*ENV.environment or some-such). + + +XXX Everything below this line is older than everything above it. XXX + +=head1 NAME + + [DRAFT] Synopsis 28 - Special Variables [DRAFT] + +=head1 OUTLINE + + DRAFT NOTES + INTRODUCTION + SPECIAL VARIABLES + PERL 6 / PERL 5 COMPARISON + HISTORY + SOURCES + +=head1 DRAFT NOTES + +As of 2007-03-13: + +There is a more recent document at docs/Perl6/Overview/Variable.pod +which contains the bare bones of the next +iteration of work on special variables in Perl 6. + +While the list there appears to be more complete, there remains information +here that may still be of help in roughing in more details there. + +=head1 SPECIAL VARIABLES + +=over 8 + +=item $*IN + +=item $*OUT + +=item $*ERR + +Predefined filehandles for STDIN, STDOUT, and STDERR. + +=over 4 + +=item p5: + +Replace STDIN, STDOUT, and STDERR. + +=back + +=back + +=over 8 + +=item $_ + +The default input and pattern-searching space. +Same as in Perl 5 but lexically scoped + +=over 4 + +=item p5: + +$_ but more lexically aware. + +=back + +=back + +=over 8 + +=item $a, $b, $c ... + +Parameters of the current closure (block +or subroutine) by position in the invocation. + +=over 4 + +=item p5: + +$_[0], $_[1], $_[2] ... + +=back + +=back + +=over 8 + +=item $/ + +Object containing the results of the last regular expression match. +All match result info found in the contained data structure. +This is available as the current state of the match in progress. + +=over 4 + +=item p5: + +No direct parallel. + +=back + +=back + +=over 8 + +=item $0,$1,$2... + +Objects containing information on any subpatterns +from the corresponding set of capturing +parentheses from the last pattern match, not counting patterns +matched in nested blocks that have been exited already. +These variables are all read-only and dynamically scoped to the +current BLOCK. Shortcut to same info in $/ with data structures containing +such things as .start and .end (Unicode level independent). + +=over 4 + +=item p5: + +$1,$2,$3... but now as objects, and base zero instead of one. + +=back + +=back + +=over 8 + +=item $0 + +$0 (dollar-zero) is the string matched by the last successful +pattern match (not counting any matches hidden within a BLOCK +or eval() enclosed by the current BLOCK). +This variable is read-only and dynamically scoped to the current BLOCK. +What would be returned by $1 if you had +put parens around the entire match. $0 is not bound until +the match succeeds. + +=over 4 + +=item p5: + +$&, $MATCH + +=back + +=back + +=over 8 + +=item $*MOST_RECENT_CAPTURED_MATCH +=item $/[-1] +=item $/[-$n] + +It's not clear yet which of these would be used. +Or whether to drop this. + +=over 4 + +=item p5: + +$^N + +=back + +=back + +=over 8 + +=item $. + +=item $IN_FH.input_line_number ...or some such + +May-be. Current line number for the filehandle. +Each filehandle in Perl counts the number of lines +that have been read from it. +(Depending on the value of $IN_FH.input_rec_separator, +Perl's idea of what constitutes a line may not match yours.) +When a line is read from a filehandle, +or when tell() or seek() is called on it, +$IN_FH.input_rec_separator becomes an alias to the +line counter for that filehandle. + +=over 4 + +=item p5: + +$. $NR $INPUT_LINE_NUMBER HANDLE->input_line_number(EXPR) +But now with cleaned-up localization usage. + +=back + +=back + +=over 8 + +=item $IN_FH.input_rec_separator ...or some such + +The input record separator, newline by default. +This influences Perl's idea of what a ``line'' is. +Works like awk's RS variable, including treating empty lines +as a terminator if set to the null string. +(An empty line cannot contain any spaces or tabs.) +You may set it to a multi-character string to match a multi-character +terminator, or to undef to read through the end of file. +Setting it to "\n\n" means something slightly different +than setting to "", if the file contains consecutive empty lines. +Setting to "" will treat two or more consecutive empty lines +as a single empty line. Setting to "\n\n" will blindly assume +that the next input character belongs to the next paragraph, +even if it's a newline. +(Mnemonic: / delimits line boundaries when quoting poetry.) + +Remember: the value of $/ is a string, not a regex. +awk has to be better for something. + +=over 4 + +=item p5: + +$/ $RS $INPUT_RECORD_SEPARATOR +IO::Handle->input_record_separator(EXPR) + +=back + +=back + +=over 8 + +=item $OUT_FH.autoflush ...or some such + +If set to nonzero, forces a flush right away and after every write +or print on the currently selected output channel. +Default is 0 (regardless of whether the channel is really buffered +by the system or not; +$OUT_FH.autoflush tells you only whether you've asked Perl +explicitly to flush after each write). +$*OUT will typically be line buffered if output is to the +terminal and block buffered otherwise. +Setting this variable is useful primarily when you are +outputting to a pipe or socket, +such as when you are running a Perl program under rsh +and want to see the output as it's happening. +This has no effect on input buffering. +(Mnemonic: when you want your pipes to be piping hot.) + +=over 4 + +=item p5: + +$| $OUTPUT_AUTOFLUSH HANDLE->autoflush(EXPR) + +=back + +=back + + +. . . More to come here . . . + + +=head1 PERL 6 / PERL 5 COMPARISON + +=over 4 + +Because a blank entry in either column could be taken to mean either +"not in Perl 6" or "unknown", the information as presented +below presumes an entry in both columns for every entry. +Options are: + +=over 6 + +thing as the var in question + +- for "not in this Perl" + +? for "don't know yet" + +=back + +Other organizational +schemes may become appropriate when the table is more complete. + +=back + + Perl 5 Perl 6 Comment + ----------- ----------- ----------------------- + STDIN $*IN + + STDOUT $*OUT + + STDERR $*ERR + + $_ $_ + + $_[1],$_[2].. $^a,$^b.. + + $a,$b - Just params to anonymous block + + - $/ Object with results of last regex match + + $1,$2,$3... $1,$2,$3... + + $& $<> + + $` $<pre> + + $' $<post> + + $+ - But info can now be retrieved from $/ + + $^N $*MOST_RECENT_CAPTURED_MATCH ...or some such. + or $/[-1] ...or omit + or $/[-$n] + + @+ $1.end, etc. + + $* - + + $. $IN_FH.input_line_number ...or some such + + $/ $IN_FH.input_rec_separator ...or some such + + ******* XXX the columns seem to have switched! ********* + + $OUT_FH.autoflush ...or some such + $| $OUTPUT_AUTOFLUSH + HANDLE->autoflush(EXPR) + + $OUT_FH.output_field_separator ...or some such + $, $OFS $OUTPUT_FIELD_SEPARATOR + IO::Handle->output_field_separator + + $OUT_FH.output_record_separator ...or some such + $\ $ORS $OUTPUT_RECORD_SEPARATOR + IO::Handle->output_record_separator + + - $" $LIST_SEPARATOR + + - $; $SUBSEP $SUBSCRIPT_SEPARATOR + + - $# Output format for printed numbers. + + - $% $FORMAT_PAGE_NUMBER + - HANDLE->format_page_number(EXPR) + + - $= $FORMAT_LINES_PER_PAGE + - HANDLE->format_lines_per_page(EXPR) + + - $- $FORMAT_LINES_LEFT + - HANDLE->format_lines_left(EXPR) + + $1.start, etc. @- @LAST_MATCH_START + + - $~ $FORMAT_NAME + - HANDLE->format_name(EXPR) + + - $^ $FORMAT_TOP_NAME + - HANDLE->format_top_name(EXPR) + + - $: $FORMAT_LINE_BREAK_CHARACTERS + - IO::Handle->format_line_break_characters + + - $^L $FORMAT_FORMFEED + - IO::Handle->format_formfeed + + - $^A $ACCUMULATOR + + + ? ${^ENCODING} + + $! Universal error object with as much info as + you'd like on the current exception (unthrown + outside of CATCH, thrown inside). Unthrown + exceptions are typically interesting values + of undef. + - $! $ERRNO $OS_ERROR + - $? $CHILD_ERROR + - $@ $EVAL_ERROR + - $^E $EXTENDED_OS_ERROR + + - %! + + $*PID $$ $PID $PROCESS_ID + + $*UID ...or some such + $< $UID $REAL_USER_ID + $*EUID ...or some such + $> $EUID $EFFECTIVE_USER_ID + $*GID ...or some such + $( $GID $REAL_GROUP_ID + $*EGID ...or some such + $) $EGID $EFFECTIVE_GROUP_ID + + $*PROGRAM_NAME ...or some such + $0 $PROGRAM_NAME + + - $[ Index of the first element in an array, + and of the first character in a substring. + + + - $^V $PERL_VERSION + - $] version + patchlevel / 1000 of Perl interpreter + Replacement for the above two is unclear. + + $*COMPILING ...or some such + $^C $COMPILING + + $*DEBUGGING ...or some such + $^D $DEBUGGING + + $*SYS_FD_MAX ...or some such + $^F $SYSTEM_FD_MAX + + - $^H + - %^H + + $*INPLACE_EDIT ...or some such + $^I $INPLACE_EDIT + + $*EMERGENCY_MEMORY ...or some such (or omit) + $^M + + $*OSNAME ...or some such + $^O $OSNAME + + - ${^OPEN} + + $*PERLDB ...or some such + $^P $PERLDB + + $*LAST_REGEXP_CODE_RESULT ...or some such. Or omit. + $^R $LAST_REGEXP_CODE_RESULT + + $*BASETIME ...or some such + $^T $BASETIME + + ? ${^TAINT} + ? ${^UNICODE} + + - $^W $WARNING Probably gone. But we need a reasonably + granular way to suppress specific (groups + of) warnings within both lexical and + dynamic scopes. + + $?WARNINGS ${^WARNING_BITS} + + $*EXECUTABLE_NAME ...or some such + $^X $EXECUTABLE_NAME + + ? $ARGV + + $*ARGS ARGV Note the P6 idiom: + for =$*ARGS { + # each time through loop + # proc a line from files named in ARGS + } + + @*ARGS @ARGV + + $*ARGVOUT + ARGVOUT + + @*INPLACE_AUTOSPLIT_FIELDS ..or some such + @F + + ? @INC Uncertain but we need a way to add to search path + ? %INC Uncertain but we need a way to add to search path + + ? @_ + + + %*ENV %ENV Or %ENV + + %*SIG %SIG Or possibly &*ON_SIGINT, etc. But then we'd need + to add some signal introspection in another way. + + &*ON_WARN __WARN__ + &*ON_DIE __DIE__ + &*ON_PARSEERROR + - $^S $EXCEPTIONS_BEING_CAUGHT + +=head1 HISTORY + + 2007-03-13 dvergin Reference to docs/Perl6/Overview/Variable.pod + 2005-04-11 dvergin Filling in more pieces + 2005-04-10 dvergin Roughed in main table + 2005-04-02 anonpugster Placeholder file containing Larry's email + +=head1 SOURCES + +At its present stage of development this file +draws on a few key sources: Perl 5's perlvar.pod (for a full list of special +vars in Perl 5) and a perl6-language list thread documented +below. E02 and S02 have also been helpful in several cases. + +A key resource in compiling the new material above +has been a thread on the perl6-language +email list which can be found at: + + http://www.mail-archive.com/perl6-language@perl.org/msg18609.html + +For our present purposes, the most helpful item in that thread is the +head post found at the url given above. +It is an item by Larry Wall which is reproduced here: +_________________________________________________________________ + + Mailing-List: contact perl6-language-help@perl.org; run by ezmlm + Date: Sat, 26 Mar 2005 00:27:24 -0800 + From: Larry Wall <larry@wall.org> + To: perl6-compiler@perl.org + Cc: perl6-language@perl.org + Subject: S28ish [was: [Pugs] A couple of string interpolation edge cases] + + On Sat, Mar 26, 2005 at 02:11:29PM +0800, Audrey Tang wrote: + : On Fri, Mar 25, 2005 at 10:03:45PM -0800, Larry Wall wrote: + : > Hmm, well, if it got that far. Given strict being on by default, + : > this particular example should probably just die on the fact that $" + : > isn't declared, since there's no $" in Perl 6. + : + : Is $" okay as a variable name? Is everything from perlvar.pod legal? + + Considering nobody's written perlvar.pod for Perl 6 yet, yeah, everything + in that pod is legal. + + : my $" = 3; + : + : Pugs parses that because it only considers $! and $/ as legal + : symbolic variable names. + + $! will be a legal variable name. $/ is going away, as is $", which + means they fail under "use strict", but they'd still autocreate + globals under laxity as Perl 5 does. (I know Perl 5 exempted all + special variables from strict, but I don't see why we have to do + that for Perl 6. Merely having $_ in the lexical scope or $*! in the + global scope should be sufficient declaration to get around strict. + Though perhaps we can exempt people from having to write $*! under + strict. In fact, that probably goes for all predeclared $* names, + so $IN is legal for $*IN as long as you don't have "my $IN" hiding + it. Another way to look at it is that * variables are basically + autodeclared "our" implicitly in the outermost lexical scope.) + + Sigh, I'd better rough it all in here, even if I don't have time to + do a good job on it. Maybe somebody can beat this into a real S28 pod. + + $? and $@ are gone, merged in with $!. (Frees up ? twigil for $?FOO + syntax.) $^E is merged too. $! is an object with as much info as + you'd like on the current exception (unthrown outside of CATCH, thrown + inside). Unthrown exceptions are typically interesting values of undef. + + $$ is now $*PID. ($$foo is now unambiguous.) + + $0 is gone in favor of $*PROGRAM_NAME or some such. + + Anything that varied with the selected output filehandle like $| + is now a method on that filehande, and the variables don't exist. + (The p5-to-p6 translator will probably end up depending on some + $Perl5ish::selected_output_filehandle variable to emulate Perl 5's + single-arg select().) Likewise $/ and $. should be attached to + a particular input filehandle. (In fact, $/ is now the result of + the last regular expression match, though we might keep the idea of + $. around in some form or other just because it's awfully handy for + error messages. But the localizing $. business is yucky. We have + to clean that up.) + + All the special format variables ($%, $=, $-, $:, $~, $^, $^A, $^L) + are gone. (Frees up the = twigil for %= POD doc structures and + old __DATA__ stream, the : twigil for private attributes, and the ~ + twigil for autodeclared parameters.) + + $`, $', and $+ don't exist any more, but you can dig that info out + of $/'s structures. Shortcuts into $/ include $1, $2, and such, and + the newfangled $<foo> things. Also, $& is changed to $0 for the whole + matched string. $` and $' may be $<pre> and $<post>, but you probably + have to explicitly match <pre> and <post> to get them remembered, + so we don't have a repeat of the Perl 5 sawampersand fiasco. <pre> + and <post> would automatically exclude themselves from $0. Or you + need some special flag to remember them, maybe. + + %+ and %- are gone. $0, $1, $2, etc. are all objects that know + where they .start and .end. (Mind you, those methods return magical + positions that are Unicode level independent.) + + $* and $# have been deprecated half of forever and are gone. $[ + is a fossil that I suppose could turn into an evil pragma, if we + try to translate it at all. (Frees up * twigil for $*FOO syntax.) + + $(, $), $<, and $> should all change to various $*FOO names. $] is either + something in $* or a trait of the Perl namespace. Likewise $^V, if + they aren't in fact merged. + + ${...} is reserved for hard refs only now. ($::(...) must be used + for symbolics refs.) ${^foo} should just change to $*foo or $*_foo + or some such. + + $; is gone because the multidim hash hack is gone. $" is gone, + replaced by @foo.join(":") or some such. Likewise for $, in print + statements. + + We never did find a use for $}, thank goodness. + + And we still are keeping $_ around, though it's lexically scoped. + + Let's see, what other damage can we do to perlvar. $a and $b are + no longer special. No bareword filehandles. $*IN, $*OUT, $*ERR. + Args come in @*ARGS rather than @ARGV. (Environment still in %ENV, + will wonders never cease.) I don't know whether @INC and %INC will + make as much sense when we're looking installed modules in a database, + though I suppose you still have to let the user add places to look. + + %SIG is now %*SIG. The __DIE__ and __WARN__ hooks should be brought + out as separate &*ON_DIE and &*ON_WARN variables--they really + have nothing to do with signals. I suppose we could even do away + with %SIG and replace it with &*ON_SIGINT and such, though then we'd + lose a bit of signal introspection which would have to be provided + some other way. Oh, and we probably ought to split out &?ON_PARSEERROR + from $*ON_DIE to get rid of the $^S fiasco of Perl 5. + + $^C, $^D, $^F, $^I, $^M, $^O, $^P, $^S, $^T, $^V, $^X are all renamed + to something $*FOOish, at least the ones that aren't going away entirely. + + $^W is is too blunt an instrument even in Perl 5, so it's probably gone. + + I'm not quite sure what to do with $^N or $^R yet. Most likely they + end up as something $<foo>ish, if they stay. + + You weren't ever supposed to know about $^H and %^H. Or %{^FNORD}... + + Other things might show up as global variables in support of + command-line options, like $*ARGVOUT or @*F. Some of the special + variables we've blissfull relegated to the trash heap might + creep back in as global variables that just happen to know about + $*Perl5ish::current_selected_filehandle and such, but we should + probably try to keep them as lvalue subs in &Perl5ish::ors() and such. + + Anyway, it's all negotiable, except for the parts that aren't. + + Larry + +=cut + +
|
| | 10 answers | Add comment |
|
| Comparing inexact values (was "Re: Temporal changes") David Green 04:27:57 |
| | On 2009-Feb-23, at 10:09 am, TSa wrote:
I also think that time and numbers in general should be treated in a fuzzy way by smart match. My thought is to have == take a :within adverb, at least for imprecise types like Num, that could be used to specify how close values need to come in order to be considered equal.
So instead of: if abs($x-$y)<$epsilon { ... }
you could say: if $x==$y :within($epsilon) { ... }
which makes your tests for equality look like tests for equality.
I'd even suggest that the :within be mandatory, to guarantee that the coder is aware that "$x==$y" is probably not DWIM. Of course, there should also be an easy way to set epsilon across a scope, like:
use Num recision(0); # force exact matches in this block
-David
|
| | 32 answer | Add comment |
Thursday, 26 February 2009
|
| Retrieving Cookies does not return all domain values Thomas Hilbig 21:50:42 |
| | I am in the process of changing my cookies (stored on my users’ browsers) so they can be shared across multiple servers under my domain. So, instead of writing cookies with domain ‘www.mydomain.com’, I am writing them to ‘.mydomain.com’ so they can be read by www.mydomain.com, www2.mydomain.com etc. During the transition, I need to be able to retrieve cookie valuesstored forthe main domain and the subdomain.
Browsers will store cookies from ‘www.mydomain.com’ and ‘.mydomain.com’ separately, and return multiple values if the target servername matches the hierarchy. However, I cannot find a way under CGI.pm or CGI::Cookie to retrieve these multiple values – only one value is ever returned.
Example, I can set 2 cookies from server www.mydomain.comusing: my $cookieShort = cookie(-name=>'var', -value=>’hello_short’, -expires=>'+1M', -domain=>’.mydomain.com’) my $cookieLong = cookie(-name=>'var', -value=>’hello_long’, -expires=>'+1M', -domain=>’www.mydomain.com’) print $q->header({-cookie=>[$cookieShort, $cookieLong], -type=>'text/html', -expires=>'-1d'}) ;
The client returns both values properly to this server, and I can see these passed to the ENV environment variable: print ENV{'HTTP_COOKIE'} ;
var=hello_short; var=hello_long However, using CGI.pm or CGI::Cookie only one value (the highest level domain ) is ever returned: Print $q->cookie(-name=>'var') ;
hello_short my @arrayCookies = $q->cookie(-name=>'var') ; # using array context foreach (@arrayCookies) { print "$_\n" ; }
hello_short Is there a method to get CGI.pm to fetch all the values in the request, or am I forced to use the environment variable? Fetching cookies using an array context will only bring back multiple values if they are set under a single domain.
|
| | 1 answer | Add comment |
|
|