Windows 10上的Strawberry Perl在当前目录中找不到模块

时间:2019-06-14 05:00:17

标签: perl windows-10 strawberry-perl

我已经在Windows 10上安装了Strawberry Perl v5.28.0 MSWin32-x64-multi-thread。但是,我注意到它在当前目录下找不到模块,并且每次运行任何脚本时,我都必须添加当前目录放入路径。

perl -I . somescript.pl

以前不是这种情况。有没有一种方法可以默认将当前目录放在路径中,所以我不必使用

perl -I .

注意:在浏览时,我读到某个地方(不记得链接或网站),出于安全原因,最新版本的Perl从@INC排除了当前目录。但是我正在尝试为开发机器找到解决方案。

1 个答案:

答案 0 :(得分:1)

在当前工作目录中查找没有意义。对于脚本而言,寻找与其捆绑的模块通常是有意义的,也就是说,有时告诉Perl在相对于脚本位置的路径中寻找模块是有意义的。为此,脚本应包含


Protected Sub btnSearchEmployee_Click(sender As Object, e As EventArgs)

        Dim bytes As Byte()
        Using br As BinaryReader = New BinaryReader(FileUpload1.PostedFile.InputStream)
            bytes = br.ReadBytes(FileUpload1.PostedFile.ContentLength)
        End Using


        Using conn As New SqlConnection(ConfigurationManager.ConnectionStrings(##).ToString())

            conn.Open()
            Dim cmd As New SqlCommand("SELECT EmployeeCodes.ID , Departments.ShortDescription , Departments.Code AS [Department Code] , EmployeeCodes.FirstName , EmployeeCodes.LastName , EmployeeCodes.EmployeeID , EmployeeCodes.Code , EmployeePhoto.Photo FROM EmployeeCodes,EmployeevsPositionLink , PositionCodes , Departments , EmployeePhoto  WHERE   EmployeePhoto.ID = EmployeeCodes.ID AND EmployeevsPositionLink.EmployeeID = EmployeeCodes.ID AND EmployeevsPositionLink.PositionID = PositionCodes.ID AND PositionCodes.DepartmentCode = Departments.Code  AND  EmployeeCodes.TerminationDate Is Null AND EmployeevsPositionLink.PositionNumber = '1' AND EmployeeCodes.Company IN (1,3) AND (EmployeeCodes.Code = @code)", conn)

            cmd.Parameters.AddWithValue("@code", txtSearchEmployee.Text)

            Dim adapter As New SqlDataAdapter(cmd)
            Dim tbl As New DataTable()

            adapter.Fill(tbl)
            If tbl.Rows.Count() > 0 Then

                lblID.Text = tbl.Rows(0)(0).ToString()
                txtName.Text = tbl.Rows(0)(3).ToString()
                txtSurname.Text = tbl.Rows(0)(4).ToString()
                txtIDNo.Text = tbl.Rows(0)(5).ToString()
                txtCostCentre.Text = tbl.Rows(0)(2).ToString()
                txtDepartment.Text = tbl.Rows(0)(1).ToString()
                txtClockNo.Text = tbl.Rows(0)(6).ToString()

            Else

                lblSearchEmployee.Visible = True
                lblSearchEmployee.Text = "No employee found with the number" + " " + txtSearchEmployee.Text

            End If


            conn.Close()

        End Using

    End Sub

如果这仅是为了开发,则设置env var use FindBin qw( $RealBin ); use lib $RealBin; # or "$RealBin/lib" or "$RealBin/../lib", etc 可能更有意义。