[30735] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1980 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 13 09:09:52 2008

Date: Thu, 13 Nov 2008 06:09:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 13 Nov 2008     Volume: 11 Number: 1980

Today's topics:
    Re: BigInt in per <brian.d.foy@gmail.com>
    Re: Editor with embedded perl interpreter? (Randal L. Schwartz)
    Re: Editor with embedded perl interpreter? <lap76@19yahoo.com>
    Re: Envirnoment (?) question [LONG] <thumain.the@invalid.invalid>
    Re: Envirnoment (?) question <thumain.the@invalid.invalid>
    Re: How to check whether a file is being opened by othe <toralf.foerster@gmx.de>
    Re: How to check whether a file is being opened by othe <jurgenex@hotmail.com>
        How to check whether a file is being opened by other pr <chen_zhitao@yahoo.com>
    Re: How to check whether a file is being opened by othe <josef.moellers@fujitsu-siemens.com>
        Just can't seem to figure out how to do this in perl <bill@ts1000.us>
        MSXML, validateOnParse, win32 <etwas77@googlemail.com>
    Re: MSXML, validateOnParse, win32 <eric.amick@verizon.net>
        new CPAN modules on Thu Nov 13 2008 (Randal Schwartz)
    Re: Will this be a potential memory leak? <u8526505@gmail.com>
    Re: Will this be a potential memory leak? <nospam-abuse@ilyaz.org>
        win32 vs linux (bignum) <nema@yahoo.com>
    Re: win32 vs linux (bignum) <sisyphus359@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 12 Nov 2008 23:11:29 -0600
From: brian d  foy <brian.d.foy@gmail.com>
Subject: Re: BigInt in per
Message-Id: <121120082311297812%brian.d.foy@gmail.com>

In article <gff3v8$oh6$1@news.acm.uiuc.edu>, Tux Tango
<tux@nospam.ciuc.deu> wrote:

> Hi,
> 
> I have a MSSQL database with bigint datatype. I am doing a simple SELECT 
> query and printing out the information:

You might want to use the bignum prama in your Perl script:

   use bignum;


------------------------------

Date: Thu, 13 Nov 2008 00:07:39 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Editor with embedded perl interpreter?
Message-Id: <86bpwk59ro.fsf@blue.stonehenge.com>

>>>>> "Paolo" == Paolo  <lap76@19yahoo.com> writes:

Paolo> Ok, i've posted this question in comp.lang.perl but this NG is *broken*  (?)...

Not broken.  Officially dead since 1995.  If your ISP allows you to *post* to
CLP, then it's your ISP that is *broken*. :)

print "Just another Perl hacker,"; # the original

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


------------------------------

Date: Thu, 13 Nov 2008 10:53:38 +0100
From: Paolo <lap76@19yahoo.com>
Subject: Re: Editor with embedded perl interpreter?
Message-Id: <op.ukjxropu4j0i0k@fsa1300>


> Not broken.  Officially dead since 1995.  If your ISP allows you to  
> *post* to
> CLP, then it's your ISP that is *broken*. :)

 ... :-) yes, my ISP allows to post to CLP!


------------------------------

Date: Thu, 13 Nov 2008 10:52:20 +0100
From: "Thumain Th." <thumain.the@invalid.invalid>
Subject: Re: Envirnoment (?) question [LONG]
Message-Id: <op.ukjxpio2iwlx6x@jbxp.scrim.fr>

Le Sat, 08 Nov 2008 00:00:09 +0100, Eric Pozharski <whynot@pozharski.name>  
a écrit:

