[25602] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7846 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 2 11:06:59 2005

Date: Wed, 2 Mar 2005 08:05:27 -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           Wed, 2 Mar 2005     Volume: 10 Number: 7846

Today's topics:
        Accessing SMB share on Mac OSX for file copy <spamme@allday.com>
        Class::Date <alexj@floor.ch>
    Re: Class::Date <jamiethacker@gmail.com>
    Re: Class::Date <jamiethacker@gmail.com>
    Re: Class::Date <jamiethacker@gmail.com>
    Re: Class::Date <alexj@floor.ch>
        Drag and drop <chamynpj@___brightonline.com.au>
    Re: Importing records with both space and quoted text q <tadmc@augustmail.com>
    Re: IO::Scalar insanity <socyl@987jk.com.invalid>
        Net::Telnet, Terminal Programs, Prompts <jmw_misc@hotmail.com>
    Re: odd socket behavior with ZoneAlarm <clarke@n_o_s_p_a_m_hyperformix.com>
    Re: odd socket behavior with ZoneAlarm <phaylon@dunkelheit.at>
    Re: odd socket behavior with ZoneAlarm (replace z with h, spam protection)
    Re: odd socket behavior with ZoneAlarm <phaylon@dunkelheit.at>
    Re: Pure Perl OpenSSL Library <vek@station02.ohout.pharmapartners.nl>
    Re: Questions about Perl for Windows <matternc@comcast.net>
    Re: Questions about Perl for Windows <matternc@comcast.net>
    Re: Questions about Perl for Windows <postmaster@castleamber.com>
        Replacement problem (prasanna bhat mavinkuli)
    Re: Replacement problem <noreply@gunnar.cc>
    Re: where is my magic (XS related) <joe+usenet@sunstarsys.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 02 Mar 2005 15:08:25 GMT
From: John <spamme@allday.com>
Subject: Accessing SMB share on Mac OSX for file copy
Message-Id: <Xns960D672065124spammealldaycom@68.1.17.6>

Greetings.  I am attempting copy a file from a Mac OSX (10.3.6) to a share 
on a Windows 2000 server using Perl.  To trouble shoot my problem I wrote a 
simple script to verify the existance of a file on the share which is 
failing.  I don't belive this is a rights issue since I can 
add/delete/modify files using the OSX Finder.  So that leaves me with how I 
am refering to the share which is using UNC (\\server name\share name
\folder name\).  Is this the correct way to access the share?  I have tried  
several different ways to access the share and they all fail.  Do I need to 
include a way to connect to the server in the code (to connect to the share 
and pass a username/password)?  Currently I am connecting to the share 
through finder.


my $File = "//FS1/Data/FileTransfer/test.txt";
#my $File = "\\\FS1\\Data\\FileTransfer\\test.txt";
#my $File = "smb:\\FS1\\Data\\FileTransfer\\test.txt";

unless (-f $File) { print "\nFile DOES NOT Exist!" }


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

Date: Wed, 02 Mar 2005 14:16:48 +0100
From: Alexandre Jaquet <alexj@floor.ch>
Subject: Class::Date
Message-Id: <d04ebp$i2a$1@news.hispeed.ch>

Anyone know how I can get millisecond I can't find in documentation.

I've try

#!/usr/bin/perl -w
use strict;
use Class::Date qw(:errors date localdate gmdate now);

my $date_start = getTime ();

sub getTime {

	my $date = new Class::Date (now);
	$Class::Date::DATE_FORMAT="%H%M%S";
	warn "date hour test -->".$date;
	return $date;
}


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

Date: 2 Mar 2005 05:59:07 -0800
From: "jamie@nospam.com" <jamiethacker@gmail.com>
Subject: Re: Class::Date
Message-Id: <1109771947.837794.283410@g14g2000cwa.googlegroups.com>

You might try http://datetime.perl.org/ .  I have found it very helpful
in the past.



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

Date: 2 Mar 2005 06:07:11 -0800
From: "jamie@nospam.com" <jamiethacker@gmail.com>
Subject: Re: Class::Date
Message-Id: <1109772431.477331.160420@o13g2000cwo.googlegroups.com>

