[25700] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7941 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 4 14:06:27 2005

Date: Mon, 4 Apr 2005 11:05:11 -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           Mon, 4 Apr 2005     Volume: 10 Number: 7941

Today's topics:
        [BEGINNER} Question soup_or_power@yahoo.com
    Re: [BEGINNER} Question <mark.clements@kcl.ac.uk>
    Re: [BEGINNER} Question <tadmc@augustmail.com>
    Re: Accessing Single Parameters in Perl Script <francisbrightman@rwfts.com>
        console colors and line input ... <tonino.greco@gmail.com>
    Re: console colors and line input ... <1usa@llenroc.ude.invalid>
    Re: console colors and line input ... <tonino.greco@gmail.com>
    Re: console colors and line input ... <1usa@llenroc.ude.invalid>
    Re: console colors and line input ... <tadmc@augustmail.com>
    Re: console colors and line input ... <tonino.greco@gmail.com>
    Re: console colors and line input ... <1usa@llenroc.ude.invalid>
    Re: console colors and line input ... <tonino.greco@gmail.com>
    Re: console colors and line input ... <tassilo.von.parseval@rwth-aachen.de>
    Re: Golf Q: \$h{X} ? <do-not-use@invalid.net>
    Re: Golf Q: \$h{X} ? <jkrugman345@yahbitoo.com>
    Re: Help with a script.. <1usa@llenroc.ude.invalid>
    Re: Help with a script.. <noreply@gunnar.cc>
    Re: Help with a script.. <1usa@llenroc.ude.invalid>
    Re: Help with a script.. <go@away.spam.invalid>
    Re: Illegal Seek - Any Hints <tadmc@augustmail.com>
    Re: Illegal Seek - Any Hints xhoster@gmail.com
        Is "require '/foo/bar/baz.pm'" portable? <jkrugman345@yahbitoo.com>
    Re: Is "require '/foo/bar/baz.pm'" portable? <nobull@mail.com>
        speed issues with pattern matching and substitution (Arturi)
    Re: speed issues with pattern matching and substitution <1usa@llenroc.ude.invalid>
    Re: speed issues with pattern matching and substitution xhoster@gmail.com
        time zone offset calc with localtime and gmtime <leendert@wouter.unitedknowledge.net>
    Re: time zone offset calc with localtime and gmtime <noreply@gunnar.cc>
    Re: time zone offset calc with localtime and gmtime <leendert@wouter.unitedknowledge.net>
    Re: time zone offset calc with localtime and gmtime <geoff@invalid.invalid>
    Re: time zone offset calc with localtime and gmtime <mothra@nowhereatall.com>
    Re: Using HTTPS with LWP::UserAgent = Bad Service <richard.lawrence@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 4 Apr 2005 07:01:18 -0700
From: soup_or_power@yahoo.com
Subject: [BEGINNER} Question
Message-Id: <1112623278.495920.288110@l41g2000cwc.googlegroups.com>

Can someone explain what's this code doing at a meta level? Thanks

sub new {
  my ($self, $hash) = @_;

  # ------------------------------------------------------
  #    Create new hash ref/obj ref (Copy Constructor)
  # ------------------------------------------------------

  my $type = ref($self) || $self;
  my $obj = ( ref $self ) ? &Storable::dclone( $self ) : { };
  my $new = bless $obj, $type;

  # ------------------------------------------------------
  #    Initialize properties (copy $hash into $new)
  # ------------------------------------------------------

  if ($hash && ref $hash) {
    while ( my ($key, $value) = each %$hash ) {
      $new->{$key} = $value if ! ref $value;
    }
  }

  return $new;
}



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

Date: Mon, 04 Apr 2005 16:23:33 +0200
From: Mark Clements <mark.clements@kcl.ac.uk>
Subject: Re: [BEGINNER} Question
Message-Id: <42514de7$1@news.kcl.ac.uk>

soup_or_power@yahoo.com wrote:
> Can someone explain what's this code doing at a meta level? Thanks
It helps if you choose a more descriptive subject line.