> On 2008-11-07, Thumain Th. <thumain.the@invalid.invalid> wrote:
>> Le Fri, 07 Nov 2008 01:00:44 +0100, Eric Pozharski  
>> <whynot@pozharski.name>
[...]
>> Excellent question!
>> Same file and program runs OK on all our systems but not on THIS one.
>> THIS system is Suse 9.3 , perl 5.8.6 and old 5.000503 leaves
>> in/usr/local/lib/perl5/... , development
>> environment was migrated to this machine , perl 5.8.6 was installed and
>> many modules (including XML , ...)
>> were just copied from original /usr/local/lib/perl5/5.0000503 to same
>> directories (ie NOT 5.8.6) on this
>> system. They seem to function OK.
>
> Oh, no...  I think, you are on your own with such a mess. I (strongly)
> advice to clean up and reinstall the whole environment the right way.  I
> haven't personal experience with mixed environments, but that's surely
> doable.  Post here for advice.  Look, you can't "just copy", you must
> *install*.  You are free to go your way, but consider changing it.
>
[...]
You are right of course , the reason is installing individual perl modules  
on each
of our customers was supposed taking a long time , ....
>
> If my understanding of "Extensible Markup Language (XML) 1.0 (Fourth
> Edition)" (what I have on hand), section 4.1 is correct than
>
[...]
> Look, if you'll go that long exciting way *and* accidentally succeed,
> then you'll feel yourself a kind of superman.  Just keep in mind, fixing
> that particular problem doesn't solve the whole mess.  You would just
> delay the next hit.  And it's coming, I promise.
>
> *CUT*
>
Right again.
Question was **just** why XML::Simple was OK under perl debugger , and not  
in progtam with
same instructions.

Thanks for your advice.

-- 
TT


------------------------------

Date: Thu, 13 Nov 2008 10:47:03 +0100
From: "Thumain Th." <thumain.the@invalid.invalid>
Subject: Re: Envirnoment (?) question
Message-Id: <op.ukjxgpcbiwlx6x@jbxp.scrim.fr>

Le Fri, 07 Nov 2008 08:33:28 +0100, <sln@netherlands.com> a écrit:

> On Fri, 07 Nov 2008 07:43:52 +0100, "Thumain Th."  
> <thumain.the@invalid.invalid> wrote:
>
>> Le Thu, 06 Nov 2008 18:31:40 +0100, Sherm Pendley  
>> <spamtrap@dot-app.org> a
>> écrit:
>>
>>> "Thumain Th." <thumain.the@invalid.invalid> writes:
>>>
>>>> Hi,
>>>>
>>>> Sorry with this strange problem.
>>>> We use XML::Simple to parse small xml files.
>>>> Program was shortened to
>>>>
>>>> use strict;
>>>> use XML::Simple;
>>>> my $ref=XMLin('/var/tmp/file.xml')
>>>>
>>>> On one of our systems XMLin crashes with 'illecal xml character'
>>>> (file.xml  is OK).
>>>
>>> The error you're getting says that the file is not OK. Have you used a
>>> different tool to verify that the XML is in fact well-formed and (if it
>>> has a DTD) valid?
>>>
>>> sherm--
>>>
>> Yes it is , and is parsed OK under debugger.
>
> I wouldn't think Simple requires DTD or any thing else.
> In fact I know thats not the case. I don't know the default
> parser Simple uses, but Simple is not in itself a parser.
>
> I never passed it a file name. Does it do that? Usually an open file
> handle is passed in leu of an xml string. Pass some junk xml string and
> see if it works. Some content at root level. Try to invoke an exception.
>
> Try these two lines:
>
> use  XML::Simple;
> $XML::Simple::PREFERRED_PARSER = 'XML::Parser';
>
> I never use Simple anymore, I have my own complete package I have
> written with many tools. Man that Expat though, its nightmare fast
> but has got nothing else.
>
> sln

Thanks a lot, it worked , Still do not understand why OK with debugger not  
with program..

-- 
TT


------------------------------

Date: Thu, 13 Nov 2008 13:02:30 +0000 (UTC)
From: toralf <toralf.foerster@gmx.de>
Subject: Re: How to check whether a file is being opened by other programs in Perl	script?
Message-Id: <gfh8h6$ur2$1@news.eternal-september.org>

Kuhl wrote:

> Hi, in my Perl script, I need to operate on a file. But I need to
> check whether the file is being opened by any other programs, for
> example vi, and then my operation will be performed based on this
> check result. How to do this check? Thanks.
perldoc -f flock

-- 
MfG/Sincerely

Toralf Förster
pgp finger print: 7B1A 07F4 EC82 0F90 D4C2 8936 872A E508 7DB6 9DA3




