Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Question on Strawberry's Portable .bat file

by KevinZwack (Chaplain)
on Aug 03, 2012 at 17:28 UTC ( #985295=perlquestion: print w/ replies, xml ) Need Help??
KevinZwack has asked for the wisdom of the Perl Monks concerning the following question:

Not a Perl question per se, but I am trying to deploy Strawberry Perl's PortableZIP, and for the life of me I cannot figure out what the If statement in line 4 below does: (from portableshell.bat)

@echo off set drive=%~dp0 set drivep=%drive% If $#\#$==$#%drive:~-1%#$ set drivep=%drive:~0,-1% set PATH=%drivep%\perl\site\bin;%drivep%\perl\bin;%drivep%\c\bin;%PATH +% rem env variables set TERM=dumb set PERL_JSON_BACKEND=JSON::XS set PERL_YAML_BACKEND=YAML rem avoid collisions with other perl stuff on your system set PERL5LIB= set PERL5OPT= set PERL_MM_OPT= set PERL_MB_OPT= echo ---------------------------------------------- echo Welcome to Strawberry Perl Portable Edition! echo * URL - http://www.strawberryperl.com/ echo * see README.portable.TXT for more info echo ---------------------------------------------- perl -e "printf("""Perl executable: %%s\nPerl version : %%vd\n""", $ +^X, $^V)" 2>nul if ERRORLEVEL==1 echo.&echo FATAL ERROR: 'perl' does not work; check i +f your strawberry pack is complete! echo. cmd /K

The rest of the script all makes sense to me. This is in regards to Rule of Life #23, "Never ask your users to use something which you yourself do not understand, because you know they will ask about it."

Thanks,
Kevin Zwack

Comment on Question on Strawberry's Portable .bat file
Download Code
Re: Question on Strawberry's Portable .bat file
by Anonymous Monk on Aug 03, 2012 at 18:07 UTC

    See also Where should I post X?

    This is PerlMonks. Stay on topic. This is not the place to ask about bugs in your javascript (or the other 'j' language) nor how to learn write a formula in a spreadsheet, even though there are many Monks knowledgeable in such disciplines.

    Although, you can employ Basic debugging checklist even in batch file programming ( ECHO )

      if( '$##$' eq '$#'. substr( $ENV{drive}, -1 ) .'#$') { $ENV{drivep} = substr($ENV{drive} ,0,-1); }

        Thank you, that gave me the answer I needed.

      In my opinion, this is on topic. The OP is trying to get a better understanding of the batch file that you have to run in order to use portable Strawberry Perl. Sounds like a Perl related question to me. (In case you're not familiar with portable Strawberry Perl, the batch script modifies the environment (such as path) for just that command prompt window.)

      From my perspective, your "if it isn't Perl code, you're not allowed to ask about it on PerlMonks" attitude means folks can't ask for help with creating new XS modules or trying to debug issues with compiling Perl modules or compiling Perl from source code since that involves dealing with code that is not purely Perl code. That's just ridiculous IMHO.

      That's my 2 cents.

      I apologize if the tone of this post sounds harsh. Just tired of seeing folks trying to impose unwritten "policies" by criticizing the person for daring to violate one of those "policies" rather than offering at least a little assistance to the OP. Decided to speak up for once about it.

        Just tired of seeing folks trying to impose unwritten "policies" by criticizing the person for daring to violate one of those "policies" rather than offering at least a little assistance to the OP. Decided to speak up for once about it.

        Well said that man!++

        I wish more people would speak up more often on this issue.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

        The start of some sanity?

        The OP is trying to get a better understanding of the batch file that you have to run in order to use portable Strawberry Perl.

        Yes, the OP is essentially trying to learn batch programming, not trying to solve some strawberryperl problem he's encountered, and AFAIK, that is off topic

        From my perspective ... That's just ridiculous IMHO.

        Yes, I agree, because that is not the same perspective at all -- compiling perl, compiling modules, writing XS, is all clearly on topic -- having perlmonks teach you batch file programming is off topic

        I apologize if the tone of this post sounds harsh. Just tired of seeing folks trying to impose unwritten "policies" by criticizing the person for daring to violate one of those "policies" rather than offering at least a little assistance to the OP. Decided to speak up for once about it.

        Well, that is quote from the official policy, the "written" one that I linked, check your facts. If you have a problem with the policy, complain to the management.

        And FWIW, I'm not sure how quoting the official policy is criticism.

        And FWIW, I did offer both assistance ( Although, you can employ Basic debugging checklist even in batch file programming ( ECHO ) ) and the literal answer

        So yeah, I too am tired of , well, of whatever your posting qualifies as -- inaccurately (libelously?) defending lazy off topic posters?

        How hard is to copy/paste that line and put ECHO in front of it?

        code

        echo DRIVE %drive% echo DRIVEP %drivep% echo ONLY %drive:~-1% echo EQUALS $#\#$==$#%drive:~-1%#$ echo NEW SET drivep=%drive:~0,-1%

        output

        DRIVE C:\ro\sham\bo\ DRIVEP C:\ro\sham\bo\ ONLY \ EQUALS $#\#$==$#\#$ NEW SET drivep=C:\ro\sham\bo

        Instead of speaking up next time, consider saving it for a better fit.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://985295]
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (12)
As of 2014-09-18 21:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (124 votes), past polls