> sub new {
>   my ($self, $hash) = @_;
> 
>   # ------------------------------------------------------
>   #    Create new hash ref/obj ref (Copy Constructor)
>   # ------------------------------------------------------
> 
>   my $type = ref($self) || $self;
>   my $obj = ( ref $self ) ? &Storable::dclone( $self ) : { };
>   my $new = bless $obj, $type;
> 
>   # ------------------------------------------------------
>   #    Initialize properties (copy $hash into $new)
>   # ------------------------------------------------------
> 
>   if ($hash && ref $hash) {
>     while ( my ($key, $value) = each %$hash ) {
>       $new->{$key} = $value if ! ref $value;
>     }
>   }
> 
>   return $new;
> }
> 
If by "meta level" you mean "what is the subroutine actually supposed to 
do", it is defining a constructor method (though I have issues with the 
way it is done). Check out

man perltoot
man perlobj

It then populates the attributes of the newly created object with 
attribute names and values passed in in $hash, though it doesn't do this 
for some reason (Perl itself doesn't care) if the value itself is a 
reference.

Is this homework?

Mark


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

Date: Mon, 4 Apr 2005 10:37:38 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: [BEGINNER} Question
Message-Id: <slrnd52nq2.1ff.tadmc@magna.augustmail.com>

soup_or_power@yahoo.com <soup_or_power@yahoo.com> wrote:

> Subject: [BEGINNER} Question


Please put the subject of your article in the Subject of your article.

Your post is not about beginner questions.


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


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

Date: 4 Apr 2005 09:57:07 -0700
From: "Francis" <francisbrightman@rwfts.com>
Subject: Re: Accessing Single Parameters in Perl Script
Message-Id: <1112633827.002266.198370@f14g2000cwb.googlegroups.com>

Thanks Joe. I think I got there in the end.

F.
Joe Smith wrote:
> Francis wrote:
> > I am told (by my ecommerce people) that it the parameter is
> > included in the HTTP POST. I gather that this can be accessed in
the
> > perl script and the parameter(s) extracted.
>
> Baby steps.
>
> First, learn how to create a simple CGI that processes a simple POST.
> You need to get experience with simple CGI-in-Perl tutorials before
> tackling the ecommerce problem.
> 	-Joe



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

Date: 4 Apr 2005 05:12:28 -0700
From: "Tonino  Greco" <tonino.greco@gmail.com>
Subject: console colors and line input ...
Message-Id: <1112616748.173034.237070@o13g2000cwo.googlegroups.com>

Hi,

I am needing todo a screen in unix console that looks something like :

#!/usr/bin/perl

use Term::ANSIColor;
use POSIX qw(strftime);
sub now { strftime "%Y/%m/%d %T ", localtime; }


print color("clear");
print color("white on_black"), "                          ";
print color("white on_blue"), "         Menu";
print color("white on_black"), "        ";
print color("white on_blue"), &now , "\n", color("reset");

print color("white on_blue"), "                         ", "Menu
Selection","                          \n", color("reset");

print color("white on_white"), "
                         \n", color("reset");
print color("white on_white"), "
                         \n", color("reset");
print color("white on_white"), "
                         \n", color("reset");
print color("white on_white"), "
                         \n", color("reset");
print color("white on_white"), "
                         \n", color("reset");
print color("white on_white"), "
                         \n", color("reset");
print color("white on_white"), "
                         \n", color("reset");
print color("white on_white"), "
                         \n", color("reset");
print color("white on_white"), "          ", color("blue on_white"),
"Username: ", color("white on_black"), "        ", color("white on_whit
e"), "                                     \n", color("reset");

print color("white on_white"), "
                         \n", color("reset");
print color("white on_white"), "
                         \n", color("reset");
print color("white on_white"), "
                         \n", color("reset");
print color("white on_white"), "
                         \n", color("reset");
print color("white on_white"), "
                         \n", color("reset");
print color("white on_white"), "
                         \n", color("reset");
print color("white on_white"), "
                         \n", color("reset");
print color("white on_white"), "
                         \n", color("reset");
print color("white on_white"), "
                         \n", color("reset");
print color("yellow on_blue"), "Please enter your Password ...
                         \n", color("reset");
print color("yellow on_blue"), "Data directory is :
                         \n", color("reset");



and I want to be able to keep the cursor at the Username section
forinput from the user ... but still draw the complete page.

Can anyone shed a light on how I can do this ...


IN essence I want to be able to (in a unix console) present a colored
login screen then accept the username - present a password screen - the
same as the username one - and then do some validation and present a
menu to the user ...

Thanks
Tonino



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

Date: Mon, 04 Apr 2005 12:37:08 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: console colors and line input ...
Message-Id: <Xns962E57AE9A049asu1cornelledu@127.0.0.1>

"Tonino  Greco" <tonino.greco@gmail.com> wrote in 
news:1112616748.173034.237070@o13g2000cwo.googlegroups.com:

> IN essence I want to be able to (in a unix console) present a colored
> login screen then accept the username - present a password screen - the
> same as the username one - and then do some validation and present a
> menu to the user ...

I don't know much about this but you might want to look into Curses.

http://search.cpan.org/~marcus/Curses-UI-0.95/

http://search.cpan.org/~giraffed/Curses-1.12/

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: 4 Apr 2005 06:03:37 -0700
From: "Tonino" <tonino.greco@gmail.com>
Subject: Re: console colors and line input ...
Message-Id: <1112619817.839283.221350@l41g2000cwc.googlegroups.com>

thanks for this - is there a tutorial you know of I can look at ?

Tonino



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

Date: Mon, 04 Apr 2005 13:13:07 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: console colors and line input ...
Message-Id: <Xns962E5DC7FFF7Easu1cornelledu@127.0.0.1>

"Tonino" <tonino.greco@gmail.com> wrote in news:1112619817.839283.221350
@l41g2000cwc.googlegroups.com:

> thanks for this - is there a tutorial you know of I can look at ?

Please quote an appropriate amount of context. 

"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in 
news:Xns962E57AE9A049asu1cornelledu@127.0.0.1:

> I don't know much about this but you might want to look into Curses.
> 
> http://search.cpan.org/~marcus/Curses-UI-0.95/
> 
> http://search.cpan.org/~giraffed/Curses-1.12/

Did you look at the documentation?

Did you try to search for the words 'Curses' and 'Perl' using Google 
(that is where you are posting from after all).

As I said, I do not know much about Curses.

On the other hand, if you attempt something, and it does not do what you 
want, I am sure someone here would be able to help you.

By the way, please do read the posting guidelines for this group. They 
contain valuable information on how you can help others help you.

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: Mon, 4 Apr 2005 08:14:36 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: console colors and line input ...
Message-Id: <slrnd52fds.nr5.tadmc@magna.augustmail.com>

Tonino <tonino.greco@gmail.com> wrote:

> thanks for this


What this is that?

Please quote some context in followups.


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


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

Date: 4 Apr 2005 06:22:00 -0700
From: "Tonino" <tonino.greco@gmail.com>
Subject: Re: console colors and line input ...
Message-Id: <1112620920.196688.62810@l41g2000cwc.googlegroups.com>

and where are these guidlines ?

Tonino



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

Date: Mon, 04 Apr 2005 13:29:30 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: console colors and line input ...
Message-Id: <Xns962E608E61840asu1cornelledu@127.0.0.1>

"Tonino" <tonino.greco@gmail.com> wrote in news:1112620920.196688.62810
@l41g2000cwc.googlegroups.com:

> and where are these guidlines ?

1. They are posted here regularly.

2. You are posting from Google, have you tried entering

   comp.lang.perl.misc posting guidelines

in that search box. 

3. And, for people like you, there is a link to the HTML version in the 
signature portion in all my replies to you.

*Sigh*

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: 4 Apr 2005 07:34:47 -0700
From: "Tonino" <tonino.greco@gmail.com>
Subject: Re: console colors and line input ...
Message-Id: <1112625287.937110.85300@f14g2000cwb.googlegroups.com>


*sigh* indeed - I was going to post a nasty reply but read the
guidelines :

"
Count to ten before composing a followup when you are upset
    This is recommended in all Usenet newsgroups. Here in clpmisc, most
flaming sub-threads are not about any feature of Perl at all! They are
most often for what was seen as a breach of netiquette. If you have
lurked for a bit, then you will know what is expected and won't make
such posts in the first place.

    But if you get upset, wait a while before writing your followup. I
recommend waiting at least 30 minutes.

"

so I guess you are off the hook ... I'd rather opt for the "if you have
nothing NICE or constructive to say"
- then rather say nothing ...

Maybe you could take a note from the above saying ....



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

Date: Mon, 4 Apr 2005 18:38:10 +0200
From: "Tassilo v. Parseval" <tassilo.von.parseval@rwth-aachen.de>
Subject: Re: console colors and line input ...
Message-Id: <slrnd52rbi.103.tassilo.von.parseval@localhost.localdomain>

Also sprach Tonino:

> *sigh* indeed - I was going to post a nasty reply but read the
> guidelines :
>
> "
> Count to ten before composing a followup when you are upset
>     This is recommended in all Usenet newsgroups. Here in clpmisc, most
> flaming sub-threads are not about any feature of Perl at all! They are
> most often for what was seen as a breach of netiquette. If you have
> lurked for a bit, then you will know what is expected and won't make
> such posts in the first place.
>
>     But if you get upset, wait a while before writing your followup. I
> recommend waiting at least 30 minutes.
>
> "
>
> so I guess you are off the hook ... I'd rather opt for the "if you have
> nothing NICE or constructive to say"
> - then rather say nothing ...

What Sinan said apparently helped you to locate the posting guidelines. 

Other than that you've probably already lost. Thinskinned as you seem to
be, you're not going to survive for a very long time in here.

And meanwhile, you're still not providing context through quotes even
though the guidelines describe an effective followup style in great
detail. I am not surprised you missed that part but found the one you
quoted above (which was not applicable in this situation).

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


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

Date: 04 Apr 2005 14:26:00 +0200
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: Golf Q: \$h{X} ?
Message-Id: <yzdzmwepw2v.fsf@invalid.net>


J Krugman <jkrugman345@yahbitoo.com> writes:
> In an old FWP post I found online, there is a golfing construct I
> can't figure out; this is all the post says
> 
>   \$h{X} is one less than ++$h{X}
> 
> If it weren't for the leading backslash, the interpretation of "one
> less" would be obvious and hardly worth remarking upon in such a
> post.  But given the leading backslash, I figure that the "one
> less" is referring to "one fewer characters".  Still, I can't figure
> out what the whole thing means.  Any help would be much appreciated.

That "one less" refers to the number of characters is my interpretation
too. I assume the idea is to make a hash table entry exist by referring
to it (I think that's what's called "autovivification"):

    \$h1{X};
    ++$h2{X};

    $h0 = exists $h0{X} ? "yes" : "no";
    $h1 = exists $h1{X} ? "yes" : "no";
    $h2 = exists $h2{X} ? "yes" : "no";

    print "$h0 $h1 $h2";

prints "no yes yes".


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

Date: Mon, 4 Apr 2005 14:07:21 +0000 (UTC)
From: J Krugman <jkrugman345@yahbitoo.com>
Subject: Re: Golf Q: \$h{X} ?
Message-Id: <d2rhmp$3ij$1@reader1.panix.com>

In <yzdzmwepw2v.fsf@invalid.net> Arndt Jonasson <do-not-use@invalid.net> writes:


>J Krugman <jkrugman345@yahbitoo.com> writes:
>> In an old FWP post I found online, there is a golfing construct I
>> can't figure out; this is all the post says
>> 
>>   \$h{X} is one less than ++$h{X}
>> 
>> If it weren't for the leading backslash, the interpretation of "one
>> less" would be obvious and hardly worth remarking upon in such a
>> post.  But given the leading backslash, I figure that the "one
>> less" is referring to "one fewer characters".  Still, I can't figure
>> out what the whole thing means.  Any help would be much appreciated.

>That "one less" refers to the number of characters is my interpretation
>too. I assume the idea is to make a hash table entry exist by referring
>to it (I think that's what's called "autovivification"):

>    \$h1{X};
>    ++$h2{X};

>    $h0 = exists $h0{X} ? "yes" : "no";
>    $h1 = exists $h1{X} ? "yes" : "no";
>    $h2 = exists $h2{X} ? "yes" : "no";

>    print "$h0 $h1 $h2";

>prints "no yes yes".

Thanks!

jill

-- 
To  s&e^n]d  me  m~a}i]l  r%e*m?o\v[e  bit from my a|d)d:r{e:s]s.



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