------------------------------

Date: Thu, 13 Nov 2008 05:55:25 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: How to check whether a file is being opened by other programs in Perl  script?
Message-Id: <18coh4h6qjohkauh584sb4f7vh6noevl4b@4ax.com>

Kuhl <chen_zhitao@yahoo.com> wrote:
>Hi, in my Perl script, I need to operate on a file. But I need to
>check whether the file is being opened by any other programs, for
>example vi, and then my operation will be performed based on this
>check result. How to do this check? 

Depending on your OS and the file system there may be no way unless the
programs cooperate,  see 'perldoc -q lock': 

	  How can I lock a file?

jue


------------------------------

Date: Thu, 13 Nov 2008 04:13:35 -0800 (PST)
From: Kuhl <chen_zhitao@yahoo.com>
Subject: How to check whether a file is being opened by other programs in Perl  script?
Message-Id: <a87abf39-b11a-4577-9683-86723e7c4e5c@s9g2000prg.googlegroups.com>

Hi, in my Perl script, I need to operate on a file. But I need to
check whether the file is being opened by any other programs, for
example vi, and then my operation will be performed based on this
check result. How to do this check? Thanks.


------------------------------

Date: Thu, 13 Nov 2008 14:41:44 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: How to check whether a file is being opened by other programs in Perl  script?
Message-Id: <gfhaqm$adm$1@nntp.fujitsu-siemens.com>

Kuhl wrote:
> Hi, in my Perl script, I need to operate on a file. But I need to
> check whether the file is being opened by any other programs, for
> example vi, and then my operation will be performed based on this
> check result. How to do this check? Thanks.

The result of this check is absolutely worthless: before you use the 
result of the check, the closed file may be opened, or the open file may 
be closed. The file may even cease to exist before you do anything.

