[28483] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9847 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 14 06:05:50 2006

Date: Sat, 14 Oct 2006 03:05:04 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 14 Oct 2006     Volume: 10 Number: 9847

Today's topics:
    Re: bless an object in a BEGIN block (Singleton) <zhushenli@gmail.com>
    Re: bless an object in a BEGIN block (Singleton) <zhushenli@gmail.com>
    Re: bless an object in a BEGIN block (Singleton) <zhushenli@gmail.com>
    Re: FAQ 4.36 How can I expand variables in text strings <nobull67@gmail.com>
    Re: FAQ 4.36 How can I expand variables in text strings <nobull67@gmail.com>
        help me pass argument to the subroutine and then return <123imemyself@gmail.com>
    Re: help me pass argument to the subroutine and then re <nobull67@gmail.com>
    Re: help me pass argument to the subroutine and then re usenet@DavidFilmer.com
    Re: help me pass argument to the subroutine and then re (reading news)
    Re: I have no problems eating cereal...after it softens <ddunham@redwood.taos.com>
        new CPAN modules on Sat Oct 14 2006 (Randal Schwartz)
    Re: print sybase system stored procedure output to file <nobull67@gmail.com>
    Re: replace variable with same variable <bart@nijlen.com>
    Re: replace variable with same variable <bik.mido@tiscalinet.it>
    Re: Sorting and moving files to dir for DVD burn <hjp-usenet2@hjp.at>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 13 Oct 2006 21:08:06 -0700
From: "Davy" <zhushenli@gmail.com>
Subject: Re: bless an object in a BEGIN block (Singleton)
Message-Id: <1160798886.371149.262520@h48g2000cwc.googlegroups.com>


sc wrote:
> Hi Davy,
>
> Do you mean the code like this:
>
> {
>         package Person;
>
>         my $instance;
>
>         sub new {
>                 my ($class, $name) = @_;
>                 $instance = bless \$name, $class unless ref $instance;
>                 return $instance;
>         }
>
>         sub name {
>                 $self = shift;
>                 $$self;
>         }
> }
>
> my $me = Person->new("hello");
> my $you = Person->new("world"); # Only one Person can be created
> print $me->name, " ", $you->name, "\n";
Hi sc,

Thanks a lot!
Do you mean use print to know only one Person object created?
And what's $$self mean?