Date: Mon, 04 Apr 2005 10:36:38 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Help with a script..
Message-Id: <Xns962E434097FA9asu1cornelledu@127.0.0.1>

Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in
news:3bc7oeF6fhjfhU1@individual.net: 

> A. Sinan Unur wrote:
>> clearguy02@yahoo.com wrote in news:1112576321.475302.71500
>> @z14g2000cwz.googlegroups.com:
>>> 
>>>  $finalDate = sprintf ("20%02d-%02d-%02d %02d:%02d:00\n", $3,
>>> $months{$2}, $1, $4, $5);
>> 
>> As I noted before, there is a Y2.1K bug in there. When doing the
>> right thing is just as easy as doing the wrong thing, why not do the
>> right thing?
> 
> What's "the right thing" when converting a 'DD-Mon-YY' date string?

"The right thing", it seems to me, would be to add the number of years
to 2000 as a rule. In this particular case, with two-digit years the OP
knows to be in this century, it probably does not matter, but IMHO, it
is a good habit to get into. 

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: Mon, 04 Apr 2005 15:08:26 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Help with a script..
Message-Id: <3bcsgtF6hlaisU1@individual.net>

A. Sinan Unur wrote:
> Gunnar Hjalmarsson wrote: 
>> What's "the right thing" when converting a 'DD-Mon-YY' date string?
> 
> "The right thing", it seems to me, would be to add the number of years
> to 2000 as a rule. In this particular case, with two-digit years the OP
> knows to be in this century, it probably does not matter, but IMHO, it
> is a good habit to get into.