Besides: vim (VI iMproved) opens the file, reads it, then closes it 
again, then you work on some copy (start editing a file, then, on 
another tty look at the editor's open files in /proc/<pidofeditor>/fd). 
When you save the result, vi may very create a new file rather than 
rewrite the old file (ls -lisa <somefile>; vi <somefile> # and change 
it, then save it; ls -lisa <somefile> # the first number is the inode).

It's a similar issue with trying to use the existence of a file as a 
locking mechanism: perldoc -q file.lock

Josef
-- 
These are my personal views and not those of Fujitsu Siemens Computers!
Josef Möllers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize (T.  Pratchett)
Company Details: http://www.fujitsu-siemens.com/imprint.html


------------------------------

Date: Thu, 13 Nov 2008 03:46:12 -0800 (PST)
From: Bill H <bill@ts1000.us>
Subject: Just can't seem to figure out how to do this in perl
Message-Id: <f78ab0d1-06f7-4759-85fa-0b4645ad4171@z6g2000pre.googlegroups.com>

I have been trying to figure out how to do this in perl for weeks and
justcan't seem to fingure it out. I can see it in my mind how it
should work.

The problem I have is this. I have a flash interface that sends perl
some image coordinates that perl then uses to make pdf's using
pdf:api2. In flash I use the standard coordinate system:

0,0------------------> X
|
|
|
v
Y

(ie x,y is starts at top left corner). So I will send the perl program
a image coordinate in the format of x,y,width,height.

Now on the prl side, making the pdf the coordinate system is:

Y
|
|
|
|
0,0 ------------------> X

(ie x,y starts at bottom left corner) and I need to translate the
flash coordinates to the perl / pdf coordinates.

So, if I have a page that is 5 1/2" x 8 1/2" inches, or 396 x 612
(using 72dpi) and I am placing a 1" x 1" image at 1" x 1" (x,y = 72,72
in flash and width = 72, and height = 72) then my x,y  coordinates in
perl whould be 72,540.

The problem I have is, trying to come up with a algorythm that will
translate the one set of coordinates into the other.

I hope I am making sense.

Bill H


------------------------------

Date: Thu, 13 Nov 2008 02:44:19 -0800 (PST)
From: etwas77 <etwas77@googlemail.com>
Subject: MSXML, validateOnParse, win32
Message-Id: <2a268d87-c85a-423f-80e0-09f7bacb3787@a29g2000pra.googlegroups.com>

hello,

i am using perl to parse xml documents, for that i have choosen to
follow the article:
http://www.perl.com/pub/a/2001/04/17/msxml.html.

my $dom= Win32::OLE->new('MSXML2.DOMDocument.4.0') or die "couldn't
create dom $!";
$dom->{async} = 'False';           # disable asynchrous
$dom->{validateOnParse} = 'False';  # no validate

although i have set validateOnParse to "false", it still tries to load
DTD. how come?

greetings,
e.



------------------------------

Date: Thu, 13 Nov 2008 06:37:54 -0500
From: Eric Amick <eric.amick@verizon.net>
Subject: Re: MSXML, validateOnParse, win32
Message-Id: <ou3oh4h6c6i21s7f0074c8qaji79qe12t0@4ax.com>

On Thu, 13 Nov 2008 02:44:19 -0800 (PST), etwas77
<etwas77@googlemail.com> wrote:

>hello,
>
>i am using perl to parse xml documents, for that i have choosen to
>follow the article:
>http://www.perl.com/pub/a/2001/04/17/msxml.html.
>
>my $dom= Win32::OLE->new('MSXML2.DOMDocument.4.0') or die "couldn't
>create dom $!";
>$dom->{async} = 'False';           # disable asynchrous
>$dom->{validateOnParse} = 'False';  # no validate
>
>although i have set validateOnParse to "false", it still tries to load
>DTD. how come?

Despite what the article says, I don't think you should be using the
string "False", which has a true value. Use 0 instead. (FWIW, I've used
MSXML myself this way, and it appears to work fine for me when I specify
0 for validateOnParse.)
-- 
Eric Amick
Columbia, MD


------------------------------

Date: Thu, 13 Nov 2008 05:42:29 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Nov 13 2008
Message-Id: <KA9But.x1o@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Acme-CPANAuthors-Chinese-0.03
http://search.cpan.org/~fayland/Acme-CPANAuthors-Chinese-0.03/
We are chinese CPAN authors 
----
Acme-Stardate-20081112.31792
http://search.cpan.org/~cfedde/Acme-Stardate-20081112.31792/
Provide a simple 'stardate' string 
----
App-OpenVZ-BCWatch-0.01
http://search.cpan.org/~schubiger/App-OpenVZ-BCWatch-0.01/
Monitor the OpenVZ user_beancounters file 
----
App-Rad-0.7
http://search.cpan.org/~garu/App-Rad-0.7/
Rapid (and easy!) creation of command line applications 
----
App-ZofCMS-Plugin-Sub-0.0101
http://search.cpan.org/~zoffix/App-ZofCMS-Plugin-Sub-0.0101/
plugin to execute a subroutine, i.e. sub with priority setting 
----
B-Hooks-OP-Check-EntersubForCV-0.03
http://search.cpan.org/~flora/B-Hooks-OP-Check-EntersubForCV-0.03/
Invoke callbacks on construction of entersub OPs for certain CVs 
----
B-RecDeparse-0.04
http://search.cpan.org/~vpit/B-RecDeparse-0.04/
Deparse recursively into subroutines. 
----
CGI-Test-Input-Custom-0.03
http://search.cpan.org/~salva/CGI-Test-Input-Custom-0.03/
send custom data to CGIs for testing 
----
CMS-Joomla-0.01
http://search.cpan.org/~epipe/CMS-Joomla-0.01/
Joomla! CMS configuration and database access Perl module 
----
Catalyst-Action-Serialize-SimpleExcel-0.011
http://search.cpan.org/~rkitover/Catalyst-Action-Serialize-SimpleExcel-0.011/
Serialize tables to Excel files 
----
Config-Any-0.15
http://search.cpan.org/~bricas/Config-Any-0.15/
Load configuration from different file formats, transparently 
----
Config-Find-0.24
http://search.cpan.org/~salva/Config-Find-0.24/
Find configuration files in the native OS fashion 
----
DBD-Pg-2.11.4
http://search.cpan.org/~turnstep/DBD-Pg-2.11.4/
PostgreSQL database driver for the DBI module 
----
DBIx-Class-InflateColumn-Object-Enum-0.03
http://search.cpan.org/~jmmills/DBIx-Class-InflateColumn-Object-Enum-0.03/
Allows a DBIx::Class user to define a Object::Enum column 
----
Data-CloudWeights-0.2.71
http://search.cpan.org/~pjfl/Data-CloudWeights-0.2.71/
Calculate values for an HTML tag cloud 
----
DateTime-0.45
http://search.cpan.org/~drolsky/DateTime-0.45/
A date and time object 
----
Devel-BeginLift-0.001002
http://search.cpan.org/~flora/Devel-BeginLift-0.001002/
make selected sub calls evaluate at compile time 
----
Digest-MD5-2.37
http://search.cpan.org/~gaas/Digest-MD5-2.37/
Perl interface to the MD5 Algorithm 
----
ExtUtils-Install-1.51
http://search.cpan.org/~yves/ExtUtils-Install-1.51/
install files from here to there 
----
ExtUtils-Install-1.52
http://search.cpan.org/~yves/ExtUtils-Install-1.52/
install files from here to there 
----
File-CountLines-0.0.2
http://search.cpan.org/~moritz/File-CountLines-0.0.2/
efficiently count the number of line breaks in a file. 
----
File-Find-Object-0.1.3
http://search.cpan.org/~shlomif/File-Find-Object-0.1.3/
An object oriented File::Find replacement 
----
GD-Thumbnail-1.20
http://search.cpan.org/~burak/GD-Thumbnail-1.20/
Thumbnail maker for GD 
----
Geo-Coder-Cache-0.04
http://search.cpan.org/~leeym/Geo-Coder-Cache-0.04/
Add cache for Geo::Coder::* 
----
Gtk2-Notify-0.05
http://search.cpan.org/~flora/Gtk2-Notify-0.05/
Perl interface to libnotify 
----
HTML-WikiConverter-0.63
http://search.cpan.org/~diberri/HTML-WikiConverter-0.63/
Convert HTML to wiki markup 
----
HTML-WikiConverter-MediaWiki-0.56
http://search.cpan.org/~diberri/HTML-WikiConverter-MediaWiki-0.56/
Convert HTML to MediaWiki markup 
----
JSON-Any-1.18
http://search.cpan.org/~perigrin/JSON-Any-1.18/
Wrapper Class for the various JSON classes. 
----
LCFG-Build-PkgSpec-0.0.26
http://search.cpan.org/~sjquinney/LCFG-Build-PkgSpec-0.0.26/
Object-oriented interface to LCFG build metadata 
----
LCFG-Build-Tools-0.0.45
http://search.cpan.org/~sjquinney/LCFG-Build-Tools-0.0.45/
LCFG software release tools 
----
LaTeX-Table-0.9.9
http://search.cpan.org/~limaone/LaTeX-Table-0.9.9/
Perl extension for the automatic generation of LaTeX tables. 
----
MojoX-Locale-Maketext-0.01
http://search.cpan.org/~vti/MojoX-Locale-Maketext-0.01/
Locale::Maketext implementation 
----
MojoX-Renderer-TT-0.10
http://search.cpan.org/~abh/MojoX-Renderer-TT-0.10/
Template Toolkit renderer for Mojo 
----
MooseX-Storage-Format-XML-Simple-0.04
http://search.cpan.org/~brunorc/MooseX-Storage-Format-XML-Simple-0.04/
An XML::Simple serialization role 
----
Net-BitTorrent-0.027_010
http://search.cpan.org/~sanko/Net-BitTorrent-0.027_010/
BitTorrent peer-to-peer protocol class 
----
Object-eBay-0.4.0
http://search.cpan.org/~mndrix/Object-eBay-0.4.0/
Object-oriented interface to the eBay API 
----
OpenGL-QEng-0.27
http://search.cpan.org/~overmars/OpenGL-QEng-0.27/
the 3D rendering engine for Games::Quest3D. 
----
PHP-Interpreter-1.0.2
http://search.cpan.org/~aff/PHP-Interpreter-1.0.2/
An embedded PHP5 interpreter 
----
PIX-Walker-1.10
http://search.cpan.org/~lifo/PIX-Walker-1.10/
Process Cisco PIX configs and 'walk' access-lists 
----
POE-Filter-KennySpeak-0.02
http://search.cpan.org/~bingos/POE-Filter-KennySpeak-0.02/
Mmm PfmPpfMpp Mpfmffpmffmpmpppff fmpmfpmmmfmp fmppffmmmpppfmmpmfmmmfmpmppfmm fmpppf mmmpppmpm mpfpffppfppm PmpmppppppppffmFmmpfmmppmmmpmp 
----
Padre-Plugin-CommandLine-0.01
http://search.cpan.org/~szabgab/Padre-Plugin-CommandLine-0.01/
vi and emacs in Padre ? 
----
Padre-Plugin-PAR-0.04
http://search.cpan.org/~smueller/Padre-Plugin-PAR-0.04/
PAR generation from Padre 
----
Padre-Plugin-Tidy-0.01
http://search.cpan.org/~fayland/Padre-Plugin-Tidy-0.01/
tidy html/xml in Padre 
----
Parse-Eyapp-1.125
http://search.cpan.org/~casiano/Parse-Eyapp-1.125/
Extensions for Parse::Yapp 
----
Parse-Eyapp-1.126
http://search.cpan.org/~casiano/Parse-Eyapp-1.126/
Extensions for Parse::Yapp 
----
Parse-Eyapp-1.127
http://search.cpan.org/~casiano/Parse-Eyapp-1.127/
Extensions for Parse::Yapp 
----
Parse-MediaWikiDump-0.53
http://search.cpan.org/~triddle/Parse-MediaWikiDump-0.53/
Tools to process MediaWiki dump files 
----
Path-Abstract-0.094_2
http://search.cpan.org/~rkrimen/Path-Abstract-0.094_2/
Fast and featureful UNIX-style path manipulation 
----
RDF-Redland-Model-ExifTool-0.08
http://search.cpan.org/~arnhemcr/RDF-Redland-Model-ExifTool-0.08/
extends RDF model to process Exif meta data 
----
Rubyish-Attribute-0.01
http://search.cpan.org/~shelling/Rubyish-Attribute-0.01/
provide ruby-like accessor builder: attr_accessor, attr_writer and attr_reader. package Rubyish::Attribute; 
----
Shipwright-1.16
http://search.cpan.org/~sunnavy/Shipwright-1.16/
Best Practical Builder 
----
Slay-Makefile-Gress-0.06
http://search.cpan.org/~nodine/Slay-Makefile-Gress-0.06/
Use Slay::Makefile for software regression testing 
----
Sort-Key-OID-0.04
http://search.cpan.org/~salva/Sort-Key-OID-0.04/
sort OIDs very fast 
----
Statistics-Distributions-Analyze-0.01
http://search.cpan.org/~swansun/Statistics-Distributions-Analyze-0.01/
A module to caculate Anova, T-test, etc. 
----
Task-Padre-Plugin-Deps-0.01
http://search.cpan.org/~szabgab/Task-Padre-Plugin-Deps-0.01/
prereqs of Padre::Plugins 
----
Task-Padre-Plugins-0.03
http://search.cpan.org/~szabgab/Task-Padre-Plugins-0.03/
Get many Plugins of Padre at once 
----
Test-HTML-Content-0.08
http://search.cpan.org/~corion/Test-HTML-Content-0.08/
Perl extension for testing HTML output 
----
Variable-Magic-0.25
http://search.cpan.org/~vpit/Variable-Magic-0.25/
Associate user-defined magic to variables from Perl. 
----
WWW-Newzbin-0.07
http://search.cpan.org/~chrisn/WWW-Newzbin-0.07/
Interface to Newzbin.com's Usenet index 
----
WWW-Search-PubMedLite-0.03
http://search.cpan.org/~diberri/WWW-Search-PubMedLite-0.03/
Access PubMed's database of journal articles 
----
Waft-JS-0.00_01
http://search.cpan.org/~tamashiro/Waft-JS-0.00_01/
JavaScript extensions for Waft 
----
XML-Atom-0.30
http://search.cpan.org/~miyagawa/XML-Atom-0.30/
Atom feed and API implementation 
----
XML-Toolkit-0.0.1
http://search.cpan.org/~perigrin/XML-Toolkit-0.0.1/
A set of tools for dealing with XML with the Way of the Moose. 
----
XML-Toolkit-0.02
http://search.cpan.org/~perigrin/XML-Toolkit-0.02/
A set of tools for dealing with XML with the Way of the Moose. 
----
Xacobeo-0.02
http://search.cpan.org/~potyl/Xacobeo-0.02/
XPath (XML Path Language) visualizer. 
----
Xacobeo-0.02_02
http://search.cpan.org/~potyl/Xacobeo-0.02_02/
XPath (XML Path Language) visualizer. 
----
YAML-LibYAML-0.29
http://search.cpan.org/~nuffin/YAML-LibYAML-0.29/


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


------------------------------

Date: Wed, 12 Nov 2008 22:40:28 -0800 (PST)
From: cyl <u8526505@gmail.com>
Subject: Re: Will this be a potential memory leak?
Message-Id: <0c0358b6-957b-40ef-84d9-32f2ca662845@g17g2000prg.googlegroups.com>

On 11$B7n(B11$BF|(B, $B>e8a(B7$B;~(B48$BJ,(B, Ilya Zakharevich <nospam-ab...@ilyaz.org> wrote:
> [A complimentary Cc of this posting was sent to
> cyl
> <u8526...@gmail.com>], who wrote in article <199d5125-1965-4dab-acd8-935a5ac9a...@40g2000prx.googlegroups.com>:> XS(get_array_ref)
> >  {
> >     AV *av;
> >     int i;
> >     dXSARGS;
>
> >     av = newAV();
> >     i=10;
> >     while(i--){
> >        SV *sv = newSViv(i);
> >        av_push(av,sv);
> >     }
> >     ST(0) = sv_2mortal(newRV((SV*)av));
>
>                          ^^^^^
>                               newRV_noref()     (sp?)
>
> >     XSRETURN(1);
> > }
>

I think you mean newRV_noinc(). With this change no memory increased.
But I am wondering what the lifetime of the array reference is. Will
there be any risk on data corruption when accessing the reference?


------------------------------

Date: Thu, 13 Nov 2008 07:21:22 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Will this be a potential memory leak?
Message-Id: <gfgkhi$2qvp$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
cyl 
<u8526505@gmail.com>], who wrote in article <0c0358b6-957b-40ef-84d9-32f2ca662845@g17g2000prg.googlegroups.com>:
> > >     av = newAV();
> > >     i=10;
> > >     while(i--){
> > >        SV *sv = newSViv(i);
> > >        av_push(av,sv);
> > >     }
> > >     ST(0) = sv_2mortal(newRV((SV*)av));
> >                          ^^^^^
> >                               newRV_noref()     (sp?)
> >
> > >     XSRETURN(1);
> > > }

> I think you mean newRV_noinc(). With this change no memory increased.
> But I am wondering what the lifetime of the array reference is. Will
> there be any risk on data corruption when accessing the reference?

There is no notion of "risk" in programming.  There is correct code,
and incorrect code ;-).  The code above has correct refcounts (here rv
is the return value of newRV_noinc() call):

av(short-time)  av(long-time) rv(short-time) rv(long-time)
  1		     1					after newAV()
  1		     1		1		1	after newRV_noinc()
  1		     1		1		0	after sv_2mortal()

SVs returned from XSUBS should have long-time refcount 0 (unless
stored in long-time C pointers; then the refcount should be
incremented correspondingly).  av is stored in rv only, so must
have long-time refcount 1. Thus your code is correct.

-------------------------------------------------------
If you had

   static AV* stored_array;

   ....
   stored_array = av;
   ST(0) = sv_2mortal(newRV((SV*)av));

then the code would be also correct:

av(short-time)  av(long-time) rv(short-time) rv(long-time)
  1                  1                                  after newAV()
  2                  2          1               1       after newRV()
  2                  2          1               0       after sv_2mortal()

now av is referenced from rv and stored_array, so must have long-time
refcount 2 (and you must change refcount manually when stored_array
value is changing).

-------------------------------------------------------
If you had

   static SV* stored_ref;

   ....
   SV *rv = newRV_noinc(av)
   stored_ref = rv;
   ST(0) = rv;

The refcounts would also be correct:

av(short-time)  av(long-time) rv(short-time) rv(long-time)
  1                  1                                  after newAV()
  1                  1          1               1       after newRV_noinc()

Now av is stored only in rv, and rv is stored only in stored_ref.  So
both long-time refcounts should be 1 on return from XSUB.  And they are!

   There is no need to sv_2mortal(), since its only purpose is that
   short-time refcount of 0 is not possible.  So if you need long-time
   refcount of 0, you must arrange that REFCNT is decremented at some
   later time.

Hope this helps,
Ilya

P.S.  There are thousands of different ways to achieve the required
      long-time refcounts, by doing arbitrary combinations of
      SvREFCNT_inc/dec, different types of newRV, mortalization.

      I did not try to achieve a combination which reflects best the
      intenet of the programs.  All I did was to use fewest number of
      calls to reach this target.  For example, in stored_array
      example, it might be clearer to use newRV_noinc() followed by
      SvREFCNT_inc().

P.P.S. Completely untested, and write-only.  ;-)


------------------------------

Date: Thu, 13 Nov 2008 09:03:57 +0100
From: Matija Papec <nema@yahoo.com>
Subject: win32 vs linux (bignum)
Message-Id: <gfgn1q$lkm$1@ss408.t-com.hr>


I get different results when running same algorithm on different
platforms. What went so terribly wrong here? :)


linux debian v5.10
result:
270288240945436551019305908463402626133344424635003137400602091930237777421360473851797325724922730460543802875678603168471867361078540080081808473288115110060581000433119131429793939577717447508918397345219433071259594386723113371250852722071254367796680880783950950640887679135140232038177361100800

win32 strawberry v5.10
result:
270288240945436550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

==================
use bignum;

sub f {
    my ($n) = @_;
    my $f = 1;
    while ($n > 1) {
        $f *= $n;
        $n -=  1;
    }
    return $f;
}

sub p {
  my ($n,$k) = @_;

    if ($n == $k or $k == $0) { return 1 }
    elsif ($n < $k) { return 0 }
    else {
        my $brojnik = f($n);
        my $nazivnik = f($k)*f($n-$k);
        # print "$brojnik\n$nazivnik\n";
        return $brojnik / $nazivnik;
  }
}

# my ($x,$y) = @ARGV;
my ($x,$y) = (1000, 500);
printf ("%.f", p($x,$y) );


------------------------------

Date: Thu, 13 Nov 2008 03:43:09 -0800 (PST)
From: sisyphus <sisyphus359@gmail.com>
Subject: Re: win32 vs linux (bignum)
Message-Id: <ee4b491a-93a5-4e68-8a14-fb4c3d444f04@35g2000pry.googlegroups.com>

On Nov 13, 7:03=A0pm, Matija Papec <n...@yahoo.com> wrote:
> I get different results when running same algorithm on different
> platforms. What went so terribly wrong here? :)
>

You used bignum - that's what "went wrong" :-)

Actually - I haven't yet worked out exactly what *did* go wrong. It's
not just Strawberry Perl, but any Win32 perl (including ActivePerl)
produces the same "approximate" result - despite the fact that it's
the same version of both bignum and Math::BigInt on both Win32 and
linux.

Afaict, both $brojnik and $nazivnik (is that a political symbol ?) are
calculated to the same value on both platforms, but it's the division
($brojnik/$nazivnik) that creates the difference.

Taking a Devel::Peek::Dump() of the returned value ($brojnik/
$nazivnik) reveals some different field settings between linux and
win32 - which might be worth investigating.
It should also be possible to create a simpler demo of the problem -
but I failed in that quest, too :-)

This is definitely worthy of a bug report - though a simpler demo for
that bug report would be preferable.

Cheers,
Rob


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 1980
***************************************


home help back first fref pref prev next nref lref last post