[27126] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8989 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 23 21:05:50 2006

Date: Thu, 23 Feb 2006 18:05:03 -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, 23 Feb 2006     Volume: 10 Number: 8989

Today's topics:
        dclone alternatives <1usa@llenroc.ude.invalid>
    Re: dclone alternatives <tassilo.von.parseval@rwth-aachen.de>
    Re: dclone alternatives <1usa@llenroc.ude.invalid>
    Re: Implementing a "pull" (?) interface in perl <nomail@sorry.com>
    Re: read from file or from <DATA>? <someone@example.com>
    Re: savely change permission and group on files <Juha.Laiho@iki.fi>
    Re: sharing variables-data perl-asp <toddrw69@excite.com>
    Re: sharing variables-data perl-asp <jay@cutmeukjay.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 23 Feb 2006 20:25:55 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: dclone alternatives
Message-Id: <Xns97739D14EF83asu1cornelledu@127.0.0.1>

Hello All:

Given that I will only be cloning structures in memory, and thus will not 
need the full power of Storable, which one of the following modules should 
I use. I am going to look at their documentation and source later today, 
but I would like to get your recommendations as well.

 Class-Clone          [0.05] Class-Clone
 Clone                [0.18] recursively copy Perl datatypes
 Clone-Any            [1.01] Clone-Any
 Clone-PP             [1.02] Clone-PP
 UNIVERSAL-clone      [0.01] UNIVERSAL-clone

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



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

Date: Thu, 23 Feb 2006 21:39:57 +0100
From: "Tassilo v. Parseval" <tassilo.von.parseval@rwth-aachen.de>
Subject: Re: dclone alternatives
Message-Id: <466kt0F9n8hsU1@news.dfncis.de>

Also sprach A. Sinan Unur:

> Given that I will only be cloning structures in memory, and thus will not 
> need the full power of Storable, which one of the following modules should 
> I use. I am going to look at their documentation and source later today, 
> but I would like to get your recommendations as well.
>
>  Class-Clone          [0.05] Class-Clone
>  Clone                [0.18] recursively copy Perl datatypes
>  Clone-Any            [1.01] Clone-Any
>  Clone-PP             [1.02] Clone-PP
>  UNIVERSAL-clone      [0.01] UNIVERSAL-clone

I'd toss yet another module into this enumeration: Scalar::Util::Clone.

It exposes the clone-infrastrustructure that perl itself uses on
interpreter clones internally and is therefore probably the fastest but
certainly the most comprehensive module as it can clone everything.

That aside, its author can be trusted although no one knows his real
name. From his view few appearances on the perl-porters list it became
obvious that he knows what he's doing (he's the one who conceived that
quite impressive autobox patch to perl; it's now available as CPAN
module not requiring any patch anymore).

Tassilo
-- 
use bigint;
$n=71423350343770280161397026330337371139054411854220053437565440;
$m=-8,;;$_=$n&(0xff)<<$m,,$_>>=$m,,print+chr,,while(($m+=8)<=200);


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

Date: Fri, 24 Feb 2006 00:35:56 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: dclone alternatives
Message-Id: <Xns9773C7787183Aasu1cornelledu@127.0.0.1>

"Tassilo v. Parseval" <tassilo.von.parseval@rwth-aachen.de> wrote in
news:466kt0F9n8hsU1@news.dfncis.de: 

> Also sprach A. Sinan Unur:
> 
>> Given that I will only be cloning structures in memory, and thus will
>> not need the full power of Storable, which one of the following
>> modules should I use. I am going to look at their documentation and
>> source later today, but I would like to get your recommendations as
>> well. 
>>
>>  Class-Clone          [0.05] Class-Clone
>>  Clone                [0.18] recursively copy Perl datatypes
>>  Clone-Any            [1.01] Clone-Any
>>  Clone-PP             [1.02] Clone-PP
>>  UNIVERSAL-clone      [0.01] UNIVERSAL-clone
> 
> I'd toss yet another module into this enumeration:
> Scalar::Util::Clone. 

Thank you. I am sorry to report that I was unable to compile that module 
on Win32 on my first attempt. I will investigate further.

Sinan
-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



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

Date: Thu, 23 Feb 2006 11:06:48 -0800
From: Arvin Portlock <nomail@sorry.com>
Subject: Re: Implementing a "pull" (?) interface in perl
Message-Id: <dtl149$2bfr$1@agate.berkeley.edu>

xhoster@gmail.com wrote:

> Arvin Portlock  wrote:
>
> >xhoster@gmail.com wrote:
> >
> >
> >>The easiest way is to have the application block until a new record is
> >>ready. That is just what readline aka <> does:
> >>
> >>$parser->init($foo);
> >>while (defined (my $i=$parser->get_one()) {
> >>  process($i);
> >>};
> >
> >I don't understand. You are describing exactly how I want the
> >interface to act but not saying how you are doing it, i.e.,
> >how exactly get_one() works. But yes, that's what I'm aiming for.
>
>
> OK, now I don't understand.  If you give an example of how get_all() 
> would work, we could discuss how to make it work like get_one() 
> (assuming I can). But without seeing what you are currently doing, I 
> don't know to help you change it!
>
> Xho

Right now I'm not object oriented but I want to move in that
direction. This is a simplified example of what I'm doing.
Assuming a file containing records like this:

<record>
   <author>Baum, L. Frank</author>
   <title>The Wizard of Oz</title>
   <date>1909</date>
</record>

The module works something like this:

package FetchRecords;
use Exporter;
@ISA = Exporter;
@EXPORT = qw(getRecords);

my @records;
my $current_record = {};

sub getRecords {
    my $xmlfile = shift;

    ## Parser setup and initialization here ...

    return \@records;
}

sub end_element {
    my ($self, $e) = @_;
    if ($e->{LocalName} eq 'author') {
       $current_record->{author} = $e->{data};
    } elsif ($e->{LocalName} eq 'title') {
       $current_record->{author} = $e->{data};
    } elsif ($e->{LocalName} eq 'date') {
       $current_record->{date} = $e->{data};
    } elsif ($e->{LocalName} eq 'record') {
       push @records, $current_record;
       $current_record = {};
    }
}

And the calling program works like this:

use FetchRecords;

my $records = getRecords('xmlfile.xml');

foreach my $record (@$records) {
    my $author = $record->{author};

    ## etc...
}

The parser details, and even the fact that I'm using an XML
parser are completely hidden from the calling application
(other than the fact that it feeds an XML filename into it).
The module maintains a global @records array and pushes new
records into it each time a </record> tag is encountered.
These records are built up as the individual elements within
<record> are parsed. The module starts with the parsing
of the document and does not return to the calling program
until the entire document has been parsed. I'd prefer that
it return the record back to the calling program whenever
the </record> end tag is encountered rather than saving them
all up until the end. Again, I need to hide all of the parsing
details from the calling application. All it should know is
that it is being fed record objects or structs.



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

Date: Fri, 24 Feb 2006 00:37:03 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: read from file or from <DATA>?
Message-Id: <PysLf.2273$M52.1632@edtnps89>

Michael Friendly wrote:
> This is probably simple, but I can't find it...
> I frequently write scripts to take input from STDIN or from a named file
> by doing
> 
> open(STDIN, "<$opt_i") or die "-i $opt_i: can't open.\n" if $opt_i ;

No need to mess with the STD* filehandles:

@ARGV = $opt_i if defined $opt_i;

>  ...
> while (<>) {
> }
> 
> but how can I read from <DATA> if no file is given on the command line?

You just said that you will take input from STDIN if no file is given on the
command line.  Is this a psychology test?  :-)

You probably want to determine if STDIN is connected to a terminal or
receiving data from redirection or a pipe.

perldoc -f -t



John
-- 
use Perl;
program
fulfillment


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

Date: Thu, 23 Feb 2006 19:15:50 +0000 (UTC)
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: savely change permission and group on files
Message-Id: <dtl1l5$b2i$1@ichaos2.ichaos-int>

Lars Madsen <daleif@imf.au.dk> said:
>I have a small problem here. We have a special directory on our file 
>system (Linux) where a lot of people are writing to (mostly HTML pages, 
>no we do not have a CMS, this low tech is fine for now).
>
>Now we also have some secretaries who can help edit these files. The 
>problems is of course permissions, secretary B need to be able to edit 
>the files owned by user A.

The 'chmod g+s' solution is pretty much correct. The only potential problem
is someone who sets their umask (file creation mask) to a too strict
value (f.ex. 066, to prohibit all acess to created files from everyone
but the creator).

Depending on your Linux distribution, it may support a more sophisticated
way to control file access, called ACLs (access control lists). These
can be defined to be inherited by newly created objects, and can be set
to provide required level of access - and this solution should be
resistent to the umask "problem" described above.

This message is crossposted in comp.os.linux.misc, and followups are
directed to the same; if you need further help with the ACLs (they
can be a pain..), please continue in that group.
-- 
Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
         PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)


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

Date: Thu, 23 Feb 2006 19:04:44 GMT
From: "Todd W" <toddrw69@excite.com>
Subject: Re: sharing variables-data perl-asp
Message-Id: <gHnLf.59889$PL5.1320@newssvr11.news.prodigy.com>


"UkJay" <jay@cutmeukjay.com> wrote in message
news:dtkhp3$4va$1@news6.svr.pol.co.uk...
> Is it possible to pass data between variables when using active server
pages
> and inserting some perl script in asp?
>
> Also how do you invoke a perl script from an active server page?
>
> Yes I want the best of both worlds ;-)
>

The "pass data between variables" part I dont understand, but I think you
are looking for PerlScript. ASP in Perl. Here is a quickstart guide:

http://www.4guysfromrolla.com/webtech/021100-1.shtml

trwww




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

Date: Thu, 23 Feb 2006 22:28:20 -0000
From: "UkJay" <jay@cutmeukjay.com>
Subject: Re: sharing variables-data perl-asp
Message-Id: <dtlcu0$pbn$1@news6.svr.pol.co.uk>


"Todd W" <toddrw69@excite.com> wrote in message 
news:gHnLf.59889$PL5.1320@newssvr11.news.prodigy.com...
>
> "UkJay" <jay@cutmeukjay.com> wrote in message
> news:dtkhp3$4va$1@news6.svr.pol.co.uk...
>> Is it possible to pass data between variables when using active server
> pages
>> and inserting some perl script in asp?
>>
>> Also how do you invoke a perl script from an active server page?
>>
>> Yes I want the best of both worlds ;-)
>>
>
> The "pass data between variables" part I dont understand, but I think you
> are looking for PerlScript. ASP in Perl. Here is a quickstart guide:
>
> http://www.4guysfromrolla.com/webtech/021100-1.shtml
>
> trwww
>
>

I'm not looking for perl script
I use it

I want to use perl script in asp
and share data


-- 
Best Regards,
James (ukjay)

http://www.ukjay.co.uk

Garden WebCam,Photography,Competitions,Weather (AWS)







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

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 V10 Issue 8989
***************************************


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