I'm still not with you.

Aren't you mixing it up with how you should treat the sixth element 
returned by localtime() or gmtime() in list context? One typical Y2K bug 
in Perl programs was:

     my $year = (localtime)[5];
     $year = "19$year";

while it should have been:

     $year = $year+1900;

But the sixth element never was a two-digit year, even if it was treated 
as such in many programs. When converting two-digit years to four-digit 
ditto you *always* need to know in which century you are, don't you?

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


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

Date: Mon, 04 Apr 2005 13:26:49 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Help with a script..
Message-Id: <Xns962E601A53C69asu1cornelledu@127.0.0.1>

Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in
news:3bcsgtF6hlaisU1@individual.net: 

> A. Sinan Unur wrote:
>> Gunnar Hjalmarsson wrote: 
>>> What's "the right thing" when converting a 'DD-Mon-YY' date string?
>> 
>> "The right thing", it seems to me, would be to add the number of
>> years to 2000 as a rule. In this particular case, with two-digit
>> years the OP knows to be in this century, it probably does not
>> matter, but IMHO, it is a good habit to get into.
> 
> I'm still not with you.
> 
> Aren't you mixing it up with how you should treat the sixth element 
> returned by localtime() or gmtime() in list context?

I am not mixing it up, but that is what I am thinking of.

