[24329] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6518 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 4 21:05:45 2004

Date: Tue, 4 May 2004 18:05:10 -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           Tue, 4 May 2004     Volume: 10 Number: 6518

Today's topics:
    Re: Authen::NTLM and MS04-011 (Dave Smith)
    Re: Books online???? <***************>
    Re: calculate date 4 days ago <jtc@shell.dimensional.com>
    Re: calculate date 4 days ago <Jon.Ericson@jpl.nasa.gov>
    Re: calculate date 4 days ago <jtc@shell.dimensional.com>
        Editing a alias file  issue <ashutosh.jog@pdf.com>
    Re: Editing a alias file  issue <tony_curtis32@_SPAMTRAP_yahoo.com>
    Re: Editing a alias file  issue <ashutosh.jog@pdf.com>
    Re: forking an independent process <xxala_qumsiehxx@xxyahooxx.com>
    Re: forking an independent process <salvafg@terra.es>
    Re: hashes and array's <tore@aursand.no>
    Re: Help -- Code attached - db2buildts.pl (0/1) <ebohlman@earthlink.net>
        Komodo as a editor? <catcher@linuxmail.org>
    Re: Komodo as a editor? <I'll@email.you>
    Re: MSSQL 2000 Connect Success <***************>
        Splitting up long words (Marcus)
    Re: Splitting up long words <usenet@morrow.me.uk>
    Re: Splitting up long words <tore@aursand.no>
        Where's documentation for import ??? Amanda aman_DO_da345@al_THE_ter_OBVIOUS_n.org
    Re: Where's documentation for import ??? <usenet@morrow.me.uk>
    Re: Win32::API and SetEnvironmentVariable <ebohlman@earthlink.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 4 May 2004 15:33:01 -0700
From: dmsmith@comcast.net (Dave Smith)
Subject: Re: Authen::NTLM and MS04-011
Message-Id: <f8ab5cc9.0405041433.1fc963b4@posting.google.com>

andrew.speer@isolutions.com.au (Andrew Speer) wrote in message news:<967a9d2.0405040355.a94beb5@posting.google.com>...
> I recently came across this same problem. The challenge format looks
> to have changed, and as a result Authen::NTLM seems to sends a
> "broken" NT domain string to the server.
Your fix also addresses another issue: the 1.02 code would fail if you
attempted to login across domains via a trust (e.g. the user was in
domain A and the server was in domain B). The debug output of LWP and
the security log look similar to the MS04-011 problem.

> I hope it is also backwards compatible with pre MS04-11 patched server, but 
> have been unable to test.
I've checked it here with Win2K/IIS both pre and post MS04-011 and it
now works with the above fix.

Thanks Andrew!


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

Date: Tue, 04 May 2004 19:37:11 -0500
From: Henry Williams <***************>
Subject: Re: Books online????
Message-Id: <aucg90dqh043hb9e4fgt0ipl0h3fvckh93@4ax.com>


>
>Please everyone. Before you reply with a sarcastic or RTFM answer,
>consider how you'd like other to respond to you if you were new or
>stuck or didn't know where to find the answer. I have a firm rule on
>questions: "There is no such thing as a stupid question. Just stupid
>answers."
>
>Have a good week.
>Brian
>

Thanks for best wishes for the week! After Monday, I needed them. One
of those days when perfect code would not compile and the coffee maker
quit, but it's light was still on.

The thing is, it takes energy to be a bastard to someone. But there
are people whose fate is to go through life being a bastard. I myself
am thankful I don't share their fate.

However "correcting" the novice poster is a valued outlet for these
types of people.

About 3 years ago I used to read comp.lang.c everyday and people were
always flaming others for their novice posts, and it seemed such a
silly (Talk about silly) waste of energy.

Isn't it better to ignore if you've nothing helpful to say? And if
your intent is to be helpful isn't it better to be kind than to be a….
bastard?

When I see a post subject like "Pleeze HELP!!!!" or the like I tend
not to read it. Occasionally I will, but more often than not the
subject indicates the type of poster you have.