Best regards,
Davy
>
>
> On Oct 13, 3:02 pm, "Davy" <zhushe...@gmail.com> wrote:
> > Hi all,
> >
> > A perl design pattern document talk about Singleton.
> > (http://www.perl.com/pub/a/2003/06/13/design1.html?page=2)
> >
> > My problem is what's the BEGIN block mean? I just can not find it in
> > Perl Doc.
> >
> > package Name;
> > my $singleton;
> > BEGIN {
> >     $singleton = {
> >         attribute => 'value',
> >         another => 'something',
> >     };
> >     bless $singleton, "Name";}sub new {
> >     my $class = shift;
> >     return $singleton;
> >
> > }About Singleton: GoF calls the special case when there is a single
> > resource that everyone needs to share the singleton pattern. Perhaps
> > the resource is a hash of configuration parameters. Everyone should be
> > able to look there, but it should only be built on startup (and
> > possibly rebuilt on some signal).
> > 
> > Best regards,
> > Davy



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

Date: 13 Oct 2006 21:11:05 -0700
From: "Davy" <zhushenli@gmail.com>
Subject: Re: bless an object in a BEGIN block (Singleton)
Message-Id: <1160799065.883328.170720@f16g2000cwb.googlegroups.com>


anno4000@radom.zrz.tu-berlin.de wrote:
> Davy <zhushenli@gmail.com> wrote in comp.lang.perl.misc:
> >
> > anno4000@radom.zrz.tu-berlin.de wrote:
> > > Davy <zhushenli@gmail.com> wrote in comp.lang.perl.misc:
> > > >
> > > > anno4000@radom.zrz.tu-berlin.de wrote:
> > > > > Davy <zhushenli@gmail.com> wrote in comp.lang.perl.misc:
> > > > > > Hi all,
> > > > > >
> > > > > > A perl design pattern document talk about Singleton.
> > > > > > (http://www.perl.com/pub/a/2003/06/13/design1.html?page=2)
> > > > > >
> > > > > > My problem is what's the BEGIN block mean? I just can not find it in
> > > > > > Perl Doc.
> > > > >
> > > > > It's in perlmod.
> > > > >
> > > > > A BEGIN block is executed as soon as it is compiled, thus before
> > > > > any run-time action happens.
> > > > [snip]
> > > > Hi,
> > > >
> > > > If I call Name->new() several times, the $singleton will have only one
> > > > copy in memory.
> > >
> > > Right.  "new" is a misnomer here, it always gives you the pre-created
> > > single object of the class.
> > >
> > > > But as you said, if not use BEGIN, the $singleton will have one copy
> > > > according to one object.
> > > > Is my understanding right?
> > >
> > > BEGIN doesn't change what the code in the block does, it only determines
> > > when it does it, namely as early as possible.  I don't think it's
> > > necessary in the original context.
> > [snip]
> >
> > Thanks!
> >
> > But design pattern Singleton means there is only one copy in the memory
> > that everyone (every object) can share. So I think there must be some
> > meaning to "bless in BEGIN block".
> >
> > I have searched bless in this group and find "bless means link the
> > reference to the class". Therefore, if "bless in BEGIN i.e. bless at
> > compile time", maybe only one reference is generated?
>
> Did you read my post?
>
> > > BEGIN doesn't change what the code in the block does, it only
> > > determines when it does it
>
> bless() in BEGIN does the exact same thing it does elsewhere.  There
> is only one object in the class because only one is generated, whether
> in BEGIN or not.  BEGIN is entirely inessential in the code.
[snip]

Hi anno,

Thanks for your explaination!
OK, I agree. But I think the author may mean something :)

Best regards,
Davy

> 
> Anno



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

Date: 13 Oct 2006 21:13:21 -0700
From: "Davy" <zhushenli@gmail.com>
Subject: Re: bless an object in a BEGIN block (Singleton)
Message-Id: <1160799201.735004.176380@f16g2000cwb.googlegroups.com>


Randal L. Schwartz wrote:
> >>>>> "Martijn" == Martijn Lievaart <m@remove.this.part.rtij.nl> writes:
>
> Martijn> Gang of Four, the authors of "Design Patterns". One of those books
> Martijn> every programmer should read.
>
> And then ignored for the most part in Perl, because it was written about
> things that had to be done awkardly in C++ and Java that are usually trivial
> in Perl.
>
> Every language has things it does well (inherently, perhaps), and things it
> does poorly.  Every language will thus develop its own collection of "recipes"
> over time of how to do things that aren't one-liners.  An example of that is
> the Perl Cookbook and Perl Best Practices for basic Perl, or things like the
> examples section of poe.perl.org for the POE framework.
>
> It's a mistake to presume that GoF is "universal" in some way.
>
> A far closer non-Perl book to serve as a model for Perl patterns is "Smalltalk
> Best Practice Patterns" by Kent Beck, probably now out of print but you can
> find it at better bookstores around.  Smalltalk (late-binding) is a much
> closer fit to Perl than either C++ or Java (compile-time binding), so the
> problems and solutions are much more similar.  I wrote about this in a recent
> column (http://www.stonehenge.com/merlyn/LinuxMag/col84.html).
>
> print "Just another Perl hacker,"; # the original
[snip]
Hi Randal,

Thanks a lot!
I want to understand design pattern and used it in my future code
design :)

Best regards,
Davy

>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
> <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
> See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
> 
> -- 
> Posted via a free Usenet account from http://www.teranews.com



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

Date: 14 Oct 2006 01:52:27 -0700
From: "Brian McCauley" <nobull67@gmail.com>
Subject: Re: FAQ 4.36 How can I expand variables in text strings?
Message-Id: <1160815947.741258.29200@m7g2000cwm.googlegroups.com>

On Oct 13, 3:03 pm, Martijn Lievaart <m...@remove.this.part.rtij.nl>
wrote:
> my $text = 'this has a $foo in it and a $bar';
> $text = eval "\"$text\"";
> die $@ if $@;
> print $text;
>
> And the answer obviously is, it breaks when there is a " in the string.

Hey its the other QASFTBMGALTAI !  [1]

That's both in a week!

chop ($text = eval "<<__EOT__\n$text\n__EOT__");
die $@ if $@;

It still breaks when there is"\n__EOT__\n" in the string but this is
rather rarer than a double quote character.

[1] Google it (in Groups).



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

Date: 14 Oct 2006 02:03:37 -0700
From: "Brian McCauley" <nobull67@gmail.com>
Subject: Re: FAQ 4.36 How can I expand variables in text strings?
Message-Id: <1160816617.713814.66790@m7g2000cwm.googlegroups.com>



On Oct 13, 2:03 am, PerlFAQ Server <b...@stonehenge.com> wrote:
>
>     You can use a substitution with a double evaluation. The first /e turns
>     $1 into $foo, and the second /e turns $foo into its value. You may want
>     to wrap this in an "eval": if you try to get the value of an undeclared
>     variable while running under "use strict", you get a fatal error.
>
>             eval { $text =~ s/(\$\w+)/$1/eeg };
>             die if $@;
>

Agghh!!!! Will nobody ever fix this FAQ!

If you should test your code before posting to Usenet you sure as hell
should before adding it to the FAQ!

$text =~ s/(\$\w+)/$1/eeg;

 ...is simply shorthand for...

$text =~ s/(\$\w+)/eval $1/eg;

There's an eval(STRING) there _already_ that traps and ignores any
violations of "use strict".

The extra eval{BLOCK} is nothing but cargo-cult snake-oil bullshit (to
mix my metaphors).



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

Date: 13 Oct 2006 22:35:57 -0700
From: "hyper-sensitive" <123imemyself@gmail.com>
Subject: help me pass argument to the subroutine and then return the value from that subroutine to another.
Message-Id: <1160804157.554983.87760@e3g2000cwe.googlegroups.com>

Hi,
I want the Perl script to pass $folders to CreateArray subroutine. Once
the forech loop is over and an array is created in the CreateArray I
want it to be passed to the Process subroutine , and then to the
hash_grep subroutine .Then the array is printed.


#!\iw-home/iw-perl/bin/iwperl -w
#use strict;
use warnings;
use TeamSite::Config;

my $iwhome = TeamSite::Config::iwgethome();
my $iwmount = TeamSite::Config::iwgetmount();

my @branches;

find_branches("$iwmount/intranet/main");
#print join("\n", @branches) . "\n";
foreach my $folder_path(@branches)
{
   my $main_path=join("\n", $folder_path) . "\n";
      #print $main_path;
   if($main_path=~/\/main\/.+\/WORKAREA\/.+\/.+/)
    {
     #print $main_path;
     my @split_main_path = split(/\// , $main_path);
     pop(@split_main_path);
     my $folders=join("\/" , @split_main_path)."\n";
     #createArray1($folders);
     print $folders ;
    }

    if($main_path=~/\/main\/WORKAREA\/.+\/.+/)
    {
    }
}

#hash_grep();
#print @all_folders;

#my $results = process(\@all_folders);
#print "RESULTS:\n\t" . join("\n\t", sort(@$results)) . "\n";
#----------------------------------------------------

sub find_branches
{
    my $dir = shift;
    push(@branches, $dir);

    opendir(DIR, $dir) ;#|| die("[opendir] '$dir' ($!)");
    my @entries = grep { !/^(?:\.|STAGING|EDITION)/ } readdir(DIR);
    closedir(DIR);
    find_branches("$dir/$_") foreach(@entries);
}
sub createArray1  #This will create an array from the $folders ,being
passed to it.
{
    my $folder = shift;
    my @all_folders;
    push(@all_folders , $folder);
    #print @all_folders ;



}

sub process{
    my $full_list = shift;
    my %seen;
    my @results = grep(m|^.*/WORKAREA/[^/]+$| && !$seen{$_}++,
@$full_list);

  ENTRIES:
    foreach my $entry (@$full_list){
        foreach my $wapath (keys(%seen)){
            next ENTRIES if ($entry =~ m|^$wapath|);
        }
        push(@results, $entry);
    }
 #print @results ;
return \@results;
}
sub hash_grep{

    my $full_list = shift;
    my %seen;
    my @new_list = grep(!$seen{$_}++, @$full_list);
    return \@new_list;
}



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

Date: 14 Oct 2006 00:45:10 -0700
From: "Brian McCauley" <nobull67@gmail.com>
Subject: Re: help me pass argument to the subroutine and then return the value from that subroutine to another.
Message-Id: <1160811910.624369.89400@m73g2000cwd.googlegroups.com>



On Oct 14, 6:35 am, "hyper-sensitive" <123imemys...@gmail.com> wrote:

> I want the Perl script to pass $folders to CreateArray subroutine. Once
> the forech loop is over and an array is created in the CreateArray I
> want it to be passed to the Process subroutine , and then to the
> hash_grep subroutine .Then the array is printed.

> sub createArray1
> {
>     my $folder = shift;
>     my @all_folders;
>     push(@all_folders , $folder);
> }

Each call to your CreateArray creates a new array, puts one element in
it and then discards it.

You need to add each folder to the _same_ array.

You could use a global array or pass the array as an argument to
CreateArray.

Of course if you were to make CreateArray take the array as an argument
it would just be the same as the buitin push() so you may as well get
rid of it completely and just use push() directly. This would be the
right thing to to.



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

Date: 14 Oct 2006 00:48:21 -0700
From: usenet@DavidFilmer.com
Subject: Re: help me pass argument to the subroutine and then return the value from that subroutine to another.
Message-Id: <1160812101.845445.157200@h48g2000cwc.googlegroups.com>

hyper-sensitive wrote:
 [snip multipost]

Please don't multipost. It's rude.

-- 
David Filmer (http://DavidFilmer.com)



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

Date: Sat, 14 Oct 2006 07:52:44 GMT
From: "Mumia W. (reading news)" <paduille.4059.mumia.w@earthlink.net>
Subject: Re: help me pass argument to the subroutine and then return the value from that subroutine to another.
Message-Id: <gH0Yg.9112$Y24.2929@newsread4.news.pas.earthlink.net>

On 10/14/2006 12:35 AM, hyper-sensitive wrote:
> Hi,
> I want the Perl script to pass $folders to CreateArray subroutine. Once
> the forech loop is over and an array is created in the CreateArray I
> want it to be passed to the Process subroutine , and then to the
> hash_grep subroutine .Then the array is printed.
> 
> 
> #!\iw-home/iw-perl/bin/iwperl -w
> #use strict;

Make your program run with strict enabled. You can still create package 
variables using 'our' and use "use vars"

> use warnings;
> use TeamSite::Config;
> 
> my $iwhome = TeamSite::Config::iwgethome();
> my $iwmount = TeamSite::Config::iwgetmount();
> 
> my @branches;
> 

Declare "@all_folders" up here, so that all the functions that need to 
see it can.

my @all_folders;


> find_branches("$iwmount/intranet/main");
> #print join("\n", @branches) . "\n";
> foreach my $folder_path(@branches)
> {
>    my $main_path=join("\n", $folder_path) . "\n";
>       #print $main_path;
>    if($main_path=~/\/main\/.+\/WORKAREA\/.+\/.+/)
>     {
>      #print $main_path;
>      my @split_main_path = split(/\// , $main_path);
>      pop(@split_main_path);
>      my $folders=join("\/" , @split_main_path)."\n";
>      #createArray1($folders);
>      print $folders ;
>     }
> 
>     if($main_path=~/\/main\/WORKAREA\/.+\/.+/)
>     {
>     }
> }
> 
> #hash_grep();
> #print @all_folders;
> 
> #my $results = process(\@all_folders);
> #print "RESULTS:\n\t" . join("\n\t", sort(@$results)) . "\n";
> #----------------------------------------------------
> 
> sub find_branches
> {
>     my $dir = shift;
>     push(@branches, $dir);
> 
>     opendir(DIR, $dir) ;#|| die("[opendir] '$dir' ($!)");
>     my @entries = grep { !/^(?:\.|STAGING|EDITION)/ } readdir(DIR);
>     closedir(DIR);
>     find_branches("$dir/$_") foreach(@entries);
> }
> sub createArray1  #This will create an array from the $folders ,being
> passed to it.
> {
>     my $folder = shift;
>     my @all_folders;

Don't delcare @all_folders here, or you restrict the variable to be 
bound within createArray1.

>     push(@all_folders , $folder);
>     #print @all_folders ;
> 
> 
> 
> }
> 
> sub process{
>     my $full_list = shift;
>     my %seen;
>     my @results = grep(m|^.*/WORKAREA/[^/]+$| && !$seen{$_}++,
> @$full_list);
> 
>   ENTRIES:
>     foreach my $entry (@$full_list){
>         foreach my $wapath (keys(%seen)){
>             next ENTRIES if ($entry =~ m|^$wapath|);
>         }
>         push(@results, $entry);
>     }
>  #print @results ;
> return \@results;
> }
> sub hash_grep{
> 
>     my $full_list = shift;
>     my %seen;
>     my @new_list = grep(!$seen{$_}++, @$full_list);
>     return \@new_list;
> }
> 

Although it's not related to your question, something about 
find_branches() makes me think that you can code it better using File::Find.


HTH

-- 
Mumia W.
paduille.4059.mumia.w@earthlink.net
This is a temporary e-mail to help me catch some s-p*á/m.


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

Date: Sat, 14 Oct 2006 05:33:02 GMT
From: Darren Dunham <ddunham@redwood.taos.com>
Subject: Re: I have no problems eating cereal...after it softens. Why is replacing a simple string so hard then?
Message-Id: <iE_Xg.10201$TV3.4023@newssvr21.news.prodigy.com>

samiam@mytrashmail.com wrote:
> #while ($intext) $intext = {s/$orgtext/$newtext/ms;}
> # the ms is for coping correctly with newlines (that can easily appear
> in a binary).
> # else {print "something's up.";}

Presumably you were trying something in those comments.  I have no idea
what you mean about the 'ms' bit.  That's not what they do.

$intext =~ s/$orgtext/$newtext/g;

-- 
Darren Dunham                                           ddunham@taos.com
Senior Technical Consultant         TAOS            http://www.taos.com/
Got some Dr Pepper?                           San Francisco, CA bay area
         < This line left intentionally blank to confuse you. >


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

Date: Sat, 14 Oct 2006 04:42:07 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sat Oct 14 2006
Message-Id: <J73zq7.CyE@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.

CGI-Application-Plugin-Output-XSV-0.9_02
http://search.cpan.org/~zackse/CGI-Application-Plugin-Output-XSV-0.9_02/
generate csv output from a CGI::Application runmode
----
CGI-Application-Plugin-Output-XSV-0.9_03
http://search.cpan.org/~zackse/CGI-Application-Plugin-Output-XSV-0.9_03/
generate csv output from a CGI::Application runmode
----
CPANPLUS-0.076
http://search.cpan.org/~kane/CPANPLUS-0.076/
API & CLI access to the CPAN mirrors
----
Catalyst-Model-ISBNDB-0.10
http://search.cpan.org/~rjray/Catalyst-Model-ISBNDB-0.10/
Provide Catalyst access to isbndb.com
----
Catalyst-Plugin-Authorization-Roles-0.05
http://search.cpan.org/~nuffin/Catalyst-Plugin-Authorization-Roles-0.05/
Role based authorization for Catalyst based on Catalyst::Plugin::Authentication.
----
Catalyst-Plugin-Session-State-URI-0.07
http://search.cpan.org/~nuffin/Catalyst-Plugin-Session-State-URI-0.07/
Saves session IDs by rewriting URIs delivered to the client, and extracting the session ID from requested URIs.
----
Config-LotusNotes-0.22
http://search.cpan.org/~albers/Config-LotusNotes-0.22/
Access Lotus Notes/Domino configuration
----
DateTime-TimeZone-0.51
http://search.cpan.org/~drolsky/DateTime-TimeZone-0.51/
Time zone object base class and factory
----
EekBoek-1.01.01
http://search.cpan.org/~jv/EekBoek-1.01.01/
Bookkeeping software for small and medium-size businesses
----
File-Find-Match-1.0
http://search.cpan.org/~dhardison/File-Find-Match-1.0/
Perform different actions on files based on file name.
----
File-Read-0.0602
http://search.cpan.org/~saper/File-Read-0.0602/
Unique interface for reading one or more files
----
FrameNet-WordNet-Detour-0.99c
http://search.cpan.org/~reiter/FrameNet-WordNet-Detour-0.99c/
a WordNet to FrameNet Detour.
----
HTML-DateSelector-0.01
http://search.cpan.org/~tokuhirom/HTML-DateSelector-0.01/
Generate HTML for date selector.
----
IPC-Cmd-0.32
http://search.cpan.org/~kane/IPC-Cmd-0.32/
finding and running system commands made easy
----
Image-Imlib2-1.13
http://search.cpan.org/~lbrocard/Image-Imlib2-1.13/
Interface to the Imlib2 image library
----
Mail-QmailSend-Multilog-Parse-0.01
http://search.cpan.org/~masahito/Mail-QmailSend-Multilog-Parse-0.01/
Parse qmail-send multilog files
----
Mail-QmailSend-MultilogParser-0.01
http://search.cpan.org/~masahito/Mail-QmailSend-MultilogParser-0.01/
Parse qmail-send multilog files
----
Mail-QmailSend-MultilogParser-0.02
http://search.cpan.org/~masahito/Mail-QmailSend-MultilogParser-0.02/
Parse qmail-send multilog files
----
Mail-Toaster-5.02
http://search.cpan.org/~msimerson/Mail-Toaster-5.02/
turns a computer into a secure, full-featured, high-performance mail server.
----
Net-Amazon-S3-0.37
http://search.cpan.org/~lbrocard/Net-Amazon-S3-0.37/
Use the Amazon S3 - Simple Storage Service
----
Net-Appliance-Session-0.07
http://search.cpan.org/~oliver/Net-Appliance-Session-0.07/
Run command-line sessions to network appliances
----
Net-Cisco-AccessList-Extended-0.03
http://search.cpan.org/~oliver/Net-Cisco-AccessList-Extended-0.03/
Generate Cisco extended access-lists
----
Net-Cisco-ObjectGroup-0.03
http://search.cpan.org/~oliver/Net-Cisco-ObjectGroup-0.03/
Generate Cisco ACL object groups
----
Net-FTP-Common-5.32
http://search.cpan.org/~tbone/Net-FTP-Common-5.32/
simplify common usages of Net::FTP
----
Net-IPMessenger-0.06
http://search.cpan.org/~masanorih/Net-IPMessenger-0.06/
Interface to the IP Messenger Protocol
----
Net-LDAP-HTMLWidget-0.01
http://search.cpan.org/~mramberg/Net-LDAP-HTMLWidget-0.01/
Like FromForm but with Net::LDAP and HTML::Widget
----
Object-InsideOut-2.09
http://search.cpan.org/~jdhedden/Object-InsideOut-2.09/
Comprehensive inside-out object support module
----
Object-InsideOut-2.11
http://search.cpan.org/~jdhedden/Object-InsideOut-2.11/
Comprehensive inside-out object support module
----
Object-InsideOut-2.12
http://search.cpan.org/~jdhedden/Object-InsideOut-2.12/
Comprehensive inside-out object support module
----
PAR-Repository-Client-0.14
http://search.cpan.org/~smueller/PAR-Repository-Client-0.14/
Access PAR repositories
----
Pugs-Compiler-Rule-0.20
http://search.cpan.org/~fglock/Pugs-Compiler-Rule-0.20/
Compiler for Perl 6 Rules
----
SWISH-API-Object-0.03
http://search.cpan.org/~karman/SWISH-API-Object-0.03/
return SWISH::API results as objects
----
Search-Tools-0.04
http://search.cpan.org/~karman/Search-Tools-0.04/
tools for building search applications
----
Sledge-Plugin-Stash-0.01
http://search.cpan.org/~tokuhirom/Sledge-Plugin-Stash-0.01/
sledge with lvalue.
----
Sort-Key-1.26
http://search.cpan.org/~salva/Sort-Key-1.26/
the fastest way to sort anything in Perl
----
Sys-Utmp-1.6
http://search.cpan.org/~jstowe/Sys-Utmp-1.6/
Object(ish) Interface to UTMP files.
----
Text-Modify-0.4.1
http://search.cpan.org/~lammel/Text-Modify-0.4.1/
oo-style interface for simple, rule-based text modification
----
Text-Modify-0.5
http://search.cpan.org/~lammel/Text-Modify-0.5/
oo-style interface for simple, rule-based text modification
----
Time-HiRes-1.92
http://search.cpan.org/~jhi/Time-HiRes-1.92/
High resolution alarm, sleep, gettimeofday, interval timers
----
Tk-MK-0.10
http://search.cpan.org/~mikra/Tk-MK-0.10/
----
Util-Properties-0.08
http://search.cpan.org/~alexmass/Util-Properties-0.08/
Java.util.properties like class
----
WebService-ISBNDB-0.31
http://search.cpan.org/~rjray/WebService-ISBNDB-0.31/
A Perl extension to access isbndb.com
----
WebService-Nestoria-Search-0.01
http://search.cpan.org/~kaoru/WebService-Nestoria-Search-0.01/
Perl interface to the Nestoria Search public API.
----
Win32-Env-0.03
http://search.cpan.org/~rowaa/Win32-Env-0.03/
set and retrieve global system and user environment variables under Win32.
----
XSLoader-0.07
http://search.cpan.org/~saper/XSLoader-0.07/
Dynamically load C libraries into Perl code


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/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: 14 Oct 2006 01:41:55 -0700
From: "Brian McCauley" <nobull67@gmail.com>
Subject: Re: print sybase system stored procedure output to filehandle
Message-Id: <1160815315.190209.89360@i42g2000cwa.googlegroups.com>



On Oct 13, 3:39 am, peter.br...@exemail.com.au wrote:
> Hi - is there a simple way to redirect the output from a Sybase system
> stored proc [sp_recompile] to an open filhandle  - currently the output
> - 'Each stored procedure and trigger that uses table 'xxxxx will be
> recompiled the next time it is executed.' - is printed on the console.

As I understand the DBI API there's no concept of the database
operations having a STDOUT or a STDERR, the only things that database
operations can return are a single rowset or an exception (error
string).

However there are tricks you can use in Perl to capture STDERR and/or
STDOUT from subprocesses and black-box Perl subroutines. Exactly which
would work here would depend on the implementation of DBD::Sybase.

I don't use DBD::Sybase but I'm going to guess that the string you are
seeing is being output to the current filedescriptor 2 directly by the
sybase client library.

If this is the case you can capture in using something like

#!perl
use strict;
use warnings;
use AtExit;
use IO::Handle;
open my $log, '>', 'log.log' or die $!;

{
    open my $save_STDERR, '>&', *STDERR;
    my $restore_STDERR = AtExit->new( sub {
        open STDERR, '>&', $save_STDERR;
    });
    $log->flush; # Subprocess unbuffered so avoid dissordered o/p
    open STDERR, '>&', $log;
    system 'xxx'; # Subprocess that will error
    # $restore_STDERR goes out-of-scope and puts back the original
STDERR
}

__END__

Of course it could be that DBD::Sybase is writing the output in some
other way in which case this won't help. For example if it forked-off a
helper process as soon as you open the filehandle and then wrote to the
fd 2 of that process you've have a somewhat harder time getting hold of
the outout corresponding to a given DBI transaction.



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

Date: 14 Oct 2006 00:41:06 -0700
From: "Bart Van der Donck" <bart@nijlen.com>
Subject: Re: replace variable with same variable
Message-Id: <1160811666.562256.56120@b28g2000cwb.googlegroups.com>

Michele Dondi wrote:

> On 11 Oct 2006 12:07:24 -0700, "Bart Van der Donck" <bart@nijlen.com>
> wrote:
>
> >My tests seem to indicate the opposite:
> > [...]
> Your test is flawed. For one thing it is generally not reliable to use
> T::H to time stuff like that.
> [...]

Why do you think the results of Time::HiRes are not reliable in my code
? There are of course some OS/CPU/Perl/load issues to be aware of, but
in general I'ld say that the tendencies of my test can be trusted to
prove that $& is 'an sich' faster than $1 (at least as benchmarked on
FreeBSD and WinXP here). I'm not sure why; it's probably to do with
lower mechanisms at C++/compile level, which I'm not very confident
with.

I think the whole point is what happens next with $&. One gets a
totally different picture then indeed.

-- 
 Bart



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

Date: 14 Oct 2006 11:11:46 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: replace variable with same variable
Message-Id: <j8a1j25heuqbpnn04ffp7cvrnmg2d4th66@4ax.com>

On 14 Oct 2006 00:41:06 -0700, "Bart Van der Donck" <bart@nijlen.com>
wrote:

>Why do you think the results of Time::HiRes are not reliable in my code
>? There are of course some OS/CPU/Perl/load issues to be aware of, but

Exactly because of these. Benchmark.pm goes some way into trying to
overcome them, however it has been shown not to be bulletproof either.

>in general I'ld say that the tendencies of my test can be trusted to
>prove that $& is 'an sich' faster than $1 (at least as benchmarked on
>FreeBSD and WinXP here). I'm not sure why; it's probably to do with
>lower mechanisms at C++/compile level, which I'm not very confident
>with.

I haven't the slightest idea myself.

>I think the whole point is what happens next with $&. One gets a
>totally different picture then indeed.

That's it!


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Sat, 14 Oct 2006 09:57:30 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Sorting and moving files to dir for DVD burn
Message-Id: <slrnej163a.m0t.hjp-usenet2@yoyo.hjp.at>

On 2006-10-13 15:45, Michele Dondi <bik.mido@tiscalinet.it> wrote:
>                                    But so called 4.7 Gb DVDs do not
> actually have a size of 4.7 * 2**30 bytes, but 4.7 * 10**3, which
                                                       ^^^^^
						       10**9
> amounts to about 4.37 Gb.

	hp

-- 
   _  | Peter J. Holzer    | > Wieso sollte man etwas erfinden was nicht
|_|_) | Sysadmin WSR       | > ist?
| |   | hjp@hjp.at         | Was sonst wäre der Sinn des Erfindens?
__/   | http://www.hjp.at/ |	-- P. Einstein u. V. Gringmuth in desd


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

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 9847
***************************************


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