> When converting two-digit years to four-digit ditto you *always* 
> need to know in which century you are, don't you? 

Yes, and in this case, the OP knows which century the data are from. 
However, the string concatenation approach, which he copied and pasted, 
again, IMHO, obscures that you are adding years to a base century (if that 
makes sense). 

Mine is just a warning against getting into the habit of string 
concatenation. Since the OP was using printf anyway, why not use

# log files were generated after 2001
printf "%4.4d", 2000 + $two_digit_year;

Anyway, this is probably not wasting any more bits over. I see your point, 
and my attitude is appropriately softened on the issue.

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: Mon, 04 Apr 2005 14:27:00 GMT
From: LaDainian Tomlinson <go@away.spam.invalid>
Subject: Re: Help with a script..
Message-Id: <79u7i2-ja4.ln1@news.bclennox.com>

On 2005-04-04, 'clearguy02@yahoo.com' <clearguy02@yahoo.com> wrote in
comp.lang.perl.misc:
> Hi all,
>
> I have the below script ready to change a time stamp from
> 15-Sep-04.01:03 to 2004-09-15 01:03:00.

<snip>

> Now my problem is that the $date variable might have
> 15-Sep-04.01:03 or 15-Sept-04.01:03 or 15-September-04.01:03
> (month will have a range from minumum first three chanracters
> to the whole month name).
>
> then how can I make sure that I can translate either Sep or
> Sept or September in to 09 in the final output?