I figure if the poster gets ignored, it will encourage them to lurk
more, read the posts of others who do get helpful replies and then
began to understand how to post.

If someone cuts in line in front of me, I'm very likely to do nothing.
They most probably have issues that propelled them to rude behavior
that otherwise they might not exhibit. They might be having a bad day.
Their boss might be a bastard. Life is too short to fiddle with
bastards.

But there are those…. bastards that can't resist grabbing the line
cutter by the collar and like a dog observing pack order, challenge
them for their spot in the line. I'm not a bigger man than most, I'm
just not a small man.

I have a long life to live (hopefully!) and I'm grateful it does not
include the urge to be a bastard.

Henry



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

Date: 4 May 2004 16:42:52 -0600
From: Jim Cochrane <jtc@shell.dimensional.com>
Subject: Re: calculate date 4 days ago
Message-Id: <slrnc9g73c.o19.jtc@shell.dimensional.com>

In article <rcgisfbvr79.fsf@Jon-Ericson.sdsio.prv>, Jon Ericson wrote:
> jshaboo@hotmail.com (joe shaboo) writes:
> 
>> I'm trying to list files that are 4 days old, and then perform an
>> action on them. I don't care about any files that are newer (have been
>> edited or touched in the last 4 days), only 4 days or older.
>>
>> I can do this either through SHELL or perl, which ever is easier. 
> 
> Using option 1:
> 
>   $ find . -mtime -4

For files 4 days or more older, I believe what is needed is: -mtime +4
(Check man find to be sure.)

and you can do (in bash or ksh):

process() {
	: Do whatever with $1
}

for file in $(find . -mtime +4 -exec grep -l 'pattern' {} ';'); do
	process $file
done


-- 
Jim Cochrane; jtc@dimensional.com
[When responding by email, include the term non-spam in the subject line to
get through my spam filter.]


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

Date: Tue, 04 May 2004 16:52:50 -0700
From: Jon Ericson <Jon.Ericson@jpl.nasa.gov>
Subject: Re: calculate date 4 days ago
Message-Id: <rcgad0nvjfx.fsf@Jon-Ericson.sdsio.prv>

Jim Cochrane <jtc@shell.dimensional.com> writes:

> In article <rcgisfbvr79.fsf@Jon-Ericson.sdsio.prv>, Jon Ericson wrote:
>> jshaboo@hotmail.com (joe shaboo) writes:
>> 
>>> I'm trying to list files that are 4 days old, and then perform an
>>> action on them. I don't care about any files that are newer (have been
>>> edited or touched in the last 4 days), only 4 days or older.
>>>
>>> I can do this either through SHELL or perl, which ever is easier. 
>> 
>> Using option 1:
>> 
>>   $ find . -mtime -4
>
> For files 4 days or more older, I believe what is needed is: -mtime +4
> (Check man find to be sure.)

Right.  My manpage says:

   TESTS
       Numeric arguments can be specified as

       +n     for greater than n,

       -n     for less than n,

       n      for exactly n.

It's also posible that -atime would be required instead of -mtime.

> and you can do (in bash or ksh):
>
> process() {
> 	: Do whatever with $1
> }
>
> for file in $(find . -mtime +4 -exec grep -l 'pattern' {} ';'); do
> 	process $file
> done

I'm not sure what the point of using a function is.  I'd probably
write something like:

  $ find . -mtime +4 | xargs whatever

(As you can tell, I sometimes have trouble remembering the find
syntax. ;)

Jon


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

Date: 4 May 2004 18:56:58 -0600
From: Jim Cochrane <jtc@shell.dimensional.com>
Subject: Re: calculate date 4 days ago
Message-Id: <slrnc9geuq.4bd.jtc@shell.dimensional.com>