>Anyone know how I can get millisecond I can't find in documentation.
>
>I've try
>
>#!/usr/bin/perl -w
>use strict;
>use Class::Date qw(:errors date localdate gmdate now);
>
>my $date_start = getTime ();
>
>sub getTime {
>
 >      my $date = new Class::Date (now);
>        $Class::Date::DATE_FORMAT="%H%M%S";
  >      warn "date hour test -->".$date;
    >    return $date;

Sorry for not quoting the OP...It's my first time using a computer...
:-D

More precisely http://datetime.perl.org/faq.html



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

Date: 2 Mar 2005 06:20:44 -0800
From: "jamie@nospam.com" <jamiethacker@gmail.com>
Subject: Re: Class::Date
Message-Id: <1109773244.115840.232710@o13g2000cwo.googlegroups.com>

>Anyone know how I can get millisecond I can't find in documentation.

>I've try

>#!/usr/bin/perl -w
>use strict;
>use Class::Date qw(:errors date localdate gmdate now);

>my $date_start = getTime ();

>sub getTime {

 >      my $date = new Class::Date (now);
>        $Class::Date::DATE_FORMAT="%H%M%S";
  >      warn "date hour test -->".$date;
    >    return $date

;

>Sorry for not quoting the OP...It's my first time using a computer...
>:-D
>
>More precisely http://datetime.perl.org/faq.html

You will find this also helpful....
http://search.cpan.org/dist/Time-HiRes/HiRes.pm

Jamie



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

Date: Wed, 02 Mar 2005 16:02:26 +0100
From: Alexandre Jaquet <alexj@floor.ch>
Subject: Re: Class::Date
Message-Id: <d04khs$tq6$1@news.hispeed.ch>

jamie@nospam.com a écrit :
>>Anyone know how I can get millisecond I can't find in documentation.
> 
> 
>>I've try
> 
> 
>>#!/usr/bin/perl -w
>>use strict;
>>use Class::Date qw(:errors date localdate gmdate now);
> 
> 
>>my $date_start = getTime ();
> 
> 
>>sub getTime {
> 
> 
>  >      my $date = new Class::Date (now);
> 
>>       $Class::Date::DATE_FORMAT="%H%M%S";
> 
>   >      warn "date hour test -->".$date;
>     >    return $date
> 
> ;
> 
> 
>>Sorry for not quoting the OP...It's my first time using a computer...
>>:-D
>>
>>More precisely http://datetime.perl.org/faq.html
> 
> 
> You will find this also helpful....
> http://search.cpan.org/dist/Time-HiRes/HiRes.pm
> 
> Jamie
> 

i didn't find something usefull with HiRes :(


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

Date: Wed, 2 Mar 2005 23:12:32 +0800
From: "Tino" <chamynpj@___brightonline.com.au>
Subject: Drag and drop
Message-Id: <d04l4u$6p5$1@news-02.connect.com.au>

I would like to be able to drag and drop files onto a .pl file  in the same 
way I can drop files onto a .bat file. I made a .bat which can do this but 
if I try to do the same thing with a .pl file I find the .pl file isn't able 
to accept files for drag and drop operations, the cursor changes to the "not 
allowed operation" symbol when the file being dropped is over the .pl file. 
What do I have to do to the .pl file to make it work like the .bat file?

Example of .bat file onto which a file can be dropped:

@echo off
:plot_loop
   print.pl p=1 %1
   shift
   if not "%1"=="" goto plot_loop


Example of .pl file that I would like to do the same as the .bat file:

use strict;
use warnings;

foreach (@ARGV) {
  system("print.pl p=1 $_");
}


regards

Peter 




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

Date: Wed, 2 Mar 2005 07:43:41 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Importing records with both space and quoted text qualifiers...
Message-Id: <slrnd2bgod.8g0.tadmc@magna.augustmail.com>

Tad McClellan <tadmc@augustmail.com> wrote:
> L. D. James <ljames@apollo3.com> wrote:
>> "Tad McClellan" <tadmc@augustmail.com> wrote in message 
>> news:slrnd2a1g0.28j.tadmc@magna.augustmail.com...
>>> L. D. James <ljames@apollo3.com> wrote:
>>>
>>> [snip]
> 
>>> Thanks for fixing the top-posting.
> 
>>      I'm insulted with the continued reference to top posting.  
> 
> I was *thanking* you for stopping, where is the insult in that?
> 
> I don't get it...


After a good night's sleep I now *do* get it, and it appears that
I knee-jerked somewhat last night. For that I apologize.


>> I don't mind a reference to 
>> something you might see as a problem.
> 
> 
> Your .sig does not have a correct sig-dash, and it is more than 4 lines.


I first composed a follow up about that...


>> But you don't have to keep harping on 
>> something that you saw once,


 ... and then I checked to see what other followups I had made to
the same poster, as I often do. I saw there that I had asked him
to not top-post and noted that he was now no longer top-posting.

I took that as an encouraging sign that the OP wants to post
properly and I concluded that he'd want a proper sig-dash too.

So, from the OP's point of view, I was commenting on "old news" 
rather than something in the current thread. (where "old" = 10 days)

From my point of view, I was thanking him for complying with
my earlier direct request.


>> Looking at the posts can go 
>> more than one way.
> 
> I won't be looking at any more of your posts I don't think.
> 
> Good luck!


So I am going to un-luck the OP's score.

Sorry for the confusion.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Wed, 2 Mar 2005 15:30:50 +0000 (UTC)
From: kj <socyl@987jk.com.invalid>
Subject: Re: IO::Scalar insanity
Message-Id: <d04m7a$8d2$1@reader2.panix.com>

In <Pine.LNX.4.61.0503020108390.16993@ppepc56.ph.gla.ac.uk> "Alan J. Flavell" <flavell@ph.gla.ac.uk> writes:

>On Tue, 1 Mar 2005, kj wrote:

>> In <Xns960C9E508FAA6asu1cornelledu@127.0.0.1> "A. Sinan Unur" <1usa@llenroc.ude.invalid> writes:
>> 
>> >http://search.cpan.org/~lds/CGI.pm-
>> >3.05/CGI.pm#CREATING_A_NEW_QUERY_OBJECT_FROM_AN_INPUT_FILE
>> 
>> >I am curious why that is not a satisfactory method.
>> 
>> For starters, it assumes that the CGI script is implemented through
>> CGI.pm, which may not be the case. 

>Anyone who's expert enough to produce a safe and reliable 
>implementation that doesn't use CGI.pm will have no difficulty in 
>solving that problem without any help from us.

The OP didn't specify whether he was debugging his own code, or
that what he was debugging was a "safe and reliable" anything.

kj

-- 
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.


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

Date: 2 Mar 2005 06:50:06 -0800
From: "Mike" <jmw_misc@hotmail.com>
Subject: Net::Telnet, Terminal Programs, Prompts
Message-Id: <1109775006.174376.242280@l41g2000cwc.googlegroups.com>

Hi, I have been trying to create a Tk::Text that reads and writes to a
Net::Telnet object. It works fairly well, but doesnt handle terminal
types of programs like vi.

Just looking for any ideas from the experts. I dont know to much about
termianl emulations, etc.

Also, i get two prompts. Anyone know why i might be getting that from
Net::Telnet; I have prompt set to anything and timeout at 0, so i dont
match on prompt or block. I just poll every 1/4 sec. But what i read
with get, comes with two prompts. Any ideas on a better method let me
know. I was trying to keep from using prompt, allowing it to work no
matter what you logged into.

This script is an example of its use followed by the module itself
Note the ip is hardcoded so change to fit your system.

Thanks
Mike

############################################################

use strict;
use Tk;
use lib 'lib';
use Tk::ECC::Telnet;

my $mw = new MainWindow();
my $tn = $mw->Telnet->pack(-side => 'top', -expand => '1', -fill =>
'both');
my $bt = $mw->Button(-text => 'Connect', -command => [\&connect,
$tn])->pack(-expand => '1', -fill => 'x');
MainLoop;

sub connect {
  my $tn = shift;
  print "Connecting to $tn\n";
  $tn->conn('10.1.24.226');
  }

##############################################################

Here is the Module Tk::ECC::Telnet

# -------------------------------------------------------------------
# Tk Widget based on Standard Tk::Text and Net::Telnet
# -------------------------------------------------------------------

package Tk::ECC::Telnet;

use Net::Telnet;
use base qw(Tk::Derived Tk::Text);
Construct Tk::Widget 'Telnet';

sub ClassInit {
  my ($class, $mw) = @_;
  $class->SUPER::ClassInit($mw);
  $mw->bind($class,'<Return>', \&Return)
  #$mw->bind($class, '<KeyPress>', \&keypress);
}

sub Populate {
  my ($self, $args) = @_;
  my $ip = '192.168.2.10';
  $self->SUPER::Populate($args);
  $self->{END} = 0.0;
  $self->{KEY} = 0;
  $self->{TELNET} = new Net::Telnet( Timeout => 0, Prompt => '//',);
  $self->{TELNET}->errmode("return");
}

sub conn {
  my ($self, $ip) = @_;
  $self->{TELNET}->open($ip);
  $self->repeat('250', [\&read_telnet, $self])
}

sub disconn {
  print "Disccc\n";
  my ($self,) = shift;
  $self->{TELNET}->print("exit");
  #$self->cancel('250', [\&read_telnet, $self])
}

sub insert {
  #print "insert [@_]\n";
  my ($self) = shift;
  $self->SUPER::insert(@_);
  return if ($self->{KEY});
  print "Setting End\n";
  $self->{END} = $self->index('insert');
}

sub Return {
  #print "Return [@_]\n";
  my $self = shift;
  return unless ($self->compare($self->index('insert'), '>=',
$self->{END}));
  my $cmd = $self->get($self->{END}, 'end');
  $self->SUPER::Insert("\n");
  $self->{TELNET}->print($cmd);
  $self->{TELNET}->timeout(1);
  $self->{TELNET}->getline();
  $self->{TELNET}->getline();
  $self->{TELNET}->timeout(0);
}

sub Backspace {
  #print "BackSpace [@_]\n";
  my $self = shift;
  print $self->index('insert') . ">" . $self->{END} . "\n";
  return unless ($self->compare($self->index('insert'), '>',
$self->{END}));
  $self->SUPER::Backspace;
}

sub InsertKeypress {
  #print "InsertKeypress [@_]\n";
  my ($self, $key) = @_;
  return unless ($self->compare($self->index('insert'), '>=',
$self->{END}));
  $self->{KEY} = 1;
  $self->SUPER::InsertKeypress($key);
  $self->{KEY} = 0;
  #print "END is currently " . $self->{END} . "\n";
}

sub read_telnet {
  my ($self) = shift;
  while (my $data = $self->{TELNET}->get()) {
    print "Data [$data]\n";
    $self->insert('end', $data);
    $self->see('end');
    $self->markSet('insert', 'end');
    }
  }

1;



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

Date: Wed, 2 Mar 2005 07:50:26 -0600
From: "AC" <clarke@n_o_s_p_a_m_hyperformix.com>
Subject: Re: odd socket behavior with ZoneAlarm
Message-Id: <4225c44e$0$38737$39cecf19@news.twtelecom.net>


"YYUsenet" <yyusenet@yahoo.com> wrote in message 
news:d02pfb$3k9$1@news.xmission.com...
> AC wrote:
>> This is very strange and I'm posting it here in case someone else runs 
>> into this problem. ZA (ZoneAlarm) messes up Perl applications that read 
>> from sockets using the syntax
>>
>> my $line = <SOCK>;
>>
>> causing them to hang indefinately, even if the server closes the socket. 
>> You can get past this by using the following code snippet instead:
>>
>> my $line = "";
>> if (defined (recv(SOCK, $line, 1024, 0))) {
>>    print $line;
>> }
>>
>> Does anyone know what ZoneAlarm might be doing? Is it messing with the 
>> line terminator that the server uses? The internal XP firewall does not 
>> interfere with Perl programs this way.
>>
>> Many Thanks,
>>
>> Allan
>
> This is OT here, but I think that Zone Alarm is just trying to block any 
> unauthorized program from receiving data through sockets.
>
> -- 
> k g a b e r t (at) x m i s s i o n (dot) c o m
>
> *Use Mozzila/Firefox*!
> http://www.spreadfirefox.com/?q=user/register&r=71209

Actually I disagree about the offtopic issue. This is a problem with running 
Perl in conjunction with third party products. This problem does not occur 
with any other non-Perl executables that I have. If this isn't the right 
forum, what is? (Please don't suggest the ZA forums. They don't even know 
what Perl is.)

On the other comment, firewalls do indeed block traffic. The question I had 
was why does the usual line reading fail but using the recv() function 
succeed? What is the implementation of "$line = <SOCKET>"?

Inquiring minds want to know.

AC 




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

Date: Wed, 02 Mar 2005 15:10:50 +0100
From: phaylon <phaylon@dunkelheit.at>
Subject: Re: odd socket behavior with ZoneAlarm
Message-Id: <pan.2005.03.02.14.10.50.437967@dunkelheit.at>

AC wrote:

> Actually I disagree about the offtopic issue. This is a problem with
> running Perl in conjunction with third party products.

Yes, but I would think the problem lies at the third party product in
first way in this case, so it is offtopic. If Linux' iptables made
problems, it would be also off-topic.

-- 
http://www.dunkelheit.at/

The eternal mistake of mankind is to set up an attainable ideal.
                              -- Aleister Crowley



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

Date: Wed, 2 Mar 2005 15:33:50 +0100
From: "D. Marxsen" <detlef.marxsen@tdds-gmbz.de (replace z with h, spam protection)>
Subject: Re: odd socket behavior with ZoneAlarm
Message-Id: <d04isi$6i7$1@domitilla.aioe.org>

"phaylon" <phaylon@dunkelheit.at> schrieb im Newsbeitrag
news:pan.2005.03.02.14.10.50.437967@dunkelheit.at...
> AC wrote:
>
> > Actually I disagree about the offtopic issue. This is a problem with
> > running Perl in conjunction with third party products.
>
> Yes, but I would think the problem lies at the third party product in
> first way in this case, so it is offtopic. If Linux' iptables made
> problems, it would be also off-topic.

Sorry, but I agree with AC.
There is a problem in the interaction of Perl with a firewall and Perl does
behave differently when trying different approaches.
So it would be very helpful if someone could shed some light on the
difference of both attempts. I would like to know it!

We have to be careful not to behave like two companies, pushing
responsibility to and fro (we all hate that, don't we?). This is frustrating
and helps no-one.

Just my two cents.

Detlef


PS: Sorry that I couldn't help.

--
D. Marxsen, TD&DS GmbH
detlef.marxsen@tdds-gmbz.de (replace z with h, spam protection)





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

Date: Wed, 02 Mar 2005 15:59:28 +0100
From: phaylon <phaylon@dunkelheit.at>
Subject: Re: odd socket behavior with ZoneAlarm
Message-Id: <pan.2005.03.02.14.59.28.191943@dunkelheit.at>

D. Marxsen wrote:

> There is a problem in the interaction of Perl with a firewall and Perl
> does behave differently when trying different approaches.

Sure, if you code different things, perl often feels free to act
different.

> So it would be very helpful if someone could shed some light on the
> difference of both attempts. I would like to know it!

What's the problem with looking at perldoc -f recv?

> We have to be careful not to behave like two companies, pushing
> responsibility to and fro (we all hate that, don't we?). This is
> frustrating and helps no-one.

Yeah, but it will get kinda unperlish if there would be more perl+Apache,
perl+Redhat, perl+SuSE, perl... You know what I mean?

Don't understand me wrong, you can write about whatever you want, but I
just don't think the problem that one firewall (I think there are other's
where it worked) has so much to do with Perl. I mean, we don't know what
this firewall actually does, how it relies to the system it is running on,
how it's configured, how it _can_ be configured. Sure, there are some
people in here, who know ZA. But there are much more at the ZA forums.
Where is the problem in writing a little script (which already exists) and
ask the ZA guys why it works without ZA, but not with an activated (and
configured, or has anyone "forgotten" to read the docs?) one.

just my 2c.

-- 
http://www.dunkelheit.at/
codito, ergo sum.



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

Date: 02 Mar 2005 12:36:06 GMT
From: Villy Kruse <vek@station02.ohout.pharmapartners.nl>
Subject: Re: Pure Perl OpenSSL Library
Message-Id: <slrnd2bcpm.409.vek@station02.ohout.pharmapartners.nl>

On Wed, 2 Mar 2005 08:45:40 +0000 (UTC),
    Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:


> [A complimentary Cc of this posting was sent to
> Marc
><dkm@kataplop.net>], who wrote in article <42256ce6@epflnews.epfl.ch>:
>> I can't avoid the maths behind the crypto, but I can avoid fork when
>> they are not needed.
>
> AFAIK, openssl executable is just a tiny wrapper about openSSL
> libraries.  Are these libraries dynamically linked on your target
> platforms?  If yes, why not call these entry points from Perl?
>

The openssl program is a bit more than a tiny wrapper.  If you need to
call and openssl library functions you use a normal .xs wrapper like
the one that comes with Crypt::SSLeay or Net::SSLeay.  To create X.509
certificates I beleive it is far easier to call the openssl program using
the system() funtion.  See the CA.pl program that comes with openssl.

Villy


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

Date: Wed, 02 Mar 2005 07:33:12 -0500
From: Chris Mattern <matternc@comcast.net>
Subject: Re: Questions about Perl for Windows
Message-Id: <a5OdnWAMZuQVL7jfRVn-pA@comcast.com>

Jim Keenan wrote:

> al2048@aol.com wrote:
> 
>> 
>> I need a version of Perl that can use modules. Can both IndigoPerl and
>> ActivePerl do that?
> 
> All versions of Perl can use modules.

Well, all versions of Perl 5 can use modules.


-- 
             Christopher Mattern

"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"


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

Date: Wed, 02 Mar 2005 08:59:44 -0500
From: Chris Mattern <matternc@comcast.net>
Subject: Re: Questions about Perl for Windows
Message-Id: <88GdnfL6vrVNW7jfRVn-2Q@comcast.com>

Chris Mattern wrote:

> Jim Keenan wrote:
> 
>> al2048@aol.com wrote:
>> 
>>> 
>>> I need a version of Perl that can use modules. Can both IndigoPerl and
>>> ActivePerl do that?
>> 
>> All versions of Perl can use modules.
> 
> Well, all versions of Perl 5 can use modules.
> 
> 
And as an additional caveat, all versions of Perl 5 can use pure Perl
modules.  No Windows Perl is likely to do too well with a module that
has C code, or other such code designed to be compiled into a UNIX
binary.

-- 
             Christopher Mattern

"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"


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

Date: 2 Mar 2005 16:04:14 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Questions about Perl for Windows
Message-Id: <Xns960D66713EEC9castleamber@130.133.1.4>

GreenLeaf wrote:

> John Bokma wrote:

 ...

>> What I mean is that TextPad creates a top level entry (besides the Open
>> With). So I still can easily start them with double click.
> 
> I _did_ mean top-level entries directly on context menu, not 'open-with' 
> entries. They can be manually created from within Explorer, but 

How? Moreover, how can I remove them from within Explorer?

> obviously only one association can have double-click :o).

RISC OS has a nice thing: if you shift + double click a file opens in the 
editor. Isn't there a similar thing for Windows?

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


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

Date: 2 Mar 2005 07:02:57 -0800
From: boss_bhat@yahoo.co.in (prasanna bhat mavinkuli)
Subject: Replacement problem
Message-Id: <cbf66284.0503020702.83db3d5@posting.google.com>

Hi all,

 Iam wet behind the ears as for as Perl is concerned. I have got
a problem, well its a real puzzle for a fresher like me.
In my code i just want to create a source directory structure in
a target directory. I am finding all the subdirectories in the
source directory and creating it in the target directory during run 
time. And i am failing to do so because directory name
contains(+,- etc). So its a metacharacter problem. Also I want to 
retain the directory names as it is. So here is the  piece of
code,  but i have initialized values for the arrays to illustrate,

@stor_array=("/dir+a/dir2","/dir+a/dir2/lost+found/","/dir+a/dir2/kallu+mat","/dir+a/dir2/kallu+mat","/dir+a/dir2/kallu+ma-jon");

$dir="dir+a";
$temp="target";
foreach (@stor_array){
        s/$dir/$temp\/Files\//;
        print $_ ,"\n";
        }
Please somebody help me to achieve the replacement.

thanks in advance
Prasanna Bhat Mavinkuli


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

Date: Wed, 02 Mar 2005 16:11:12 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Replacement problem
Message-Id: <38m3bpF5jm1hpU1@individual.net>

prasanna bhat mavinkuli wrote:
> In my code i just want to create a source directory structure in
> a target directory. I am finding all the subdirectories in the
> source directory and creating it in the target directory during run 
> time. And i am failing to do so because directory name
> contains(+,- etc). So its a metacharacter problem.

You probably want \Q. See "perldoc perlre".

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Wed, 02 Mar 2005 08:39:36 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: where is my magic (XS related)
Message-Id: <87r7iy88vb.fsf@gemini.sunstarsys.com>

Pavel Hlavnicka <pavel@gingerall.cz> writes:

> What's strange (but understandable) is that my RETVAL with magic is
> copied with its type (SvMAGIC returns true) but no magic is retained.
                        ^^^^^^^

Do you mean SvMAGICAL(sv), or are you referring to SvTYPE(sv, SVt_PVMG)?
SvMAGICAL probably shouldn't be true, but SvTYPE certainly should be.

> Keeping SV upgraded to PLMG seems to be obsolete.

Some internal magics are preserved (taint, v-string), but that's not
really the point.  SvTYPE just tells how much room is available in 
the sv_any slot (which is tiered via SvUPGRADE).  It doesn't say 
anything about the sv's actual semantics.

-- 
Joe Schaefer


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

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


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