The Date::Parse module on CPAN do what you want.  Your original
format [close enough to] one of the accepted formats for the
str2time() function:

    $fmt_date = strftime( "...", localtime( str2time $date_str )

Also look at the docs for the POSIX module, mainly strftime().

Brandan L.
-- 
bclennox \at eos \dot ncsu \dot edu


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

Date: Mon, 4 Apr 2005 07:38:05 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Illegal Seek - Any Hints
Message-Id: <slrnd52d9d.nkq.tadmc@magna.augustmail.com>

codefixer@gmail.com <codefixer@gmail.com> wrote:

> trying to execute my$result =
> qx/\.\/test"/ I am getting an error saying Illegal seek.
             ^
             ^

The name of the program has a double quote character in it?

Please use copy/paste rather than attempting to retype code.


> Any hints on what I coud do ?


Post actual Perl code.

Post a short and complete program *that we can run* that
duplicates the problem.

Include the *verbatim* text of any messages you get.

See the Posting Guidelines that are posted here frequently.


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


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

Date: 04 Apr 2005 17:02:38 GMT
From: xhoster@gmail.com
Subject: Re: Illegal Seek - Any Hints
Message-Id: <20050404130238.714$mb@newsreader.com>

codefixer@gmail.com wrote:
> Hi,
>
> I have a script in which I have " do $test" where $test refers to a
> different perl script, say foo.pl

Well, stop doing that.  Execute foo.pl directly until you get the kinks
worked out, then go back to "do"ing it.

>
> In foo.pl when the control is trying to execute my$result =
> qx/\.\/test"/ I am getting an error saying Illegal seek. (All other
> statements execute just fine).

Why choose / as the delimiter when it forces you to escape a literal /?
Do you have an actual program named ./test" ?

>
>  I browsed through some past messages here but still couldn't find
> anything that works.
>
> Any hints on what I coud do ? Is their a way to diagnose this "illegal
> seek" message further ????

In my experience, "illegal seek" generally means that I inspected $! when
I had no business doing so, i.e. when there was not an actual error.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: Mon, 4 Apr 2005 16:36:32 +0000 (UTC)
From: J Krugman <jkrugman345@yahbitoo.com>
Subject: Is "require '/foo/bar/baz.pm'" portable?
Message-Id: <d2rqeg$d8v$1@reader1.panix.com>



Is something like

  require '/path/to/some/Module.pm';

portable?

I could have sworn that there was a perlvar that contained the OS's
directory separator, but I can't find it, so either my memory is
playing me a trick, or this variable was eliminated at some point.

File::Spec is the generally accepted way to construct filenames
portably.  But I have read in a couple of places that it is OK to
give Perl paths with the Unix directory separator like the one
above even in systems that don't use this separator.  If this is
the case, then Perl must be doing the translation internally, which
would greatly diminish the utility of File::Spec, and make the
various OS-specific File::Spec::* modules all but useless.

What gives?

TIA!

jill
-- 
To  s&e^n]d  me  m~a}i]l  r%e*m?o\v[e  bit from my a|d)d:r{e:s]s.



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

Date: Mon, 04 Apr 2005 18:01:04 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Is "require '/foo/bar/baz.pm'" portable?
Message-Id: <d2rrhi$shp$1@sun3.bham.ac.uk>



J Krugman wrote:
> Is something like
> 
>   require '/path/to/some/Module.pm';
> 
> portable?

Yes.
> 
> I could have sworn that there was a perlvar that contained the OS's
> directory separator, but I can't find it, so either my memory is
> playing me a trick, or this variable was eliminated at some point.

No, on some OSs it's not even as simple as a single character.

> File::Spec is the generally accepted way to construct filenames
> portably.  But I have read in a couple of places that it is OK to
> give Perl paths with the Unix directory separator like the one
> above even in systems that don't use this separator.  If this is
> the case, then Perl must be doing the translation internally, which
> would greatly diminish the utility of File::Spec, and make the
> various OS-specific File::Spec::* modules all but useless.
> 
> What gives?

File::Spec is mostly needed for doing stuff like constructing arguments 
for system() or parsing filenames passed into Perl in the OS's native 
format.



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

Date: 4 Apr 2005 06:26:15 -0700
From: teen_machines@yahoo.com.br (Arturi)
Subject: speed issues with pattern matching and substitution
Message-Id: <1a5dc45a.0504040526.577bb919@posting.google.com>

Hello there,

I wrote some perl lines that scans a file looking for some words and
substitute them for their corresponding pairs, which are previously
saved in a HASH.
The code is working fine but I'm wondering what could I do to speed it
up.
Does anybody have a hint?

cheers

here the code extract: 
----------------------------------------------------------------------
%HASH #is being defined previously

@keys= keys(%HASH);
my $line = undef;
my $tmp = undef;