In article <rcgad0nvjfx.fsf@Jon-Ericson.sdsio.prv>, Jon Ericson wrote:
> Jim Cochrane <jtc@shell.dimensional.com> writes:
> 
>> In article <rcgisfbvr79.fsf@Jon-Ericson.sdsio.prv>, Jon Ericson wrote:
>>> jshaboo@hotmail.com (joe shaboo) writes:
>>> 
> ...
>> and you can do (in bash or ksh):
>>
>> process() {
>> 	: Do whatever with $1
>> }
>>
>> for file in $(find . -mtime +4 -exec grep -l 'pattern' {} ';'); do
>> 	process $file
>> done
> 
> I'm not sure what the point of using a function is.  I'd probably
> write something like:

Just convenience - I prefer to not let one command line get too complex,
but it's not necessary.

> 
>   $ find . -mtime +4 | xargs whatever
> 
> (As you can tell, I sometimes have trouble remembering the find
> syntax. ;)
> 
> Jon


-- 
Jim Cochrane; jtc@dimensional.com
[When responding by email, include the term non-spam in the subject line to
get through my spam filter.]


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

Date: Tue, 04 May 2004 15:20:28 -0700
From: Ash <ashutosh.jog@pdf.com>
Subject: Editing a alias file  issue
Message-Id: <109g5nuf9c0c398@corp.supernews.com>

Hi,

I am new to this newsgroup, so bear with me. I am trying to get a 
solution to a file editing issue that I am having. Any help is 
appreciated. Here are the details.:

I am writing a script, part of which edits a majordomo aliases file. The 
current alias file is managed manually and all the aliases in the file 
are alphabetically sorted. I want to add new alias to the existing file 
and keep it in the same sorted way. In short the sorting is very 
critical. I am not sure how to go about the same. Any new alias that I 
add has about 19 lines as the example below:
For eg. the lines for the alias 'all' would be -
------------------------------------------------------------------------------------------------
#
# all
#
all: "|/usr/majordomo/wrapper resend -l all -f owner-all -h malt1 
all-outgoing"
all-outgoing: :include:/var/majordomo/lists/all,all-archive
all-archive: "|/usr/majordomo/wrapper archive2.pl -f 
/var/majordomo/archives/all/all -a -d"
all-request: "|/usr/majordomo/wrapper majordomo -l all"
all-approval: abc@post1
owner-all: abc@post1
owner-all-outgoing: owner-all@malt1
#
# all
#
all-digestify: "|/usr/majordomo/wrapper digest -r -C -l all-digest 
all-digest-outgoing"
all-digest: all
all-digest-outgoing: :include:/var/majordomo/lists/all-digest
all-digest-request: "|/usr/majordomo/wrapper majordomo -l all-digest"
all-digest-approval: abc@post1
#
------------------------------------------------------------------------------------------------

The issue is how to sort all the lists alphabetically. Any solutions are 
welcome.

Thanks.



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

Date: Tue, 04 May 2004 17:33:03 -0500
From: Tony Curtis <tony_curtis32@_SPAMTRAP_yahoo.com>
Subject: Re: Editing a alias file  issue
Message-Id: <87d65jsu00.fsf@limey.hpcc.uh.edu>

>> On Tue, 04 May 2004 15:20:28 -0700,
>> Ash <ashutosh.jog@pdf.com> said:

> Hi, I am new to this newsgroup, so bear with me. I am trying
> to get a solution to a file editing issue that I am
> having. Any help is appreciated. Here are the details.:

> I am writing a script, part of which edits a majordomo
> aliases file. The current alias file is managed manually and
> all the aliases in the file are alphabetically sorted. I
> want to add new alias to the existing file and keep it in
> the same sorted way. In short the sorting is very
> critical.

"perldoc -f sort" is the obvious answer.

Less obviously I would suggest keeping the "real info" in a
database and then generate the majordomo file from that.  That
way you can sort during the extraction process (e.g. SQL
select) while having the benefit of maintaining all the data
in a structured format.

hth
t


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

Date: Tue, 04 May 2004 15:40:04 -0700
From: Ash <ashutosh.jog@pdf.com>
Subject: Re: Editing a alias file  issue
Message-Id: <109g6smmqvpl8c9@corp.supernews.com>

