Friday, 26 September 2008
|
| Why no "is ro"? (Re: Subroutine parameter with trait and default.) Michael G Schwern 09:37:59 |
| | John M. Dlugosz wrote:
I'm not opposed to having it be "ro", but wonder why he didn't call it that in the first place, so there must be a reason. Nobody's perfect?
My other thought is that since parameters are read-only by default it's not thought you'd have to write it much so clarity wins out over brevity, the flip side of Huffamn encoding. But that doesn't work out so good for normal variable declarations. The verbosity (which a hyphen would only make worse) discourages "const-ing", as they say in C.
It should be possible to alias it in your own scope easily. Every time someone replies to a Perl 6 language design nit with "but you can change the grammar" *I* kill a kitten.
*meowmmmf*
-- 31. Not allowed to let sock puppets take responsibility for any of my actions. -- The 213 Things Skippy Is No Longer Allowed To Do In The U.S. Army http://skippyslist.com/list/
|
| | 5 answers | Add comment |
Tuesday, 23 September 2008
|
| Subroutine parameter with trait and default. Michael G Schwern 22:25:33 |
| | I'm pondering what the proper syntax is for a subroutine parameter with both a trait and a default. That is...
sub foo ($arg = 42)
and
sub foo ($arg is readonly)
together in one parameter. Would that be
sub foo ($arg = 42 is readonly)
or
sub foo ($arg is readonly = 42)
The first looks ambiguous, what if the trait is meant to apply to the default? The second looks downright wrong.
PS Incidentally, it seems silly to have "is rw" but not "is ro". I keep writing "is ro".
-- package Outer::Space; use Test::More tests => 9;
|
| | 4 answer | Add comment |
|
| ANNOUNCE: DBD-Unify 0.75 H.Merijn Brand 22:25:33 |
| | file: $CPAN/authors/id/H/HM/HMBRAND/DBD-Unify-0.75.tgz size: 47569 bytes md5: 0be9e5fd772db8f210fe434f4d1abcbf
As the debug levels have changes, this might (or might not) be considered a backward incompatible port. Fact is that it now more closely follows the DBI specs.
*** Release 0.75 - Tue 23 Sep 2008 <h.m.brand@xs4all.nl>
- Three-level dbd_verbose and documentation - $ENV{DBD_TRACE} sets $dbh->{dbd_verbose} on/before connect - New tests for $h->trace (...) and $h->{dbd_verbose} - Added type_info_all (), get_info (), and parse_trace_flag () - Note that identifiers are now quoted - Override quote_identifier () (UNIFY has no CATALOGS) - Accept 2-arg and 3-arg ->do () - Accept %attr to ->prepare () - Raised all verbose levels by 1. 1 and 2 are now DBI only - Removed 05-reauth.t - NULLABLE now always 2, as it doesn't work - Implemented CursorName sth attribute - Implemented ParamValues sth attribute - Implemented ParamTypes sth attribute - Implemented RowsInCache sth attribute (always 0) - Tested with Unify 6.3AB on HP-UX 10.20 with perl 5.8.8 - Tested with Unify 8.2BC on HP-UX 11.00 with perl 5.8.8 - Tested with Unify 8.3I on HP-UX 11.23 with perl 5.10.0 - Tested with Unify 8.3K on AIX 5.2.0.0 with perl 5.8.8 Tests will fail on older perls, as the test cases use scalarIO
*** Release 0.72 - Fri 23 Apr 2008 <h.m.brand@xs4all.nl>
- Kindly tell CPAN smokers not to bother when there is no Unify - Add a correct(ed) META.yml - Move to EU::MM's prompt () function for the questions
*** Release 0.71 - Fri 04 Jan 2008 <h.m.brand@xs4all.nl>
- Small change in Makefile.PL for HP-UX 11.23 ia64 - Refactor the date stuff in t/20-uni-basic we need more tests for %ENV variable setting like $LC_ALL, $DATEFMT etc
Enjoy, Have FUN!
-- H.Merijn Brand Amsterdam Perl Mongers http://amsterdam.pm.org/ using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00, 11.11, 11.23, and 11.31, SuSE 10.1, 10.2, and 10.3, AIX 5.2, and Cygwin. http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/ http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/
|
| | 1 answer | Add comment |
|
| how to send a page and a file at a download script? Shnaxe 21:11:21 |
| | dear readers,
i recently finished a small perl-cgi download script that sends files after some checks and logging. i call this script through a link on a static html-page and pass the file-id as a parameter.
this all works nice so far, the part where i'm stuck at is that with clicking on the link, the page containig the link is replaced by a white blank page. i wonder how i could instead get either: - the page containig the link stays, link is targeted to a new window (minimal version) - a new page is displayed containg something like 'thank you for downloading... you download should start now...' (deluxe solution)
for the minimal version, i thought putting a simple 'target="_blank"' into the link should do what i want (only tested with firefox 3.0 so far). this indeed works, but the focus changes to the popping up new blank tab and further, this tab stays open after the file is transferred. i remember having seen this differently on the web.
for the deluxe verson i think i somehow need to send out two headers, one of type 'application/x-download' (for the file) and another of type 'text/html' (for the page). but how would i do this? i'm afraid that the second header (whichever) will not get recognized as a second document but be embedded into the first. i guess a short sleep between the first and the second header won't do it...
thanks for help and suggestions in advance, regards, shnaxe
ps: well, i am unsure if this would have been better posted to another group (but which) since its maybe not a pure perl-question. i got to admit that from my point of knowledge, the solution to the problem i described seems to be somewhere on a blurry line between perl/cgi and html...
|
| | 2 answer | Add comment |
|
| DBD-SQLAnywhere-1.16 Richard T Malafa 19:31:21 |
| | Has anyone successfully installed DBD-SQLAnywhere-1.16 on a HP-UX??? I have two questions:
1. Did you have to add more to the Path contained in sa_config.sh or sa_config.csh 2. What did you have to do with the Database to get another machine to see the database with "dblocate"???
Thank You Rich
|
| | 8 answers | Add comment |
|
| cgi and ssh Dermot Paikkos 18:29:12 |
| | Hi,
I have a cgi script that needs scp a file from one server to another. Because the script runs under the httpd user, for this to work without prompting for password, I need to do a lot of configuring that I am not sure would be consider good practise. For example: the httpd user's account this currently set as 'noloign' that would need to change to bash or similar. I have to generate ssh key without a password.
In the past I have used nfs for copying files from one server to another but this isn't an option. Can anyone advise me about this? Will enabling the httpd user be a security issue? Is there a safer alternative?
TIA, Dp.
|
| | 2 answer | Add comment |
|
| Install DBI on Solaris Murphy Kevin Mail 18:20:41 |
| | Hi all,
I'm having an issue installing DBI on Solaris. I've read on many people having this issue and the solutions seem to revolve around installing a new compiler, etc. However, I've already installed other perl modules successfully on this box, so it seems to be related to this module only. Following are the results of the log of my total install and the perl -V. Thanks for any help or clarification that you can provide:
install:
# perl Makefile.PL 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 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 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 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
I see you're using perl 5.008004 on i86pc-solaris-64int, 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 cc -c -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TS_ERRNO -xO3 - xspace -xildoff -DVERSION=\"1.607\" -DXS_VERSION=\"1.607\" -KPIC "- I/usr/perl5/5.8.4/lib/i86pc-solaris-64int/CORE" -DDBI_NO_THREADS Perl.c sh: cc: not found *** Error code 1 make: Fatal error: Command failed for target `Perl.o'
perl -V:
# perl -V Summary of my perl5 (revision 5 version 8 subversion 4) configuration: Platform: osname=solaris, osvers=2.10, archname=i86pc-solaris-64int uname='sunos localhost 5.10 i86pc i386 i86pc' config_args='' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 - D_TS_ERRNO', optimize='-xO3 -xspace -xildoff', cppflags='' ccversion='Sun WorkShop', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags ='' libpth=/lib /usr/lib /usr/ccs/lib libs=-lsocket -lnsl -ldl -lm -lc perllibs=-lsocket -lnsl -ldl -lm -lc libc=/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-R /usr/ perl5/5.8.4/lib/i86pc-solaris-64int/CORE' cccdlflags='-KPIC', lddlflags='-G'
Characteristics of this binary (from libperl): Compile-time options: USE_64_BIT_INT USE_LARGE_FILES Locally applied patches: 22667 The optree builder was looping when constructing the ops ... 22715 Upgrade to FileCache 1.04 22733 Missing copyright in the README. 22746 fix a coredump caused by rv2gv not fully converting a PV ... 22755 Fix 29149 - another UTF8 cache bug hit by substr. 22774 [perl #28938] split could leave an array without ... 22775 [perl #29127] scalar delete of empty slice returned garbage 22776 [perl #28986] perl -e "open m" crashes Perl 22777 add test for change #22776 ("open m" crashes Perl) 22778 add test for change #22746 ([perl #29102] Crash on assign ... 22781 [perl #29340] Bizarre copy of ARRAY make sure a pad op's ... 22796 [perl #29346] Double warning for int(undef) and abs(undef) ... 22818 BOM-marked and (BOMless) UTF-16 scripts not working 22823 [perl #29581] glob() misses a lot of matches 22827 Smoke [5.9.2] 22818 FAIL(F) MSWin32 WinXP/.Net SP1 (x86/1 cpu) 22830 [perl #29637] Thread creation time is hypersensitive 22831 improve hashing algorithm for ptr tables in perl_clone: ... 22839 [perl #29790] Optimization busted: '@a = "b", sort @a' ... 22850 [PATCH] 'perl -v' fails if local_patches contains code snippets 22852 TEST needs to ignore SCM files 22886 Pod::Find should ignore SCM files and dirs 22888 Remove redundant %SIG assignments from FileCache 23006 [perl #30509] use encoding and "eq" cause memory leak 23074 Segfault using HTML::Entities 23106 Numeric comparison operators mustn't compare addresses of ... 23320 [perl #30066] Memory leak in nested shared data structures ... 23321 [perl #31459] Bug in read() 27722 perlio.c breaks on Solaris/gcc when > 256 FDs are available SPRINTF0 - fixes for sprintf formatting issues - CVE-2005-3962 Built under solaris Compiled at Aug 8 2007 19:13:08 @INC: /usr/perl5/5.8.4/lib/i86pc-solaris-64int /usr/perl5/5.8.4/lib /usr/perl5/site_perl/5.8.4/i86pc-solaris-64int /usr/perl5/site_perl/5.8.4 /usr/perl5/site_perl /usr/perl5/vendor_perl/5.8.4/i86pc-solaris-64int /usr/perl5/vendor_perl/5.8.4 /usr/perl5/vendor_perl
|
| | 2 answer | Add comment |
|
| Another split() question - when is there a capture? Moritz Lenz 14:12:56 |
| | split seems to be a suprisingly tricky beast
To quote S29:
: As with Perl 5's split, if there is a capture in the pattern it : is returned in alternation with the split values. Unlike with : Perl 5, multiple such captures are returned in a single Match object.
Unlike in Perl 5, it is not determined at (pattern) compile time if a regex has captures.
In Perl 5 the regex m/(foo)?/ always has one capture ($1), in Perl 6 it has either zero or one ($0 doesn't exist if 'foo' never matched).
So does split return the match objects * if the regex has the potential to create at least one capture or * at least one match actually produces a capture or * (weird) only those matches that produce a capture put a match object into the result list.
I'd go for the first option. In that case it might be useful to have some sort of introspection, ie a method like $regex.has_capture (which might return either True (unconditional captures) or False (no captures at all) or True|False (for my example above)
Cheers, Moritz
-- Moritz Lenz http://moritz.faui2k3.org/ | http://perl-6.de/
|
| | Add comment |
|
| S04-related closure question Patrick R. Michaud 01:09:09 |
| | What would be the expected output from the following?
my $a = foo(); my $b;
{ my $x = 1; sub get_x() { return $x; } sub foo() { return &get_x; } $b = foo(); }
my $c = foo();
say "a: ", $a(); say "b: ", $b(); say "c: ", $c();
As a followup question, what about...?
my @array; for 1..3 -> $x { sub get_x() { return $x; } push @array, &get_x; }
for @array -> $f { say $f(); }
Pm
|
| | 1 answer | Add comment |
Monday, 22 September 2008
|
| Are keys, values, kv, pairs, etc. named unaries? Patrick R. Michaud 03:05:31 |
| | According to the test suite (t/spec/S29-array/kv.t), the .kv method is defined on arrays to produce an interleaved list of indices and values:
my @array = <a b c d>; say @array.kv.perl; # [ 0, "a", 1, "b", 2, "c", 3, "d" ]
The kv.t file also shows a functional form of kv():
my @array = <a b c d>; say kv(@array).perl; # [ 0, "a", 1, "b", 2, "c", 3, "d" ]
Is the C<kv> function (keys, values, pairs, etc.) a named unary? I.e., what is the result of... ?
my @array = <a b c d>; my @b = kv @array, <e f g>; say @b.perl;
Pm
|
| | Add comment |
Sunday, 21 September 2008
|
| FormMail within a CGI Script Mike Flannigan 00:37:24 |
| | Within a "start_html" block in a CGI script I do this:
button(-name=>'button_name', -value=>'I have info to contribute', -onClick=>"redirectmail()"),
In "redirectmail()" is have:
sub redirectmail { print header, start_html('Mail Info'), h1('Mail Info'), <FORM ACTION="http://somewebhost/forms?login=myusername&to=myaddress&confirm=confirmed.html&error=error.html" METHOD="POST">, <INPUT NAME="recipient" TYPE="HIDDEN" VALUE="myaddress">, <TABLE>, <TR>, <TD valign=middle>Your Name:</TD>, <===THIS LINE GIVES ERROR <TD><INPUT NAME="name" SIZE="30"></TD>, </TR>, <TR>, <TD valign=middle>Your E-mail:</TD>, <TD><INPUT NAME="e-mail" SIZE="30"></TD>, </TR>, <TR>, <TD valign=middle>Cemetery Link:</TD>, <TD><INPUT NAME="link" SIZE="60" VALUE="Some Subject"></TD>, </TR>, <TR>, <TD valign=middle>Subject:</TD>, <TD><INPUT NAME="subject" SIZE="60"></TD>, </TR>, <TR>, <TD valign=top><BR>Comments:</TD>, <TD><TEXTAREA NAME="body" VALUE="" cols=60 rows=10></TEXTAREA></TD>, </TR>, <INPUT NAME="followup-page" TYPE="HIDDEN" VALUE="myfollowuppage">, <TR>, <TD></TD>, <TD><INPUT TYPE="submit" name="submit" VALUE="Send"></TD>, </TR>, </TABLE>, </FORM>; end_html; }
When I run the CGI file is gives Software error: syntax error at /dir/test.pl line 125, near "<TD valign=middle>Your Name" Execution of /dir/test.pl aborted due to compilation errors.
I am very new at CGI, but not Perl. Can anybody explain what I am doing wrong? It may be something very basic.
I get the digest version of this list, so I'd appreciate it if you sent it to me directly along with sending it to the list.
Mike Flannigan
|
| | 1 answer | Add comment |
Saturday, 20 September 2008
|
| How to define a new value type? Patrick R. Michaud 03:18:22 |
| | In [1], Larry writes:
[...] we left = in the language to provide (to the extent possible) the same semantics that it does in Perl 5. And when it comes to non-value types, there really are still references, even if we try not to talk about them much. So I think assignment is basically about copying around identities, where value types treat identity differently than object types (or at least, objects types that aren't pretending to be value types). So, how does one get an object to pretend to be a value type for purposes of assignment?
Currently if I do the following
class Dog { ... } my $a = Dog.new; my $b = $a;
then $a and $b both refer to the same Dog object. How would I define Dog such that it acts like a value type -- i.e., so that $b would be a copy of $a and future changes to the object in $a don't affect $b.
(Various parts of the synopses talk about .WHICH being used to define value types, but I don't quite see how that fits in to assignment.)
Thanks!
Pm
|
| | 21 answer | Add comment |
Friday, 19 September 2008
|
| Should $.foo attributes without "is rw" be writable from within the class Carl M sak 23:36:12 |
| | Rakudo and I have a disagreement over this: I expect to be able to assign to a $.foo attribute in methods within the class, whereas Rakudo demands the "is rw" attribute in order to do that.
We discussed it a bit on #perl6 today.
<http://irclog.perlgeek.de/perl6/2008-09-17#i_572836>
I only have pragmatic arguments to offer for my point of view: somehow, it feels like each and every attribute gets an "is rw" as things stand now. The modifier somewhat loses its meaning... if it meant "_publicly_ readable/writable", it would only be used for some variables.
(I may have to rethink the above reason when attribute initialization (as in "has $.foo = 5") is fully implemented in Rakudo.)
The other argument is that I (for some reason) expect a $.foo variable to be changeable from within the class -- even when it doesn't have an "is rw" attribute. It's one of those presuppositions which keeps biting me when writing classes. I know I could use "$!foo" consistently, and things will work, but... then I have to remember to write "$.foo" when declaring the variable and "$!foo" when using it.
Finally, some useless statistics: I count 12 attributes in different classes in November right now. Out of those, 12 (100%) have the "is rw" attribute.
// Carl
|
| | 19 answers | Add comment |
|
| What should ''.split('') return? Moritz Lenz 21:09:35 |
| | Hi,
what should ''.split('') return? The empty list, or a list with one null string?
Moritz -- Moritz Lenz http://moritz.faui2k3.org/ | http://perl-6.de/
|
| | 2 answer | Add comment |
|
| Parrot 0.7.1 "Manu Aloha" released Patrick R. Michaud 15:10:30 |
| | On behalf of the Parrot team, I'm proud to announce Parrot 0.7.1 "Manu Aloha." Parrot (http://parrotcode.org/) is a virtual machine aimed at running all dynamic languages.
Parrot 0.7.1 is available via CPAN (soon), or follow the download instructions at http://parrotcode.org/source.html . For those who would like to develop on Parrot, or help develop Parrot itself, we recommend using Subversion on the source code repository to get the latest and best Parrot code.
Parrot 0.7.1 News: - Implementation + add -I and -L command line options + support for null strings in NCI calls + preliminary support for resumable exceptions + add '.hll_map' method for dynamic HLL type mapping + more parrot_debugger fixes + remove obsolete '.past' extension - Languages + Rakudo (Perl 6) - now over 3300 passing spectests - precompiled modules - precompiled scripts (--target=pir can now be executed standalone) - Support for @*INC and %*INC varialbes - additional builtin methods and subs - added 'fail' function, warnings on use of undefined values - m/.../ regexes - qq, qw, q quoting forms - run tests in parallel - gather/take - Perl6MultiSub + Cardinal (Ruby): - 'require' and precompiled modules - many new tests - all Array tests pass - regexes - default arguments to functions - new committer - Compilers + PCT: - add :loadinit attribute for PAST::Block + PIRC: - major refactoring to allow all PIR keywords as identifiers - links to libparrot now, so all Parrot ops are recognized as such - implemented .loadlib, .HLL_map, .HLL - Miscellaneous + add Xlib and Mysql modules and test programs to NCI examples + many updates and cleanups to PDD documents
Many thanks to all our contributors for making this possible, and our sponsors for supporting this project. Our next scheduled release is 21 Oct 2008.
Enjoy!
|
| | 2 answer | Add comment |
|
| MS SQL 2005 64 bit question Richard Hug 13:57:53 |
| | I am having trouble in a Windows Server 2003 64 bit environment getting Perl to see MS SQL 2005 via ODBC. Would someone kindly point me in the correct direction. We are using the latest Active State 64 bit version. Everything else seems to work just fine, I just can't connect to the data base. I have set up an ODBC connection, and tried to use the Perl DBI, with the DBD::ODBC module...no luck. I have also tried the non-DSN approach, no luck.
Your help is appreciated.
Richard
|
| | 1 answer | Add comment |
|
| S05 and S29 may conflict on behavior of $string.match(/pat/) Chris Davaz 07:53:40 |
| | I'm trying to pin down what $string.match(/pat/) should be returning.
From S05:
Under "Return values from match objects" "A match always returns a Match object..."
From S29:
Under the definition of Str.comb
Saying
$string.comb(/pat/, $n)
is equivalent to
$string.match(rx:global:x(0..$n):c/pat/)
[ ...and later... ]
"If there are captures in the pattern, a list of Match objects (one per match) is returned instead of strings."
Which implies that $string.match(/pat/) should indeed return a List of Str and $string.match(/pat_with_groups/) should return a List of Match.
I expected the S29 definition when first approaching $string.match I feel it is more intuitive than what happens with S05. Could someone clarify what the behavior should be?
Best Regards, -Chris Davaz
|
| | 2 answer | Add comment |
|
| Re: DSN corruption using DBD::Pg Ron Savage 02:20:32 |
| | Hi Tim
On Tue, 2008-09-16 at 09:53 +0100, Tim Bunce wrote:
Use DBI->trace() (or DBI_TRACE env var) to see what's happening. Thanx.
(1) The failure via the mod_perl route (Apache::DBI not in use):
[Wed Sep 17 09:14:20 2008] [notice] Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.8g mod_apreq2-20051231/2.6.0 mod_perl/2.0.4 Perl/v5.10.0 configured -- resuming normal operations DBI 1.605-ithread default trace level set to 0x0/15 (pid 27667) at Database.pm line 184 via Base.pm line 97 -> DBI->connect(dbi g:dbname=contacts, ron, ****) -> DBI->install_driver(Pg) for linux perl=5.010000 pid=27667 ruid=1 euid=1 install_driver: DBD::Pg version 2.10.3 loaded from /usr/local/lib/perl/5.10.0/DBD/Pg.pm New 'DBI::dr' (for DBD::Pg::dr, parent='', id=undef) dbih_setup_handle(DBI::dr=HASH(0xa355f80)=>DBI::dr=HASH(0xa355fe0), DBD::Pg::dr, 0, Null!) dbih_make_com(Null!, 0, DBD::Pg::dr, 84, 0) thr#9955cc8 dbih_setup_attrib(DBI::dr=HASH(0xa355fe0), Err, Null!) SCALAR(0x9b09308) (already defined) dbih_setup_attrib(DBI::dr=HASH(0xa355fe0), State, Null!) SCALAR(0x9b092b8) (already defined) dbih_setup_attrib(DBI::dr=HASH(0xa355fe0), Errstr, Null!) SCALAR(0x9b092e8) (already defined) dbih_setup_attrib(DBI::dr=HASH(0xa355fe0), TraceLevel, Null!) 0 (already defined) dbih_setup_attrib(DBI::dr=HASH(0xa355fe0), FetchHashKeyName, Null!) 'NAME' (already defined) install_method DBI::db::pg_cancel install_method DBI::db::pg_endcopy install_method DBI::db::pg_getline install_method DBI::db::pg_getcopydata install_method DBI::db::pg_getcopydata_async install_method DBI::db::pg_notifies install_method DBI::db::pg_putcopydata install_method DBI::db::pg_putcopyend install_method DBI::db::pg_ping install_method DBI::db::pg_putline install_method DBI::db::pg_ready install_method DBI::db::pg_release install_method DBI::db::pg_result install_method DBI::db::pg_rollback_to install_method DBI::db::pg_savepoint install_method DBI::db::pg_server_trace install_method DBI::db::pg_server_untrace install_method DBI::db::pg_type_info install_method DBI::st::pg_cancel install_method DBI::st::pg_result install_method DBI::st::pg_ready <- install_driver= DBI::dr=HASH(0xa355f80)
connect DISPATCH (DBI::dr=HASH(0xa355f80) rc2/3 @5 g0 ima8001 pid#27667) at /usr/local/lib/perl/5.10.0/DBI.pm line 638 via at /home/ron/perl.modules/Local-Contacts/lib/Local/Contacts/App/Base.pm line 97 !! warn: 0 CLEARED by call to connect method -> connect for DBD::Pg::dr (DBI::dr=HASH(0xa355f80)~0xa355fe0 'dbname=contacts' 'ron' **** HASH(0x9bc1d18)) thr#9955cc8 New 'DBI::db' (for DBD::Pg::db, parent=DBI::dr=HASH(0xa355fe0), id=undef) dbih_setup_handle(DBI::db=HASH(0xa37c158)=>DBI::db=HASH(0xa37c0a8), DBD::Pg::db, a129d48, Null!) dbih_make_com(DBI::dr=HASH(0xa355fe0), a3774b8, DBD::Pg::db, 140, 0) thr#9955cc8 dbih_setup_attrib(DBI::db=HASH(0xa37c0a8), Err, DBI::dr=HASH(0xa355fe0)) SCALAR(0xa129f58) (already defined) dbih_setup_attrib(DBI::db=HASH(0xa37c0a8), State, DBI::dr=HASH(0xa355fe0)) SCALAR(0xa129fd8) (already defined) dbih_setup_attrib(DBI::db=HASH(0xa37c0a8), Errstr, DBI::dr=HASH(0xa355fe0)) SCALAR(0xa129f98) (already defined) dbih_setup_attrib(DBI::db=HASH(0xa37c0a8), TraceLevel, DBI::dr=HASH(0xa355fe0)) 0 (already defined) dbih_setup_attrib(DBI::db=HASH(0xa37c0a8), FetchHashKeyName, DBI::dr=HASH(0xa355fe0)) 'NAME' (already defined) dbih_setup_attrib(DBI::db=HASH(0xa37c0a8), HandleSetErr, DBI::dr=HASH(0xa355fe0)) undef (not defined) dbih_setup_attrib(DBI::db=HASH(0xa37c0a8), HandleError, DBI::dr=HASH(0xa355fe0)) undef (not defined) dbih_setup_attrib(DBI::db=HASH(0xa37c0a8), ReadOnly, DBI::dr=HASH(0xa355fe0)) undef (not defined) dbih_setup_attrib(DBI::db=HASH(0xa37c0a8), Profile, DBI::dr=HASH(0xa355fe0)) undef (not defined) Begin dbd_db_login Login connection string: (dbname=contacts user='ron' password='seekrit') PQconnectdb Connection complete PQstatus PQerrorMessage Begin pg_error (message: FATAL: Ident authentication failed for user "ron" number: 1) End pg_error PQfinish End dbd_db_login (error)
DESTROY DISPATCH (DBI::db=HASH(0xa37c158) rc1/1 @1 g0 ima10004 pid#27667) at /usr/local/lib/perl/5.10.0/DBI.pm line 638 via at /home/ron/perl.modules/Local-Contacts/lib/Local/Contacts/App/Database.pm line 185 <> DESTROY(DBI::db=HASH(0xa37c158)) ignored for outer handle (inner DBI::db=HASH(0xa37c0a8) has ref cnt 1)
DESTROY DISPATCH (DBI::db=HASH(0xa37c0a8) rc1/1 @1 g0 ima10004 pid#27667) at /usr/local/lib/perl/5.10.0/DBI.pm line 638 via at /home/ron/perl.modules/Local-Contacts/lib/Local/Contacts/App/Database.pm line 185 -> DESTROY for DBD::Pg::db (DBI::db=HASH(0xa37c0a8)~INNER) thr#9955cc8 DESTROY for DBI::db=HASH(0xa37c0a8) ignored - handle not initialised ERROR: 1 'FATAL: Ident authentication failed for user "ron"' (err#0) <- DESTROY= undef at /usr/local/lib/perl/5.10.0/DBI.pm line 638 via at /home/ron/perl.modules/Local-Contacts/lib/Local/Contacts/App/Database.pm line 185 DESTROY (dbih_clearcom) (dbh 0xa37c0a8, com 0xa37ec40, imp DBD::Pg::db): FLAGS 0x100011: COMSET Warn PrintWarn ERR 1 ERRSTR 'FATAL: Ident authentication failed for user "ron"' PARENT DBI::dr=HASH(0xa355fe0) KIDS 0 (0 Active) dbih_clearcom 0xa37c0a8 (com 0xa37ec40, type 2) done.
!! ERROR: 1 'FATAL: Ident authentication failed for user "ron"' (err#0) <- connect= undef at /usr/local/lib/perl/5.10.0/DBI.pm line 638 via at /home/ron/perl.modules/Local-Contacts/lib/Local/Contacts/App/Base.pm line 97 -> $DBI::errstr (&) FETCH from lasth=HASH <- $DBI::errstr= 'FATAL: Ident authentication failed for user "ron"' DBI connect('dbname=contacts','ron',...) failed: FATAL: Ident authentication failed for user "ron" DBI connect('dbname=contacts','ron',...) failed: FATAL: Ident authentication failed for user "ron" at /home/ron/perl.modules/Local-Contacts/lib/Local/Contacts/App/Database.pm line 185 -> DBI->connect(, , ****) [Dispatch] ERROR: Can't connect to data source '' because I can't work out what driver to use (it doesn't seem to contain a 'dbi:driver:' prefix and the DBI_DRIVER env var is not set) at /usr/local/share/perl/5.10.0/Log/Dispatch/DBI.pm line 31
(2) The success via the command line:
ron@zoe:~/perl.modules/Local-Contacts/lib/Local/Contacts/App$ perl -I/home/ron/perl.modules/Local-Contacts/lib ~/scripts/Postgres/test.pg.pl DBI 1.605-ithread default trace level set to 0x0/15 (pid 27814) at test.pg.pl line 17 -> DBI->connect(dbi g:dbname=contacts, ron, ****) -> DBI->install_driver(Pg) for linux perl=5.010000 pid=27814 ruid=1000 euid=1000 install_driver: DBD::Pg version 2.10.3 loaded from /usr/local/lib/perl/5.10.0/DBD/Pg.pm New 'DBI::dr' (for DBD::Pg::dr, parent='', id=undef) dbih_setup_handle(DBI::dr=HASH(0x981db68)=>DBI::dr=HASH(0x981dbc8), DBD::Pg::dr, 0, Null!) dbih_make_com(Null!, 0, DBD::Pg::dr, 84, 0) thr#978b008 dbih_setup_attrib(DBI::dr=HASH(0x981dbc8), Err, Null!) SCALAR(0x981e0b8) (already defined) dbih_setup_attrib(DBI::dr=HASH(0x981dbc8), State, Null!) SCALAR(0x981e068) (already defined) dbih_setup_attrib(DBI::dr=HASH(0x981dbc8), Errstr, Null!) SCALAR(0x981e0a8) (already defined) dbih_setup_attrib(DBI::dr=HASH(0x981dbc8), TraceLevel, Null!) 0 (already defined) dbih_setup_attrib(DBI::dr=HASH(0x981dbc8), FetchHashKeyName, Null!) 'NAME' (already defined) install_method DBI::db::pg_cancel install_method DBI::db::pg_endcopy install_method DBI::db::pg_getline install_method DBI::db::pg_getcopydata install_method DBI::db::pg_getcopydata_async install_method DBI::db::pg_notifies install_method DBI::db::pg_putcopydata install_method DBI::db::pg_putcopyend install_method DBI::db::pg_ping install_method DBI::db::pg_putline install_method DBI::db::pg_ready install_method DBI::db::pg_release install_method DBI::db::pg_result install_method DBI::db::pg_rollback_to install_method DBI::db::pg_savepoint install_method DBI::db::pg_server_trace install_method DBI::db::pg_server_untrace install_method DBI::db::pg_type_info install_method DBI::st::pg_cancel install_method DBI::st::pg_result install_method DBI::st::pg_ready <- install_driver= DBI::dr=HASH(0x981db68)
connect DISPATCH (DBI::dr=HASH(0x981db68) rc2/3 @5 g0 ima8001 pid#27814) at /usr/local/lib/perl/5.10.0/DBI.pm line 638 !! warn: 0 CLEARED by call to connect method -> connect for DBD::Pg::dr (DBI::dr=HASH(0x981db68)~0x981dbc8 'dbname=contacts' 'ron' **** HASH(0x97fa258)) thr#978b008 New 'DBI::db' (for DBD::Pg::db, parent=DBI::dr=HASH(0x981dbc8), id=undef) dbih_setup_handle(DBI::db=HASH(0x97fb1e8)=>DBI::db=HASH(0x97fb138), DBD::Pg::db, 98599d8, Null!) dbih_make_com(DBI::dr=HASH(0x981dbc8), 98165d0, DBD::Pg::db, 140, 0) thr#978b008 dbih_setup_attrib(DBI::db=HASH(0x97fb138), Err, DBI::dr=HASH(0x981dbc8)) SCALAR(0x9859be8) (already defined) dbih_setup_attrib(DBI::db=HASH(0x97fb138), State, DBI::dr=HASH(0x981dbc8)) SCALAR(0x9859c68) (already defined) dbih_setup_attrib(DBI::db=HASH(0x97fb138), Errstr, DBI::dr=HASH(0x981dbc8)) SCALAR(0x9859c28) (already defined) dbih_setup_attrib(DBI::db=HASH(0x97fb138), TraceLevel, DBI::dr=HASH(0x981dbc8)) 0 (already defined) dbih_setup_attrib(DBI::db=HASH(0x97fb138), FetchHashKeyName, DBI::dr=HASH(0x981dbc8)) 'NAME' (already defined) dbih_setup_attrib(DBI::db=HASH(0x97fb138), HandleSetErr, DBI::dr=HASH(0x981dbc8)) undef (not defined) dbih_setup_attrib(DBI::db=HASH(0x97fb138), HandleError, DBI::dr=HASH(0x981dbc8)) undef (not defined) dbih_setup_attrib(DBI::db=HASH(0x97fb138), ReadOnly, DBI::dr=HASH(0x981dbc8)) undef (not defined) dbih_setup_attrib(DBI::db=HASH(0x97fb138), Profile, DBI::dr=HASH(0x981dbc8)) undef (not defined) Begin dbd_db_login Login connection string: (dbname=contacts user='ron' password='seekrit') PQconnectdb Connection complete PQstatus PQsetNoticeProcessor PQprotocolVersion PQserverVersion End dbd_db_login
FETCH DISPATCH (DBI::db=HASH(0x97fb138) rc2/1 @2 g0 ima404 pid#27814) at /usr/local/lib/perl/5.10.0/DBD/Pg.pm line 214 via at /home/ron/scripts/Postgres/test.pg.pl line 18 -> FETCH for DBD::Pg::db (DBI::db=HASH(0x97fb138)~INNER 'pg_server_version') thr#978b008 Begin dbd_db_FETCH (key: pg_server_version) End dbd_db_FETCH_attrib <- FETCH= 80303 at /usr/local/lib/perl/5.10.0/DBD/Pg.pm line 214 via at /home/ron/scripts/Postgres/test.pg.pl line 18
FETCH DISPATCH (DBI::db=HASH(0x97fb138) rc2/1 @2 g0 ima404 pid#27814) at /usr/local/lib/perl/5.10.0/DBD/Pg.pm line 215 via at /home/ron/scripts/Postgres/test.pg.pl line 18 -> FETCH for DBD::Pg::db (DBI::db=HASH(0x97fb138)~INNER 'private_dbdpg') thr#978b008 Begin dbd_db_FETCH (key: private_dbdpg) End dbd_db_FETCH_attrib .. FETCH DBI::db=HASH(0x97fb138) 'private_dbdpg' = undef <- FETCH= undef at /usr/local/lib/perl/5.10.0/DBD/Pg.pm line 215 via at /home/ron/scripts/Postgres/test.pg.pl line 18
STORE DISPATCH (DBI::db=HASH(0x97fb138) rc2/1 @3 g0 ima41c pid#27814) at /usr/local/lib/perl/5.10.0/DBD/Pg.pm line 215 via at /home/ron/scripts/Postgres/test.pg.pl line 18 -> STORE for DBD::Pg::db (DBI::db=HASH(0x97fb138)~INNER 'private_dbdpg' HASH(0x97fb208)) thr#978b008 Begin dbd_db_STORE (key: private_dbdpg newval: 1 kl:-1212297216) End dbd_db_STORE_attrib STORE DBI::db=HASH(0x97fb138) 'private_dbdpg' => HASH(0x97fb208) <- STORE= 1 at /usr/local/lib/perl/5.10.0/DBD/Pg.pm line 215 via at /home/ron/scripts/Postgres/test.pg.pl line 18 <- connect= DBI::db=HASH(0x97fb1e8) at /usr/local/lib/perl/5.10.0/DBI.pm line 638
STORE DISPATCH (DBI::db=HASH(0x97fb138) rc2/1 @3 g0 ima41c pid#27814) at /usr/local/lib/perl/5.10.0/DBI.pm line 690 -> STORE for DBD::Pg::db (DBI::db=HASH(0x97fb138)~INNER 'PrintError' 1) thr#978b008 Begin dbd_db_STORE (key: PrintError newval: 1 kl:-1212094878) End dbd_db_STORE_attrib STORE DBI::db=HASH(0x97fb138) 'PrintError' => 1 <- STORE= 1 at /usr/local/lib/perl/5.10.0/DBI.pm line 690
STORE DISPATCH (DBI::db=HASH(0x97fb138) rc2/1 @3 g0 ima41c pid#27814) at /usr/local/lib/perl/5.10.0/DBI.pm line 690 -> STORE for DBD::Pg::db (DBI::db=HASH(0x97fb138)~INNER 'AutoCommit' 1) thr#978b008 Begin dbd_db_STORE (key: AutoCommit newval: 1 kl:-1212094878) Begin dbd_db_commit Begin pg_db_rollback_commit (action: commit AutoCommit: 0 BegunWork: 0) Begin PGTransactionStatusType PQtransactionStatus dbd_db_commit txn_status is 0 End pg_db_rollback_commit (result: 1) Setting AutoCommit to 'on' forced a commit End dbd_db_STORE_attrib <- STORE= 1 at /usr/local/lib/perl/5.10.0/DBI.pm line 690
STORE DISPATCH (DBI::db=HASH(0x97fb138) rc2/1 @3 g0 ima41c pid#27814) at /usr/local/lib/perl/5.10.0/DBI.pm line 693 via at /home/ron/scripts/Postgres/test.pg.pl line 18 -> STORE for DBD::Pg::db (DBI::db=HASH(0x97fb138)~INNER 'Username' 'ron') thr#978b008 Begin dbd_db_STORE (key: Username newval: 1 kl:-1212094878) End dbd_db_STORE_attrib STORE DBI::db=HASH(0x97fb138) 'Username' => 'ron' <- STORE= 1 at /usr/local/lib/perl/5.10.0/DBI.pm line 693 via at /home/ron/scripts/Postgres/test.pg.pl line 18
FETCH DISPATCH (DBI::db=HASH(0x97fb138) rc2/1 @2 g0 ima404 pid#27814) at /usr/local/lib/perl/5.10.0/DBI.pm line 693 <> FETCH= 'ron' ('Username' from cache) at /usr/local/lib/perl/5.10.0/DBI.pm line 693
connected DISPATCH (DBI::db=HASH(0x97fb1e8) rc1/1 @4 g0 ima5 pid#27814) at /usr/local/lib/perl/5.10.0/DBI.pm line 699 -> connected in DBD::_::db for DBD::Pg::db (DBI::db=HASH(0x97fb1e8)~0x97fb138 'dbi g:dbname=contacts' 'ron' 'seekrit') thr#978b008 <- connected= undef at /usr/local/lib/perl/5.10.0/DBI.pm line 699 <- connect= DBI::db=HASH(0x97fb1e8)
STORE DISPATCH (DBI::db=HASH(0x97fb138) rc2/1 @3 g0 ima41c pid#27814) at /usr/local/lib/perl/5.10.0/DBI.pm line 708 via at /home/ron/scripts/Postgres/test.pg.pl line 18 -> STORE for DBD::Pg::db (DBI::db=HASH(0x97fb138)~INNER 'dbi_connect_closure' CODE(0x992bda8)) thr#978b008 Begin dbd_db_STORE (key: dbi_connect_closure newval: 1 kl:-1212094878) End dbd_db_STORE_attrib STORE DBI::db=HASH(0x97fb138) 'dbi_connect_closure' => CODE(0x992bda8) <- STORE= 1 at /usr/local/lib/perl/5.10.0/DBI.pm line 708 via at /home/ron/scripts/Postgres/test.pg.pl line 18 dbh: DBI::db=HASH(0x97fb1e8).
DESTROY DISPATCH (DBI::db=HASH(0x97fb1e8) rc1/1 @1 g0 ima10004 pid#27814) <> DESTROY(DBI::db=HASH(0x97fb1e8)) ignored for outer handle (inner DBI::db=HASH(0x97fb138) has ref cnt 1)
DESTROY DISPATCH (DBI::db=HASH(0x97fb138) rc1/1 @1 g0 ima10004 pid#27814) -> DESTROY for DBD::Pg::db (DBI::db=HASH(0x97fb138)~INNER) thr#978b008 Begin dbd_db_disconnect Begin dbd_db_rollback Begin pg_db_rollback_commit (action: rollback AutoCommit: 1 BegunWork: 0) End pg_db_rollback_commit (result: 0) PQfinish Disconnection complete End dbd_db_disconnect Begin dbd_db_destroy End dbd_db_destroy <- DESTROY= undef DESTROY (dbih_clearcom) (dbh 0x97fb138, com 0x97ca270, imp DBD::Pg::db): FLAGS 0x100311: COMSET Warn PrintError PrintWarn AutoCommit PARENT DBI::dr=HASH(0x981dbc8) KIDS 0 (0 Active) dbih_clearcom 0x97fb138 (com 0x97ca270, type 2) done.
-- DBI::END ($@: , $!: )
disconnect_all DISPATCH (DBI::dr=HASH(0x981db68) rc1/3 @1 g0 ima801 pid#27814) at /usr/local/lib/perl/5.10.0/DBI.pm line 716 via at /home/ron/scripts/Postgres/test.pg.pl line 0 -> disconnect_all for DBD::Pg::dr (DBI::dr=HASH(0x981db68)~0x981dbc8) thr#978b008 Begin dbd_discon_all End dbd_discon_all <- disconnect_all= '' at /usr/local/lib/perl/5.10.0/DBI.pm line 716 via at /home/ron/scripts/Postgres/test.pg.pl line 0 ! >> DESTROY DISPATCH (DBI::dr=HASH(0x981dbc8) rc1/1 @1 g0 | |