open(FILE,"< in.txt") || die "Can't open ";
open(OUTPUT2,"< out.txt")  || die "Can't open ";

 while (<FILE>)  {
  $line = $_;
   foreach $k (@keys) { 
      if (/(\W)$k(\W)/){
       #print "$_\n";
       $tmp = $HASH{$k};
       while ($line =~/(\W)($k)(\W)/){$line =~
s/(\W)($k)(\W)/$1$tmp$3/;}
     }
    }
   print OUTPUT2 $line;
  }

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


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

Date: Mon, 04 Apr 2005 13:35:20 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: speed issues with pattern matching and substitution
Message-Id: <Xns962E618BDDDBDasu1cornelledu@127.0.0.1>

teen_machines@yahoo.com.br (Arturi) wrote in
news:1a5dc45a.0504040526.577bb919@posting.google.com: 

> The code is working fine but I'm wondering what could I do to speed it
> up.
> Does anybody have a hint?

> %HASH #is being defined previously

use strict;
use warnings;

missing;

> @keys= keys(%HASH);
> my $line = undef;
> my $tmp = undef;

my ($line, $tmp);

You should declare variables in the smallest applicable scope.
 
> open(FILE,"< in.txt") || die "Can't open ";

open my $file, '<', 'in.txt' or die "Can't open in.txt: $!";

> open(OUTPUT2,"< out.txt")  || die "Can't open ";

Why are you opening the output file for reading only?

Also, see above.

>  while (<FILE>)  {
>   $line = $_;

while(my $line = <$file>) {

>    foreach $k (@keys) { 
>       if (/(\W)$k(\W)/){
>        #print "$_\n";
>        $tmp = $HASH{$k};
>        while ($line =~/(\W)($k)(\W)/){$line =~
> s/(\W)($k)(\W)/$1$tmp$3/;}

What is the role of the while there?

>      }
>     }
>    print OUTPUT2 $line;
>   }

I have a sneaking suspicion you have not posted real code.

Please read the posting guidelines for this group for help on how to 
help others help you.

Please post real code.

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: 04 Apr 2005 17:07:42 GMT
From: xhoster@gmail.com
Subject: Re: speed issues with pattern matching and substitution
Message-Id: <20050404130742.954$gu@newsreader.com>

teen_machines@yahoo.com.br (Arturi) wrote:
> Hello there,
>
> I wrote some perl lines that scans a file looking for some words and
> substitute them for their corresponding pairs, which are previously
> saved in a HASH.
> The code is working fine but I'm wondering what could I do to speed it
> up.
> Does anybody have a hint?

Yes.  Post real code.  For example, opening an output file for reading only
is probably not real code.  Describe the input or better give some short
code which generates acceptable fake input for testing.  Tell us how long
it took to run. Tell us how much improvement you are looking for.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: Mon, 04 Apr 2005 17:07:04 +0200
From: "Leendert Bottelberghs" <leendert@wouter.unitedknowledge.net>
Subject: time zone offset calc with localtime and gmtime
Message-Id: <pan.2005.04.04.15.07.04.173255@wouter.unitedknowledge.net>

Hi there,

I want to calculate the time zone offset (as an integer), and I don't want
to depend on other modules.
I want to verify if the following code is correct:

<code>
my @lctime = localtime();
my @gmtime = gmtime();
# index 2 represent the hours
# index 8 represent isdst (daylight saving time boolean (0/1))

$tzoffset = (($lctime[2] - $lctime[8])-($gmtime[2] - $gmtime[8]))%24);

</code>