Hi,

I tried using sort but it did not work as well as I wanted it to: For eg:
-----------------------------------------------------------------------
all: "|/usr/majordomo/wrapper resend -l all -f owner-all -h malt1 
all-outgoing"
all-outgoing: :include:/var/majordomo/lists/all,all-archive
-----------------------------------------------------------------------

I created a hash that would have :

all
all-outgoing

(i.e. the left side elements) as the keys and everything on the right to 
it the value. Then I tried to  sort the keys. The problem is if the new 
alias lines are lets say plain appended to the list and then the list is 
sorted with the hash using the  'cmp' operator, it still does not work 
as desired.

Database is not an option as of now.

Thanks.


Tony Curtis wrote:

>>>On Tue, 04 May 2004 15:20:28 -0700,
>>>Ash <ashutosh.jog@pdf.com> said:
> 
> 
>>Hi, I am new to this newsgroup, so bear with me. I am trying
>>to get a solution to a file editing issue that I am
>>having. Any help is appreciated. Here are the details.:
> 
> 
>>I am writing a script, part of which edits a majordomo
>>aliases file. The current alias file is managed manually and
>>all the aliases in the file are alphabetically sorted. I
>>want to add new alias to the existing file and keep it in
>>the same sorted way. In short the sorting is very
>>critical.
> 
> 
> "perldoc -f sort" is the obvious answer.
> 
> Less obviously I would suggest keeping the "real info" in a
> database and then generate the majordomo file from that.  That
> way you can sort during the extraction process (e.g. SQL
> select) while having the benefit of maintaining all the data
> in a structured format.
> 
> hth
> t



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

Date: Tue, 04 May 2004 22:18:04 GMT
From: "Ala Qumsieh" <xxala_qumsiehxx@xxyahooxx.com>
Subject: Re: forking an independent process
Message-Id: <wEUlc.44980$xc.21470@newssvr29.news.prodigy.com>

"bxb7668" <bxb7668@somewhere.nocom> wrote in message
news:Hx7Lp4.Enp@news.boeing.com...
> From my perl script I need to be able to launch (fork?) an editor
> (notepad on Windows and nedit on UNIX). (Easy so far.) I need the
> script to processing and the editor to keep editing totally
> independent of each other. The script can end and the editor will stay
> open. The editor can be closed and the script will keep running.

I wouldn't even go with fork() here:

    # untested code:
    if ($^O eq 'MSWin32') {
      system 'start notepad.exe';
    } else { # unix
      system 'nedit &';
    }

Unless I misunderstood you, that should be enough.

--Ala




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

Date: Tue, 04 May 2004 23:04:53 GMT
From: =?ISO-8859-1?Q?Salvador_Fandi=F1o?= <salvafg@terra.es>
Subject: Re: forking an independent process
Message-Id: <pkVlc.160560$A6.617056@telenews.teleline.es>

bxb7668 wrote:
> From my perl script I need to be able to launch (fork?) an editor
> (notepad on Windows and nedit on UNIX). (Easy so far.) I need the
> script to processing and the editor to keep editing totally
> independent of each other. The script can end and the editor will stay
> open. The editor can be closed and the script will keep running.
> Reading up on fork gave me this:

use Proc::Background;

- Salvador


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

Date: Wed, 05 May 2004 01:55:49 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: hashes and array's
Message-Id: <pan.2004.05.04.23.52.06.978122@aursand.no>

On Tue, 04 May 2004 15:46:56 +0000, Dafke8 wrote:
> I'm making a perl script that searches all the names in a text [...]

Actually, as I understand, it's HTML.  I know that HTML is made up of
text, but; Don't use regular expressions to parse HTML.  It _is_ rocket
science, so try to stick with HTML::Parser (or one of the related modules).

> sub list_name2number(@){

No need to prototype it.

>    my @namen;
>    my $naam;
>    my $aktenummer;
>    my $akte;
>    my %naamnrs;

You should consider _not_ declaring these variables _before_ you use them.
Keeping them within the correct (and - most often - only-used) scope is
what you probably want.

> foreach $akte(@tekst){
>     if($akte =~
>     m!<span\s+class="akte"\s+id="[0-9]+-[0-9]+">(.*?)</span>!g){
>        $akte =~
>        m!<span\s+class="akte"\s+id="[0-9]+-[0-9]+">(.*?)</span>!g;
>        ($aktenummer = $1);
>      }
>      }

Can't really see why you have that regular expression twice; only once
will do the same;

  foreach my $akte ( @tekst ) {
      if ( $akte =~ m!<span\s+class="akte"\s+id="[0-9]+-[0-9]+">(.*?)</span>!g ) {
          $aktenummer = $1;
      }
  }

> push @namen,$akte =~ m!<span\s+class="naam"\s+id="n[0-9]+">(.*?)</span>!g;

You _really_ should check the outcome of this patch before you try to use
anything from it.  What happens if the match fails?

  if ( $akte =~ m!<span\s+class="naam"\s+id="n[0-9]+">(.*?)</span>!g ) {
      push( @namen, $1 );
  }

You could also consider doing the two regular expressions (above) in one
take, thus saving some lines of code;

  if ( $akte =~ m!<span\s+class="(.*?)"\s+id="(.*?)">(.*?)</span>!g ) {
      my $class = $1;
      my $id    = $2;
      my $span  = $3;
  }

Just a suggestion.

>      foreach $naam(@namen){
>        if (exists $naamnrs{uc($naam)}){
>          if(not($naamnrs{uc($naam)} =~ m!$aktenummer!)){
>            $naamnrs{uc($naam)} = $naamnrs{uc($naam)}." ".$aktenummer;
>          }

Hmm.  Maybe you should consider uppercasing the things you add to $naamnrs
when you add them?  Seems like there are way too many uc() calls in the
code above.  No error, of course, but...

And:  Please do something with your indentation.  It's almost impossible
to read your code properly, and I refuse to copy and paste it into my own
editor to format it right.

When you've done that, _and_ taken account of the suggestions I've made,
please feel free to repost your question(s).


-- 
Tore Aursand <tore@aursand.no>
"Then there was the man who drowned crossing a stream with an average
 depth of six inches." (W.I.E. Gates)


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

Date: 4 May 2004 23:14:33 GMT
From: Eric Bohlman <ebohlman@earthlink.net>
Subject: Re: Help -- Code attached - db2buildts.pl (0/1)
Message-Id: <Xns94DFBA358F8FFebohlmanomsdevcom@130.133.1.4>

Mulder <tdyboc@insight.rr.com> wrote in 
news:oi3g90dg37oc20uioho3eoie2ahunfkd48@4ax.com:

> I am new to perl and am having trouble converting an old korn shell
> script into perl.  The attached script when executed simply displays a
> statement to stdout.  My problem is that I cannot figure out how to
> resolve an embedded variable.  The variable in question is
> $container_path and the two variables I want resolved are
> $nbr_data_path and $nbr_partition.

Please don't post attachments to Usenet messages: copy and paste the code 
if it's short, put it up in a publicly accessible place and post a URL to 
it if it isn't.  Many news servers (the one I'm using, for one) strip off 
attachments in non-binary groups (so I can't see your shell script), and 
people whose servers don't strip attachments tend to get annoyed when they 
pop up (and it adds enough hassle to inspecting the attached code that many 
if not most people simply won't bother).


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

Date: Tue, 04 May 2004 18:31:21 -0400
From: Robert <catcher@linuxmail.org>
Subject: Komodo as a editor?
Message-Id: <hJGdnQRF9eMnhAXdRVn-jw@adelphia.com>

I am evaluating Komodo as an editor for work. I am doing a lot of Perl 
work as a sysadmin and am starting to get into Perl/Tk as well. We use 
PVCS for version control and I see Komodo integrates with that.

All that to say "Do you use it and what do you think about it?".

Robert


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

Date: Tue, 04 May 2004 23:05:23 GMT
From: don't email me <I'll@email.you>
Subject: Re: Komodo as a editor?
Message-Id: <TkVlc.10585$oJ2.168084@weber.videotron.net>

["Followup-To:" header set to comp.lang.perl.misc.]
On Tue, 04 May 2004 18:31:21 -0400, Robert wrote:
> I am evaluating Komodo as an editor for work. I am doing a lot of Perl 
> work as a sysadmin and am starting to get into Perl/Tk as well. We use 
> PVCS for version control and I see Komodo integrates with that.
>
> All that to say "Do you use it and what do you think about it?".
>

Dude, editors are tools. Some people like this tool, some people like that 
tool.  It is personal and religious and is a matter of habit. My favorite 
editor is vi.  There is nothing better, AFAIC.  It is my primary tool 
for the past 12 years. I think emacs, M$word and all other editors out 
there are garbage... But hey, this is just me... you might think otherwise. 
You might have (or will) get used to some other editor.  Try this Komodo 
thingy and see for yourself if you like it or not.....


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

Date: Tue, 04 May 2004 18:22:03 -0500
From: Henry Williams <***************>
Subject: Re: MSSQL 2000 Connect Success
Message-Id: <lt8g9015mj24rtan1n53n568fe60hcmbcu@4ax.com>


>>
>Does your data contain embedded quotes?  I use Win32::ODBC to retrieve and
>insert data into MSSQL2K extensively and found that I had to basically
>create code to process embedded quotes and null values...  I think this is
>automatically handled by the "prepare" function of DBI...  At the time, I
>could not have completed my work without Dave Roth's Win32::ODBC module but
>I know I am delaying the inevitable - switching to DBI & its related
>modules...
>


Actually it does not now, but as requirements expand it will happen
eventually. I know what you mean about embedded quotes… they have
given me grief in a lot of contexts over the years.

The null values thing, yes I have encountered that, but so far it's
not biting me. I read the data into an @list, and then iterate the
list printing to a file.

I too am studying using DBI, but WIN32::ODBC was fast and easy, hard
not to like that. Plus I just stumbled on it first, and the name of
the game is results and preferably they wanted it ready yesterday.
:)

Good luck with DBI

Henry



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

Date: 4 May 2004 15:21:39 -0700
From: snoopyatwork2004@yahoo.com (Marcus)
Subject: Splitting up long words
Message-Id: <7ad6e25d.0405041421.6d381709@posting.google.com>

Hi

In perl, what is the smotthest way of splitting up words longer than x
characters?

Ex.

From a textfield I have $text (max 400 characters in total)

I want to print $text, but while doing that split any words longer
than 10 characters long through inserting a space

If $text = "this is a sample text and now here is
averylongwordthatwouldmessupthelinebreaks"

The result, when printed out, would be:

"this is a sample text and now here is averylongw ordthatwou
ldmessupth elinebreaks"


Thanks!


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

Date: Tue, 4 May 2004 22:52:33 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Splitting up long words
Message-Id: <c796rh$8ve$1@wisteria.csv.warwick.ac.uk>


Quoth snoopyatwork2004@yahoo.com (Marcus):
> Hi
> 
> In perl, what is the smotthest way of splitting up words longer than x
> characters?
> 
> Ex.
> 
> From a textfield I have $text (max 400 characters in total)
> 
> I want to print $text, but while doing that split any words longer
> than 10 characters long through inserting a space
> 
> If $text = "this is a sample text and now here is
> averylongwordthatwouldmessupthelinebreaks"
> 
> The result, when printed out, would be:
> 
> "this is a sample text and now here is averylongw ordthatwou
> ldmessupth elinebreaks"

<untested>
1 while $text =~ s/(\S{10}\S)/$1 $2/;

Ben


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

Date: Wed, 05 May 2004 01:55:49 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: Splitting up long words
Message-Id: <pan.2004.05.04.23.54.26.915527@aursand.no>

On Tue, 04 May 2004 15:21:39 -0700, Marcus wrote:
> In perl, what is the smotthest way of splitting up words longer than x
> characters?

If you're looking for _flexible_ solutions, please take a look at the
Text::* modules, especially Text::Wrap and Text::Autoformat.


-- 
Tore Aursand <tore@aursand.no>
"Nothing is certain but death and taxes. Of the two, taxes happen
 annually." (Joel Fox)


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

Date: Tue, 4 May 2004 22:45:13 +0000 (UTC)
From: Amanda aman_DO_da345@al_THE_ter_OBVIOUS_n.org
Subject: Where's documentation for import ???
Message-Id: <c796dp$2hk$1@reader2.panix.com>





I am having a *very* hard time understanding the function "use",
at least judging by the many times that it bites me in the rear.
The biggest enigma of all is "import".

Yes, I have read perlfunc on "use" and "import", and I have read
perlmod, and I have read the manpage for Exporter.  None of these
documents comes even close to explaining what import is supposed
to do; they don't even explain what import's input and output
signatures are.

Where can I find this information?

Thanks!

Amanda
-- 


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

Date: Tue, 4 May 2004 23:08:45 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Where's documentation for import ???
Message-Id: <c797pt$9si$1@wisteria.csv.warwick.ac.uk>


Quoth Amanda aman_DO_da345@al_THE_ter_OBVIOUS_n.org:
> 
> I am having a *very* hard time understanding the function "use",
> at least judging by the many times that it bites me in the rear.
> The biggest enigma of all is "import".
> 
> Yes, I have read perlfunc on "use" and "import", and I have read
> perlmod, and I have read the manpage for Exporter.  None of these
> documents comes even close to explaining what import is supposed
> to do; they don't even explain what import's input and output
> signatures are.
> 
> Where can I find this information?

I'm not sure... could you explain (I'm not being sarky: it is genuinely
useful to know when documentation is unclear) what it is you do not
understand about

use Module LIST;

is in every way equivalent to

BEGIN {
    require Module;
    Module->import(LIST);
}

(leaving aside for a moment the fact you don't understand import)? Think
of it like a sort-of macro if that makes it easier: it is simply there
to save typing.

Do you understand all three things there: a BEGIN block, require with a
bareword, and a method call? If you don't then read "Package
Constructors and Destructors" in perlmod for BEGIN; perldoc -f require
for require and perlboot for the method call.

Now, import. This is not a Perl builtin at all. It is simply a
convention: whenever a module is used, Perl gives it a chance to set
itself up by calling its 'import' method, if it defines one. It is
perhaps slightly confusing that import is in perlfunc at all: it is just
a sub in the package Module (or some package it inherits from).

You don't really need to know this unless you are writing your own
modules: to use someone else's module you just say

use Module qw/foo bar/;

and that's that. The fact that Perl is calling Module->import(qw/foo
bar/) behind-the-scenes doesn't need to worry you: that's for the module
author (or, if they're sensible and use Exporter or an equivalent, the
author of *that* module) to worry about.

Ben


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

Date: 4 May 2004 22:58:31 GMT
From: Eric Bohlman <ebohlman@earthlink.net>
Subject: Re: Win32::API and SetEnvironmentVariable
Message-Id: <Xns94DFB77DFE349ebohlmanomsdevcom@130.133.1.4>

Ben Morrow <usenet@morrow.me.uk> wrote in 
news:c791n4$5gm$1@wisteria.csv.warwick.ac.uk:

> 
> Quoth smc0862.usa@mindspring.com (Shawn Campbell):
>> I'm having a problem setting environment variables with a large
>> string.  According to the MSDN documentation, an environment variable
>> can be up to 32k.  I'm well under this value, but it's not being set.
>> 
>> Following is the code I'm using.
> 
> <snip Win32::API SetEnvironmentVar>
> 
> Why do you not just use %ENV? (Is there something I'm missing?)

I presume he's doing it for the reasons listed by perldoc -q environment


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

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


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