I figured that if DST is applied locally, the clock is one hour ahead of
"normal" GMT (which hasn't DST applied), so this hour has to be deducted
from the time difference. If the GMT has DST set on, this hour has to be
added to the time difference, hence the double deduction.

Can anyone tell me if my my assumptions are correct?

TIA,

-leendert bottelberghs




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

Date: Mon, 04 Apr 2005 17:34:31 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: time zone offset calc with localtime and gmtime
Message-Id: <3bd53rF6f2spaU1@individual.net>

Leendert Bottelberghs wrote:
> I want to calculate the time zone offset (as an integer), and I don't want
> to depend on other modules.

Why not?

> I figured that if DST is applied locally, the clock is one hour ahead of
> "normal"

That may be true in many countries, but can you rely on it?

> If the GMT has DST set on,

AFAIK, that's never happening.

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


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

Date: Mon, 04 Apr 2005 17:43:12 +0200
From: "Leendert Bottelberghs" <leendert@wouter.unitedknowledge.net>
Subject: Re: time zone offset calc with localtime and gmtime
Message-Id: <pan.2005.04.04.15.43.12.225964@wouter.unitedknowledge.net>

On Mon, 04 Apr 2005 17:34:31 +0200, Gunnar Hjalmarsson wrote:
>> I want to calculate the time zone offset (as an integer), and I don't
>> want to depend on other modules.
> 
> Why not?

For different reasons:
- I use this in a module that will be used in mod_perl. I want to keep the
number of loaded modules as concise as possible, because of the server
memory overhead; - I want to be able to distribute this module without
people having to install other modules;


>> I figured that if DST is applied locally, the clock is one hour ahead
>> of "normal"
> 
> That may be true in many countries, but can you rely on it?

I truly don't know. That's part of the reason I posted this ;) Anyone...?

>> If the GMT has DST set on,
> 
> AFAIK, that's never happening.

I thought so. Thanx for your response,

-leendert bottelberghs


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

Date: Mon, 04 Apr 2005 15:50:48 GMT
From: Geoff <geoff@invalid.invalid>
Subject: Re: time zone offset calc with localtime and gmtime
Message-Id: <n9o251d59aqbshv574qf3ko6b3oq2iup2n@4ax.com>

On Mon, 04 Apr 2005 17:07:04 +0200, "Leendert Bottelberghs"
<leendert@wouter.unitedknowledge.net> wrote:

>Hi there,
>
>I want to calculate the time zone offset (as an integer), and I don't want
>to depend on other modules.
>I want to verify if the following code is correct:
>
><code>
>my @lctime = localtime();
>my @gmtime = gmtime();
># index 2 represent the hours
># index 8 represent isdst (daylight saving time boolean (0/1))
>
>$tzoffset = (($lctime[2] - $lctime[8])-($gmtime[2] - $gmtime[8]))%24);
>
></code>
>
>I figured that if DST is applied locally, the clock is one hour ahead of
>"normal" GMT (which hasn't DST applied), so this hour has to be deducted
>from the time difference. If the GMT has DST set on, this hour has to be
>added to the time difference, hence the double deduction.
>
>Can anyone tell me if my my assumptions are correct?
>
>TIA,
>
>-leendert bottelberghs
>

$tzoffset, if you are going to make it an integer should be in units
of 1 second, not hours. There a places in the world where the offset
is not a whole hour. (e.g., Newfoundland, Tehran, Kabul, Rangoon,
Kathmandu, Darwin)


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

Date: Mon, 4 Apr 2005 08:50:58 -0700
From: "Mothra" <mothra@nowhereatall.com>
Subject: Re: time zone offset calc with localtime and gmtime
Message-Id: <42516164$1@usenet.ugs.com>


"Leendert Bottelberghs" <leendert@wouter.unitedknowledge.net> wrote in
message news:pan.2005.04.04.15.43.12.225964@wouter.unitedknowledge.net...
> I truly don't know. That's part of the reason I posted this ;) Anyone...?

You may want to bring this up on the DateTime mailing list
 datetime-subscribe@perl.org.

Mothra




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

Date: 4 Apr 2005 09:46:43 -0700
From: "Richard  Lawrence" <richard.lawrence@gmail.com>
Subject: Re: Using HTTPS with LWP::UserAgent = Bad Service
Message-Id: <1112633203.299943.104890@g14g2000cwa.googlegroups.com>

Ilmari Karonen wrote:
> Richard  Lawrence <richard.lawrence@gmail.com> kirjoitti 31.03.2005:
> >
> > $ perl testproxy.pl 1
> > HTTPS_PROXY=http://10.10.200.44:8080/
> > HTTPS_PROXY_PASSWORD=mypassword
> > HTTPS_PROXY_USERNAME=richard
> > HTTP_PROXY=http://10.10.199.45:80/
> > Going to get https://www.nodeworks.com
> > Using HTTPS proxy http://10.10.200.44:8080/
> > Result is:
> > 500 (Internal Server Error) Can't connect to www.nodeworks.com:443
(Bad
> > service '8080/')
>
> Ah, I think I see what the problem is now.
>
> Try getting rid of the trailing slash after ":8080".

Worked like a charm. Thank you very much for all your help.

Richard.



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

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


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